public class LinkLabel extends ItemLabel implements java.io.Externalizable
DiagramLink
. New labels can be added
to a link by calling the DiagramLink.addLabel(String)
method.Constructor and Description |
---|
LinkLabel()
Used during deserialization.
|
LinkLabel(DiagramLink link)
Initializes a new instance of the LinkLabel class.
|
LinkLabel(DiagramLink link,
java.lang.String text)
Initializes a new instance of the LinkLabel class.
|
Modifier and Type | Method and Description |
---|---|
LinkLabel |
clone()
Creates a clone of this label.
|
boolean |
getAutoArrange()
Gets a value indicating whether the label can be auto arranged.
|
float |
getLengthFactor()
Gets label's position along link's length when
the RelativeTo property is set to LinkLength.
|
protected DiagramLink |
getLink()
Returns the
DiagramLink that displays this label. |
RelativeToLink |
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.
|
protected java.awt.geom.Point2D.Float |
pointAlongLength(float lengthFactor) |
protected java.awt.geom.Point2D.Float |
pointAlongLength(float lengthFactor,
PointList segments)
Returns a point lying on a polyline that is positioned at a relative position along the polyline's length.
|
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 |
setAutoArrange(boolean value)
Sets a value indicating whether the label can be auto arranged.
|
void |
setControlPointPosition(int controlPoint,
float dx,
float dy)
Positions this label relatively to the specified control point.
|
void |
setLengthFactor(float value)
Sets label's position along link's length when
the RelativeTo property is set to LinkLength.
|
void |
setLinkLengthPosition(float lengthFactor)
Positions this label relatively to the link length.
|
void |
setRelativeTo(RelativeToLink value)
Sets the label's relative positioning.
|
void |
setSegmentPosition(int segment,
float dx,
float dy)
Positions this label relatively to the specified link segment.
|
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 LinkLabel(DiagramLink link)
link
- The DiagramLink that displays the label.public LinkLabel()
public LinkLabel(DiagramLink link, java.lang.String text)
link
- The DiagramLink that displays the label.text
- The label's text.public LinkLabel clone()
clone
in class java.lang.Object
public void setSegmentPosition(int segment, float dx, float dy)
segment
- The segment index.dx
- Horizontal offset from the segment center.dy
- Vertical offset from the segment center.public void setControlPointPosition(int controlPoint, float dx, float dy)
controlPoint
- The control point index.dx
- Horizontal offset from the point.dy
- Vertical offset from the point.public void setLinkLengthPosition(float lengthFactor)
lengthFactor
- A value between 0 and 1 specifying the position of the label relatively to the link's length.protected java.awt.geom.Point2D.Float pointAlongLength(float lengthFactor)
protected java.awt.geom.Point2D.Float pointAlongLength(float lengthFactor, PointList segments)
lengthFactor
- A value from 0 to 1 specifying a portion of link's length.segments
- A list of points specifying the polyline segments.Point2D.Float
instance.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 DiagramLink getLink()
DiagramLink
that displays this label.DiagramLink
instance.public RelativeToLink getRelativeTo()
RelativeToLink
enumeration.public void setRelativeTo(RelativeToLink value)
value
- A member of the RelativeToLink
enumeration.public float getLengthFactor()
public void setLengthFactor(float value)
value
- A float value specifying label's position.public boolean getAutoArrange()
boolean
indicating whether the label can be auto arranged.public void setAutoArrange(boolean value)
value
- A boolean
indicating whether the label can be auto arranged.