|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.SimpleUserDataHandler
public class SimpleUserDataHandler
Simple implementation of the GenericNodeRealizer.UserDataHandler
,
GenericEdgeRealizer.UserDataHandler
, and YLabel.UserDataHandler
interfaces.
that can be used by GenericNodeRealizer
, GenericEdgeRealizer
, and YLabel
instances respectively.
This implementation tries to either clone the user data and if that fails either
copies the value by reference, returns null
or throws a RuntimeException
Field Summary | |
---|---|
static byte |
EXCEPTION_ON_FAILURE
Policy constant. |
static byte |
NULL_ON_FAILURE
Policy constant. |
static byte |
REFERENCE_ON_FAILURE
Policy constant. |
Constructor Summary | |
---|---|
SimpleUserDataHandler(byte mode)
Creates a new instance of SimpleUserDataHandler using the given mode |
Method Summary | |
---|---|
java.lang.Object |
copyUserData(EdgeRealizer srcContext,
java.lang.Object srcData,
EdgeRealizer targetContext)
Copies the user-defined data appropriately. |
java.lang.Object |
copyUserData(NodePort srcPort,
java.lang.Object srcData,
NodePort tgtPort)
Creates a copy of the specified user data that is suitable for the specified target port instance. |
java.lang.Object |
copyUserData(NodeRealizer srcContext,
java.lang.Object srcData,
NodeRealizer targetContext)
Copies the user data using its clone method and if that fails either returns the reference, null, or throws a RuntimeException, depending on the mode of this instance. |
protected java.lang.Object |
copyUserData(java.lang.Object srcData)
Callback method that performs the actual copy. |
java.lang.Object |
copyUserData(YLabel srcContext,
java.lang.Object srcData,
YLabel targetContext)
Copies the user-defined data appropriately. |
java.lang.Object |
readUserData(EdgeRealizer context,
java.io.ObjectInputStream ois)
Retrieves the user-defined data object from the ObjectInputStream . |
java.lang.Object |
readUserData(NodeRealizer context,
java.io.ObjectInputStream ois)
Read the user data using the default serialization method. |
protected java.lang.Object |
readUserData(java.io.ObjectInputStream ois)
|
java.lang.Object |
readUserData(YLabel context,
java.io.ObjectInputStream ois)
Retrieves the user-defined data object from the ObjectInputStream . |
void |
storeUserData(EdgeRealizer context,
java.lang.Object userData,
java.io.ObjectOutputStream oos)
Stores the user-defined data object to the ObjectOutputStream . |
void |
storeUserData(NodeRealizer context,
java.lang.Object userData,
java.io.ObjectOutputStream oos)
Writes the user data using the default serialization method. |
protected void |
storeUserData(java.lang.Object userData,
java.io.ObjectOutputStream oos)
|
void |
storeUserData(YLabel context,
java.lang.Object userData,
java.io.ObjectOutputStream oos)
Stores the user-defined data object to the ObjectOutputStream . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte REFERENCE_ON_FAILURE
public static final byte NULL_ON_FAILURE
null
if cloning fails
and serialize a null
if serialization fails.
public static final byte EXCEPTION_ON_FAILURE
Constructor Detail |
---|
public SimpleUserDataHandler(byte mode)
Method Detail |
---|
public java.lang.Object copyUserData(NodeRealizer srcContext, java.lang.Object srcData, NodeRealizer targetContext)
copyUserData
in interface GenericNodeRealizer.UserDataHandler
protected java.lang.Object copyUserData(java.lang.Object srcData)
srcData
- the object to copy/clone
public java.lang.Object readUserData(NodeRealizer context, java.io.ObjectInputStream ois) throws java.io.IOException
readUserData
in interface GenericNodeRealizer.UserDataHandler
java.io.IOException
protected java.lang.Object readUserData(java.io.ObjectInputStream ois) throws java.io.IOException
java.io.IOException
public void storeUserData(NodeRealizer context, java.lang.Object userData, java.io.ObjectOutputStream oos) throws java.io.IOException
storeUserData
in interface GenericNodeRealizer.UserDataHandler
java.io.IOException
protected void storeUserData(java.lang.Object userData, java.io.ObjectOutputStream oos) throws java.io.IOException
java.io.IOException
public void storeUserData(EdgeRealizer context, java.lang.Object userData, java.io.ObjectOutputStream oos) throws java.io.IOException
GenericEdgeRealizer.UserDataHandler
ObjectOutputStream
. Used for YGF serialization.
storeUserData
in interface GenericEdgeRealizer.UserDataHandler
context
- the edge to store the user-defined datauserData
- the user-defined data objectoos
- the stream to store the user-defined data object to
java.io.IOException
- if an exception occurspublic java.lang.Object readUserData(EdgeRealizer context, java.io.ObjectInputStream ois) throws java.io.IOException
GenericEdgeRealizer.UserDataHandler
ObjectInputStream
. Used for YGF deserialization.
readUserData
in interface GenericEdgeRealizer.UserDataHandler
context
- the edge to read the user-defined data forois
- the stream to read the user-defined data object from
java.io.IOException
- if an exception occurspublic java.lang.Object copyUserData(EdgeRealizer srcContext, java.lang.Object srcData, EdgeRealizer targetContext)
GenericEdgeRealizer.UserDataHandler
copyUserData
in interface GenericEdgeRealizer.UserDataHandler
srcContext
- the edge that will be copiedsrcData
- the data associated with the srcContexttargetContext
- the edge the copy will be associated with
public void storeUserData(YLabel context, java.lang.Object userData, java.io.ObjectOutputStream oos) throws java.io.IOException
YLabel.UserDataHandler
ObjectOutputStream
. Used for YGF serialization.
storeUserData
in interface YLabel.UserDataHandler
context
- the label to store the user-defined data foruserData
- the user-defined data objectoos
- the stream to store the user-defined data object to
java.io.IOException
- if an exception occurspublic java.lang.Object readUserData(YLabel context, java.io.ObjectInputStream ois) throws java.io.IOException
YLabel.UserDataHandler
ObjectInputStream
. Used for YGF deserialization.
readUserData
in interface YLabel.UserDataHandler
context
- the label to read the user-defined data forois
- the stream to read the user-defined data object from
java.io.IOException
- if an exception occurspublic java.lang.Object copyUserData(YLabel srcContext, java.lang.Object srcData, YLabel targetContext)
YLabel.UserDataHandler
copyUserData
in interface YLabel.UserDataHandler
srcContext
- the label that will be copiedsrcData
- the data associated with the srcContexttargetContext
- the label the copy will be associated with
public java.lang.Object copyUserData(NodePort srcPort, java.lang.Object srcData, NodePort tgtPort)
NodePort.UserDataHandler
copyUserData
in interface NodePort.UserDataHandler
srcPort
- the port instance whose user data is copied.srcData
- the user data that has to be copied.tgtPort
- the port instance for which the copy is created.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |