public class LinkLabel extends java.lang.Object implements java.io.Externalizable, InplaceEditable
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.
|
protected void |
draw(android.graphics.Canvas graphics,
RenderOptions options)
Draws this label on the specified
Canvas surface. |
boolean |
getAutoArrange()
Gets a value indicating whether the label can be auto arranged.
|
Brush |
getBrush()
Gets the brush used to draw the label's background.
|
android.graphics.RectF |
getEditRect(DiagramItem item,
android.graphics.PointF pointerPosition)
Implements InplaceEditable.getEditRect.
|
boolean |
getEnableWrap()
Gets whether the text should wrap to multiple lines.
|
Font |
getFont()
Gets the font of the link's label text.
|
Align |
getHorizontalAlign()
Gets the horizontal alignment of the text within the label's layout rectangle.
|
int |
getIndex()
Gets the index of the segment or control point this label is relative to.
|
protected android.graphics.RectF |
getLayoutRect()
Gets the label's layout rectangle calculated from text length, font and alignment.
|
protected DiagramLink |
getLink()
Returns the
DiagramLink that displays this label. |
Thickness |
getMargin()
Gets the text margins size.
|
float |
getMaxWidth()
Gets the maximal width that when reached should cause text to wrap to a new line.
|
RelativeToLink |
getRelativeTo()
Gets the label's relative positioning.
|
java.lang.String |
getText()
Gets the label's text.
|
Color |
getTextColor()
Gets the color of the link's label text.
|
java.lang.String |
getTextToEdit()
Implements InplaceEditable.getTextToEdit.
|
Align |
getVerticalAlign()
Gets the vertical alignment of the text relatively to the label's position.
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Loads the label from the specified XML element.
|
protected android.graphics.PointF |
pointAlongLength(float lengthFactor) |
protected android.graphics.PointF |
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 |
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 |
setBrush(Brush value)
Sets the brush used to draw the label's background.
|
void |
setControlPointPosition(int controlPoint,
float dx,
float dy)
Positions this label relatively to the specified control point.
|
void |
setEditedText(java.lang.String newText)
Implements InplaceEditable.setEditedText.
|
void |
setEnableWrap(boolean enableWrap)
Sets whether the text should wrap to multiple lines.
|
void |
setFont(Font value)
Sets the font of the link's label.
|
void |
setHorizontalAlign(Align align)
Sets the horizontal alignment of the text within the label's layout rectangle.
|
void |
setIndex(int value)
Sets the index of the segment or control point this label is relative to.
|
void |
setLinkLengthPosition(float lengthFactor)
Positions this label relatively to the link length.
|
void |
setMargin(Thickness margin)
Sets the text margins size.
|
void |
setMaxWidth(float maxWidth)
Sets the maximal width that when reached should cause text to wrap to a new line.
|
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 |
setText(java.lang.String text)
Sets the label's text.
|
void |
setTextColor(Color value)
Sets the color of the link's label.
|
void |
setVerticalAlign(Align align)
Sets the vertical alignment of the text relatively to the label's position.
|
void |
writeExternal(java.io.ObjectOutput out)
Saves the label into the specified binary stream.
|
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.Objectpublic 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.public int getIndex()
public void setIndex(int value)
value - The integer index of a link's segment or control point.public RelativeToLink getRelativeTo()
RelativeToLink enumeration.public void setRelativeTo(RelativeToLink value)
value - A member of the RelativeToLink enumeration.public void setText(java.lang.String text)
text - A String containing the label's text.public java.lang.String getText()
String containing the label's text.public void setTextColor(Color value)
value - A Color object representing the text color.public Color getTextColor()
Color object representing the text color.public void setBrush(Brush value)
value - A Brush instance specifying the background brush.public Brush getBrush()
Brush instance specifying the background brush.public void setFont(Font value)
value - A Font object representing the text font.public Font getFont()
Font object representing the text font.protected DiagramLink getLink()
DiagramLink that displays this label.DiagramLink instance.protected void draw(android.graphics.Canvas graphics,
RenderOptions options)
Canvas surface.graphics - A Canvas instance.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.public void setMargin(Thickness margin)
margin - A Thickness value specifying the size of text margins.public Thickness getMargin()
Thickness value specifying the size of text margins.public void setEnableWrap(boolean enableWrap)
enableWrap - true to enable text wrapping; otherwise, false.public boolean getEnableWrap()
true if text wrapping is enabled; otherwise, false.public void setMaxWidth(float maxWidth)
maxWidth - A float value specifying the maximal label width.public float getMaxWidth()
public void setHorizontalAlign(Align align)
align - A member of the Align enumeration.public Align getHorizontalAlign()
Align enumeration.public void setVerticalAlign(Align align)
align - A member of the Align enumeration.public Align getVerticalAlign()
Align enumeration.protected android.graphics.PointF pointAlongLength(float lengthFactor)
protected android.graphics.PointF 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.PointF instance.protected android.graphics.RectF getLayoutRect()
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundExceptionprotected void saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
xmlElement - An Element instance.context - An XmlPersistContext instance.protected void loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
throws javax.xml.transform.TransformerException
xmlElement - An Element instance.context - An XmlPersistContext instance.javax.xml.transform.TransformerExceptionpublic java.lang.String getTextToEdit()
getTextToEdit in interface InplaceEditablepublic void setEditedText(java.lang.String newText)
setEditedText in interface InplaceEditablenewText - The new text of this label.public android.graphics.RectF getEditRect(DiagramItem item, android.graphics.PointF pointerPosition)
getEditRect in interface InplaceEditableitem - The DiagramLink whose label's text will be edited.mousePosition - A PointF instance specifying the current pointer position.