public abstract class ItemLabel extends java.lang.Object implements InplaceEditable
| Constructor and Description |
|---|
ItemLabel()
Used during deserialization.
|
ItemLabel(DiagramItem item)
Initializes a new instance of the ItemLabel class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Called when drag operation is canceled.
|
protected void |
draw(java.awt.Graphics2D graphics)
Draws this label on the specified
Graphics2D surface. |
Brush |
getBrush()
Gets the brush used to draw the label's background.
|
java.lang.Float |
getContentPadding()
Gets the distance between image and text when both are specified.
|
java.awt.geom.Rectangle2D |
getEditRect(DiagramItem item,
java.awt.geom.Point2D mousePosition)
Implements InplaceEditable.getEditRect.
|
boolean |
getEnableWrap()
Gets whether the text should wrap to multiple lines.
|
java.awt.Font |
getFont()
Gets the font of the label's text.
|
Align |
getHorizontalAlign()
Gets label's horizontal alignment relative to the pin point.
|
float |
getHorizontalOffset()
Gets label's horizontal offset from its pin point.
|
java.awt.Image |
getImage()
Gets the image displayed by this label.
|
ImageAlign |
getImageAlign()
Gets the alignment of label's image relative to text.
|
java.awt.geom.Dimension2D |
getImageSize()
Gets a size that overrides the native image size.
|
java.lang.String |
getImageUrl()
Gets a URL used to load an image into this label.
|
int |
getIndex()
Gets the index of an edge or point this label is relative to.
|
protected DiagramItem |
getItem()
Returns the
DiagramItem that displays this label. |
protected java.awt.geom.Rectangle2D |
getLayoutRect()
Gets the label's layout rectangle calculated from text length, font and alignment.
|
boolean |
getLocked()
Gets a value indicating whether users are allowed to edit 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.
|
java.lang.String |
getText()
Gets the label's text.
|
java.awt.Color |
getTextColor()
Gets the color of the label's text.
|
java.lang.String |
getTextToEdit()
Implements InplaceEditable.getTextToEdit.
|
Align |
getVerticalAlign()
Gets label's vertical alignment relative to the pin point.
|
float |
getVerticalOffset()
Gets the label's vertical offset.
|
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 |
onPointerDown(java.awt.geom.Point2D mousePosition)
Called when the left mouse button is pressed while the pointer is over this label.
|
void |
onPointerMove(java.awt.geom.Point2D mousePosition)
Called when the mouse is moved while this label tracks the mouse events.
|
void |
onPointerUp(java.awt.geom.Point2D mousePosition)
Called when the left mouse button is released while this label tracks the mouse events.
|
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 |
setBrush(Brush value)
Sets the brush used to draw the label's background.
|
void |
setContentPadding(java.lang.Float value)
Sets the distance between image and text when both are specified.
|
void |
setEditedText(java.lang.String newText)
Implements InplaceEditable.setEditedText.
|
void |
setEnableWrap(boolean enableWrap)
Sets whether the text should wrap to multiple lines.
|
void |
setFont(java.awt.Font value)
Sets the font of the label's text.
|
void |
setHorizontalAlign(Align align)
Sets label's horizontal alignment relative to the pin point.
|
void |
setHorizontalOffset(float value)
Sets label's horizontal offset from its pin point.
|
void |
setImage(java.awt.Image value)
Sets the image displayed by this label.
|
void |
setImageAlign(ImageAlign value)
Sets the alignment of label's image relative to text.
|
void |
setImageSize(java.awt.geom.Dimension2D value)
Sets a size that overrides the native image size.
|
void |
setImageUrl(java.lang.String value)
Sets a URL used to load an image into this label.
|
void |
setIndex(int value)
Sets the index of an edge or point this label is relative to.
|
void |
setLocked(boolean value)
Sets a value indicating whether users are allowed to edit this label.
|
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.
|
CursorHint |
setMouseCursor(java.awt.geom.Point2D point)
Indicates what cursor to display for interactive labels.
|
void |
setText(java.lang.String text)
Sets the label's text.
|
void |
setTextColor(java.awt.Color value)
Sets the color of the label's text.
|
void |
setVerticalAlign(Align align)
Sets label's vertical alignment relative to the pin point.
|
void |
setVerticalOffset(float value)
Sets the label's vertical offset.
|
public ItemLabel(DiagramItem item)
item - The DiagramItem that displays the label.public ItemLabel()
protected void draw(java.awt.Graphics2D graphics)
Graphics2D surface.graphics - A Graphics2D instance.protected java.awt.geom.Rectangle2D getLayoutRect()
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.TransformerExceptionprotected void saveToJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
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)
obj - A JsonObject containing the label's data.context - A JsonPersistContext object providing contextual information about
the serialization process and helper serialization methods.public 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 java.awt.geom.Rectangle2D getEditRect(DiagramItem item, java.awt.geom.Point2D mousePosition)
getEditRect in interface InplaceEditableitem - The DiagramItem whose label's text will be edited.mousePosition - A Point2D instance specifying the current pointer position.public void onPointerDown(java.awt.geom.Point2D mousePosition)
mousePosition - A Point2D instance that specifies the current mouse position.public void onPointerMove(java.awt.geom.Point2D mousePosition)
mousePosition - A Point2D instance that specifies the current mouse position.public void onPointerUp(java.awt.geom.Point2D mousePosition)
mousePosition - A Point2D instance that specifies the current mouse position.public CursorHint setMouseCursor(java.awt.geom.Point2D point)
point - Specifies mouse pointer position.public void cancel()
protected DiagramItem getItem()
DiagramItem that displays this label.DiagramItem instance.public int getIndex()
public void setIndex(int value)
value - An integer index.public java.lang.String getText()
String containing the label's text.public void setText(java.lang.String text)
text - A String containing the label's text.public java.awt.Color getTextColor()
Color object representing the text color.public void setTextColor(java.awt.Color value)
value - A Color object representing the text color.public Brush getBrush()
Brush instance specifying the background brush.public void setBrush(Brush value)
value - A Brush instance specifying the background brush.public java.awt.Font getFont()
Font object representing the text font.public void setFont(java.awt.Font value)
value - A Font object representing the text font.public java.lang.Float getContentPadding()
public void setContentPadding(java.lang.Float value)
value - A float value specifying padding distance.public java.awt.Image getImage()
java.awt.Image object.public void setImage(java.awt.Image value)
value - A java.awt.Image object.public java.lang.String getImageUrl()
String containing the URL.public void setImageUrl(java.lang.String value)
value - A String containing the URLpublic ImageAlign getImageAlign()
ImageAlign enumeration.public void setImageAlign(ImageAlign value)
value - A member of the ImageAlign enumeration.public java.awt.geom.Dimension2D getImageSize()
public void setImageSize(java.awt.geom.Dimension2D value)
value - A Dimension2D instance.public boolean getLocked()
public void setLocked(boolean value)
value - true to prevent users from editing this label, or false otherwise.public Thickness getMargin()
Thickness instance specifying the size of text margins.public void setMargin(Thickness margin)
margin - A Thickness instance specifying the size of text margins.public boolean getEnableWrap()
true if text wrapping is enabled, or false otherwise.public void setEnableWrap(boolean enableWrap)
enableWrap - true to enable text wrapping, or false otherwise.public float getMaxWidth()
public void setMaxWidth(float maxWidth)
maxWidth - A float value specifying the maximal label width.public Align getHorizontalAlign()
Align enumeration.public void setHorizontalAlign(Align align)
align - A member of the Align enumeration.public Align getVerticalAlign()
Align enumeration.public void setVerticalAlign(Align align)
align - A member of the Align enumeration.public float getHorizontalOffset()
public void setHorizontalOffset(float value)
value - A float value specifying horizontal offset.public float getVerticalOffset()
public void setVerticalOffset(float value)
value - A float value specifying vertical offset.