|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindfusion.diagramming.LinkLabel
public class LinkLabel
Represents a label displayed by a DiagramLink
. New labels can be added
to a link by calling the DiagramLink.addLabel(String)
method.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
LinkLabel |
clone()
Creates a clone of this label. |
protected void |
draw(java.awt.Graphics2D graphics)
Draws this label on the specified Graphics2D surface. |
boolean |
getAutoArrange()
Gets a value indicating whether the label can be auto arranged. |
java.awt.geom.Rectangle2D |
getEditRect(java.awt.geom.Point2D mousePosition)
Implements InplaceEditable . |
boolean |
getEnableWrap()
Gets whether the text should wrap to multiple lines. |
java.awt.Font |
getFont()
Gets the font of the link's label text. |
int |
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 java.awt.geom.Rectangle2D |
getLayoutRect()
Gets the label's layout rectangle calculated from text length, font and alignment. |
protected DiagramLink |
getLink()
Returns the DiagramLink that displays this label. |
float |
getMargin()
Gets the text margins size. |
float |
getMaxWidth()
Gets the maximal width that when reached should cause text to wrap to a new line. |
int |
getRelativeTo()
Gets the label's relative positioning. |
java.lang.String |
getText()
Gets the label's text. |
java.awt.Color |
getTextColor()
Gets the color of the link's label text. |
java.lang.String |
getTextToEdit()
Implements InplaceEditable . |
int |
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 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 |
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 |
setEditedText(java.lang.String newText)
Implements InplaceEditable . |
void |
setEnableWrap(boolean enableWrap)
Sets whether the text should wrap to multiple lines. |
void |
setFont(java.awt.Font value)
Sets the font of the link's label. |
void |
setHorizontalAlign(int 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(float 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(int 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(java.awt.Color value)
Sets the color of the link's label. |
void |
setVerticalAlign(int 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. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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.Method Detail |
---|
public LinkLabel clone()
clone
in class java.lang.Object
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.public int getIndex()
public void setIndex(int value)
value
- The integer index of a link's segment or control point.public int getRelativeTo()
LinkLabel
constants.public void setRelativeTo(int value)
value
- One of the LinkLabel
constants.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(java.awt.Color value)
value
- A Color
object representing the text color.public java.awt.Color getTextColor()
Color
object representing the text color.public void setFont(java.awt.Font value)
value
- A Font
object representing the text font.public java.awt.Font getFont()
Font
object representing the text font.protected DiagramLink getLink()
DiagramLink
that displays this label.
DiagramLink
instance.protected void draw(java.awt.Graphics2D graphics)
Graphics2D
surface.
graphics
- A Graphics2D
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(float margin)
margin
- A float value specifying the size of text margins.public float getMargin()
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(int align)
align
- One of the Align
constants.public int getHorizontalAlign()
Align
constants.public void setVerticalAlign(int align)
align
- One of the Align
constants.public int getVerticalAlign()
Align
constants.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.protected java.awt.geom.Rectangle2D getLayoutRect()
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)
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.TransformerException
public java.awt.geom.Rectangle2D getEditRect(java.awt.geom.Point2D mousePosition)
InplaceEditable
.
getEditRect
in interface InplaceEditable
public java.lang.String getTextToEdit()
InplaceEditable
.
getTextToEdit
in interface InplaceEditable
public void setEditedText(java.lang.String newText)
InplaceEditable
.
setEditedText
in interface InplaceEditable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |