Package org.graffiti.graphics
Class LabelAttribute
java.lang.Object
org.graffiti.attributes.AbstractAttribute
org.graffiti.attributes.AbstractCollectionAttribute
org.graffiti.attributes.HashMapAttribute
org.graffiti.graphics.LabelAttribute
- All Implemented Interfaces:
Comparable<Object>
,Attribute
,CollectionAttribute
,DeepCopy
,GraphicAttributeConstants
,Displayable
- Direct Known Subclasses:
EdgeLabelAttribute
,NodeLabelAttribute
public abstract class LabelAttribute extends HashMapAttribute implements GraphicAttributeConstants
Contains the graphic attribute label
- Version:
- $Revision: 1.19 $
-
Field Summary
Fields inherited from interface org.graffiti.graphics.GraphicAttributeConstants
ABOVE, ABOVELEFT, ABOVERIGHT, ABSHOR, ABSVERT, ALIGNMENT, ALIGNSEGMENT, ANCHOR, ARROWHEAD, ARROWTAIL, AUTO_OUTSIDE, AXISCOLOR, BELOW, BELOWLEFT, BELOWRIGHT, BENDS, BENDS_PATH, BGIMAGE, BLUE, BORDER_BOTTOM_CENTER, BORDER_BOTTOM_LEFT, BORDER_BOTTOM_RIGHT, BORDER_LEFT_BOTTOM, BORDER_LEFT_CENTER, BORDER_LEFT_TOP, BORDER_RIGHT_BOTTOM, BORDER_RIGHT_CENTER, BORDER_RIGHT_TOP, BORDER_TOP_CENTER, BORDER_TOP_LEFT, BORDER_TOP_RIGHT, CATEGORY_BACKGROUND_A, CATEGORY_BACKGROUND_B, CATEGORY_BACKGROUND_C, CENTERED, CENTERED_FIT, CHARTBACKGROUNDCOLOR, CIRCLE_CLASSNAME, COLOR, COMMON, COORD_PATH, COORDINATE, COORDX_PATH, COORDY_PATH, CUBICSPLINE, CUBICSPLINE_CLASSNAME, DEFAULT_CAP_B, DEFAULT_CAP_R, DEFAULT_JOIN, DEFAULT_MITER, DIM_PATH, DIMENSION, DIMH_PATH, DIMW_PATH, DOCKING, DOCKING_PATH, ELLIPSE_CLASSNAME, FILLCOLOR, FILLCOLOR_PATH, FONTNAME, FONTSIZE, FONTSTYLE, FRAMECOLOR, FRAMETHICKNESS, FRAMETHICKNESS_PATH, GRADIENT, GRAPHICS, GREEN, GRIDCOLOR, HEATMAP_LOWER_COL, HEATMAP_MIDDLE_COL, HEATMAP_UPPER_COL, HEIGHT, HIDDEN, IMAGE, IN, INSIDEBOTTOM, INSIDEBOTTOMLEFT, INSIDEBOTTOMRIGHT, INSIDELEFT, INSIDERIGHT, INSIDETOP, INSIDETOPLEFT, INSIDETOPRIGHT, LABEL, LABEL_ATTRIBUTE_PATH, LABEL_DISTANCE, LABELGRAPHICS, LABELOFFSET, LEFT, LINEMODE, LINETYPE, LINEWIDTH_PATH, LOCALALIGN, MAXIMIZE, NAME, NEARSOURCE, NEARTARGET, OPAC, OUT, OUTLINE_PATH, POLYCLOSED_CLASSNAME, POLYLINE, POLYLINE_CLASSNAME, PORT, PORTS, PORTS_PATH, POSITION, RECTANGLE_CLASSNAME, RED, REF, RELALIGN, RELHOR, RELVERT, RIGHT, ROUNDING, SHADOWCOLOR, SHADOWOFFSET, SHAPE, SHAPE_DESC_PATH, SHAPE_PATH, SHAPEDESCRIPTION, SMOOTH_CLASSNAME, SMOOTHLINE, SOURCE, SQUARESPLINE, SQUARESPLINE_CLASSNAME, STRAIGHTLINE, STRAIGHTLINE_CLASSNAME, TARGET, TEXTCOLOR, THICKNESS, TILED, WIDTH, X, Y
-
Constructor Summary
Constructors Constructor Description LabelAttribute()
LabelAttribute(String id)
Constructor for Label.LabelAttribute(String id, String l)
Constructor for Label. -
Method Summary
Modifier and Type Method Description void
add(Attribute a)
Adds a given attribute to the collection.void
add(Attribute a, boolean inform)
Adds a given attribute to the collection.String
getAlignment()
String
getAlignmentText()
String
getFontName()
int
getFontSize()
String
getFontStyle()
int
getFontStyleJava()
String
getLabel()
Returns the 'label'-value of the encapsulated label.LabelFrameSetting
getLabelFrameSetting()
Vector2d
getLabelOffset()
Get the relative offset of label position from center of a node.int
getLastComponentHeight()
int
getLastComponentWidth()
int
getShadowOffX()
int
getShadowOffY()
Color
getShadowTextColor()
Color
getTextcolor()
Returns the 'textcolor'-value of the encapsulated label.boolean
getUseDropShadow()
void
setAlignment(String a)
void
setFontName(String f)
void
setFontSize(int fs)
void
setFontStyle(String fs)
void
setLabel(String l)
Sets the 'label'-value.void
setLabelOffset(double offsetX, double offsetY)
Set the relative offset of label position from center of a node.void
setLastComponentHeight(int height)
void
setLastComponentWidth(int width)
void
setLastLabel(JLabel lastLabel)
void
setTextcolor(Color c)
void
setTextcolor(String tc)
Set the 'textcolor'-value.void
wordWrap()
Methods inherited from class org.graffiti.attributes.HashMapAttribute
compareTo, copy, getCollection, setCollection, setDefaultValue, size
Methods inherited from class org.graffiti.attributes.AbstractCollectionAttribute
getAttributable, getAttribute, getValue, isEmpty, remove, remove, setAttributable, toString, toXMLString
Methods inherited from class org.graffiti.attributes.AbstractAttribute
addEdgeAttributeType, addNodeAttributeType, getDescription, getIcon, getId, getName, getParent, getPath, getTypedAttribute, isDeleted, isTypedAttributeFromID, setDeleted, setDescription, setId, setParent, setValue, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.graffiti.attributes.Attribute
getAttributable, getId, getParent, getPath, getValue, isDeleted, setDeleted, setId, setParent, setValue, toString
Methods inherited from interface org.graffiti.attributes.CollectionAttribute
getAttribute, isEmpty, remove, remove, setAttributable
Methods inherited from interface org.graffiti.plugin.Displayable
getDescription, getIcon, getName, setDescription, toXMLString
-
Constructor Details
-
LabelAttribute
public LabelAttribute() -
LabelAttribute
Constructor for Label.- Parameters:
id
- the id of the attribute.
-
LabelAttribute
Constructor for Label.- Parameters:
id
- the id of the attribute.l
- the label-value of the attribute.
-
-
Method Details
-
setLastComponentHeight
public void setLastComponentHeight(int height) -
getLastComponentHeight
public int getLastComponentHeight() -
setLastComponentWidth
public void setLastComponentWidth(int width) -
getLastComponentWidth
public int getLastComponentWidth() -
setLastLabel
-
add
public void add(Attribute a, boolean inform) throws AttributeExistsException, FieldAlreadySetExceptionDescription copied from class:AbstractCollectionAttribute
Adds a given attribute to the collection. Only informs theListenerManager
about the addition wheninform
is set to true.- Specified by:
add
in interfaceCollectionAttribute
- Overrides:
add
in classAbstractCollectionAttribute
- Parameters:
a
- the new attribute to add to the list.inform
- when true,ListenerManager
gets informed otherwise not- Throws:
AttributeExistsException
- if there is already an attribute with the id of a.FieldAlreadySetException
- thrown if Attribute a already has a parent or attributable associated with it.
-
add
Description copied from class:AbstractCollectionAttribute
Adds a given attribute to the collection. Informs theListenerManager
about the addition.- Specified by:
add
in interfaceCollectionAttribute
- Overrides:
add
in classAbstractCollectionAttribute
- Parameters:
a
- the new attribute to add to the list.- Throws:
AttributeExistsException
- if there is already an attribute with the id of a.FieldAlreadySetException
- thrown if Attribute a already has a parent or attributable associated with it.
-
setAlignment
-
getAlignment
-
getAlignmentText
-
setFontName
-
getFontName
-
setFontStyle
-
getFontStyle
-
getFontStyleJava
public int getFontStyleJava() -
setFontSize
public void setFontSize(int fs) -
getFontSize
public int getFontSize() -
setLabel
Sets the 'label'-value.- Parameters:
l
- the 'label'-value to be set.
-
getLabel
Returns the 'label'-value of the encapsulated label.- Returns:
- the 'label'-value of the encapsulated label.
-
setTextcolor
Set the 'textcolor'-value.- Parameters:
tc
- the 'textcolor'-value to be set.
-
setTextcolor
-
getTextcolor
Returns the 'textcolor'-value of the encapsulated label.- Returns:
- the 'textcolor'-value of the encapsulated label.
-
getUseDropShadow
public boolean getUseDropShadow() -
getLabelFrameSetting
-
getShadowOffX
public int getShadowOffX() -
getShadowOffY
public int getShadowOffY() -
getShadowTextColor
-
wordWrap
public void wordWrap() -
getLabelOffset
Get the relative offset of label position from center of a node. Offset is relative to node width/height; (0, 0) center of node, (-1, -1) top-left corner of node, (1, -1) top-right corner of node, (1, 1) bottom-right corner of node, (-1, 1) bottom-left corner of node.- Returns:
- relative offset of label position from center of a node
-
setLabelOffset
public void setLabelOffset(double offsetX, double offsetY)Set the relative offset of label position from center of a node. Offset is relative to node width/height; (0, 0) center of node, (-1, -1) top-left corner of node, (1, -1) top-right corner of node, (1, 1) bottom-right corner of node, (-1, 1) bottom-left corner of node.- Parameters:
offsetX
- horizontal offset of label position from center of a nodeoffsetY
- vertical offset of label position from center of a node
-