public class NodeLabel extends ItemLabel implements java.io.Externalizable
DiagramNode
. New labels can be added
to a node by calling the DiagramNode.addLabel(String)
method.Constructor and Description |
---|
NodeLabel()
Used during deserialization.
|
NodeLabel(DiagramNode node)
Initializes a new instance of the NodeLabel class.
|
NodeLabel(DiagramNode node,
java.lang.String text)
Initializes a new instance of the NodeLabel class.
|
Modifier and Type | Method and Description |
---|---|
NodeLabel |
clone()
Creates a clone of this label.
|
protected DiagramNode |
getNode()
Returns the
DiagramNode that displays this label. |
RelativeToNode |
getRelativeTo()
Gets the label's relative positioning.
|
protected void |
loadFromJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Loads the label from a JSON object.
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Loads the label from the specified XML element.
|
void |
readExternal(java.io.ObjectInput in)
Loads the label from the specified binary stream.
|
protected void |
saveToJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Saves the label as a JSON object.
|
protected void |
saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Saves the label into the specified XML element.
|
void |
setCenterPosition(float dx,
float dy)
Positions this label relatively to the node center.
|
void |
setCornerPosition(int cornerPoint,
float dx,
float dy)
Positions this label relatively to the specified corner point.
|
void |
setEdgePosition(int edge,
float dx,
float dy)
Positions this label relatively to the specified node edge.
|
void |
setRelativeTo(RelativeToNode value)
Sets the label's relative positioning.
|
void |
writeExternal(java.io.ObjectOutput out)
Saves the label into the specified binary stream.
|
cancel, draw, getBrush, getEditRect, getEnableWrap, getFont, getHorizontalAlign, getHorizontalOffset, getIndex, getItem, getLayoutRect, getMargin, getMaxWidth, getText, getTextColor, getTextToEdit, getVerticalAlign, getVerticalOffset, onPointerDown, onPointerMove, onPointerUp, setBrush, setEditedText, setEnableWrap, setFont, setHorizontalAlign, setHorizontalOffset, setIndex, setMargin, setMaxWidth, setMouseCursor, setText, setTextColor, setVerticalAlign, setVerticalOffset
public NodeLabel(DiagramNode node)
node
- The DiagramNode that displays the label.public NodeLabel()
public NodeLabel(DiagramNode node, java.lang.String text)
node
- The DiagramNode that displays the label.text
- The label's text.public NodeLabel clone()
clone
in class java.lang.Object
public void setEdgePosition(int edge, float dx, float dy)
edge
- The edge index.dx
- Horizontal offset from the edge center.dy
- Vertical offset from the edge center.public void setCornerPosition(int cornerPoint, float dx, float dy)
cornerPoint
- The corner point index.dx
- Horizontal offset from the point.dy
- Vertical offset from the point.public void setCenterPosition(float dx, float dy)
dx
- Horizontal offset from the center point.dy
- Vertical offset from the center point.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
protected void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
saveToXml
in class ItemLabel
xmlElement
- An Element
instance.context
- An XmlPersistContext
instance.protected void loadFromXml(org.w3c.dom.Element xmlElement, XmlPersistContext context) throws javax.xml.transform.TransformerException
loadFromXml
in class ItemLabel
xmlElement
- An Element
instance.context
- An XmlPersistContext
instance.javax.xml.transform.TransformerException
protected void saveToJson(com.mindfusion.common.JsonObject obj, JsonPersistContext context)
saveToJson
in class ItemLabel
obj
- A JsonObject instance to contain the serialized data.context
- A JsonPersistContext object providing contextual information
about the serialization process and helper serialization methods.protected void loadFromJson(com.mindfusion.common.JsonObject obj, JsonPersistContext context)
loadFromJson
in class ItemLabel
obj
- A JsonObject containing the label's data.context
- A JsonPersistContext object providing contextual information about
the serialization process and helper serialization methods.protected DiagramNode getNode()
DiagramNode
that displays this label.DiagramNode
instance.public RelativeToNode getRelativeTo()
RelativeToNode
enumeration.public void setRelativeTo(RelativeToNode value)
value
- A member of the RelativeToNode
enumeration.