Package org.graffiti.graphics
Class ColorAttribute
java.lang.Object
org.graffiti.attributes.AbstractAttribute
org.graffiti.attributes.AbstractCollectionAttribute
org.graffiti.attributes.HashMapAttribute
org.graffiti.graphics.ColorAttribute
- All Implemented Interfaces:
Comparable<Object>,Attribute,CollectionAttribute,ColorSetAndGetSupport,DeepCopy,GraphicAttributeConstants,Displayable
public class ColorAttribute extends HashMapAttribute implements GraphicAttributeConstants, ColorSetAndGetSupport
Contains the color graphic attribute. (The value of opacity has no effect
when applied to the outline of a node since that would lead to problems with
overlapping filling and outline.)
- Version:
- $Revision: 1.6 $
-
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 ColorAttribute(String id)Constructs a newColorAttribute.ColorAttribute(String id, int r, int g, int b, int t)Constructs a newColorAttributeand initialises with the given values.ColorAttribute(String id, Color c)Constructs a newColorAttribute.ColorAttribute(String id, ColorAttribute c)Constructs a newColorAttribute. -
Method Summary
Modifier and Type Method Description Objectcopy()Returns a deep copy of this object.intgetBlue()Returns the 'blue'-value of the encapsulated color.ColorgetColor()Comfort function to get a java.awt.Color.intgetGreen()Returns the 'green'-value of the encapsulated color.intgetOpacity()Returns the 'opacity'-value of the encapsulated color.intgetRed()Returns the 'red'-value of the encapsulated color.voidsetBlue(int b)Sets the 'blue'-value.voidsetCollection(Map<String,Attribute> attrs)Sets the collection of attributes contained within this CollectionAttribute.voidsetColor(Color c)Comfort function to set a java.awt.Color.voidsetGreen(int g)Sets the 'green'-value.voidsetOpacity(int t)Sets the 'opacity'-value.voidsetRed(int r)Sets the 'red'-value.Methods inherited from class org.graffiti.attributes.HashMapAttribute
compareTo, getCollection, setDefaultValue, sizeMethods inherited from class org.graffiti.attributes.AbstractCollectionAttribute
add, add, getAttributable, getAttribute, getValue, isEmpty, remove, remove, setAttributable, toString, toXMLStringMethods inherited from class org.graffiti.attributes.AbstractAttribute
addEdgeAttributeType, addNodeAttributeType, getDescription, getIcon, getId, getName, getParent, getPath, getTypedAttribute, isDeleted, isTypedAttributeFromID, setDeleted, setDescription, setId, setParent, setValue, toStringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.graffiti.attributes.Attribute
getAttributable, getId, getParent, getPath, getValue, isDeleted, setDeleted, setId, setParent, setValue, toStringMethods inherited from interface org.graffiti.attributes.CollectionAttribute
add, add, getAttribute, isEmpty, remove, remove, setAttributableMethods inherited from interface org.graffiti.plugin.Displayable
getDescription, getIcon, getName, setDescription, toXMLString
-
Constructor Details
-
ColorAttribute
Constructs a newColorAttribute.- Parameters:
id- the id of the attribute.c- the color-value of the attribute.
-
ColorAttribute
Constructs a newColorAttribute.- Parameters:
id- the id of the attribute.c- the color-value of the attribute.
-
ColorAttribute
Constructs a newColorAttribute.- Parameters:
id- the id of the attribute.
-
ColorAttribute
Constructs a newColorAttributeand initialises with the given values.- Parameters:
id- the id of the attribute.r- the red-value of the attribute.g- the green-value of the attribute.b- the blue-value of the attribute.t- the opacity-value of the attribute.
-
-
Method Details
-
setBlue
public void setBlue(int b)Sets the 'blue'-value.- Parameters:
b- the 'blue'-value to be set.
-
getBlue
public int getBlue()Returns the 'blue'-value of the encapsulated color.- Returns:
- the 'blue'-value of the encapsulated color.
-
setCollection
Sets the collection of attributes contained within this CollectionAttribute. The color values are set, additional values are simply added (that means that if there exists already a subattribute with the same id, an exception will be thrown).- Specified by:
setCollectionin interfaceCollectionAttribute- Overrides:
setCollectionin classHashMapAttribute- Parameters:
attrs- the map that contains all attributes.- Throws:
IllegalArgumentException- DOCUMENT ME!
-
setColor
Comfort function to set a java.awt.Color.- Specified by:
setColorin interfaceColorSetAndGetSupport- Parameters:
c- the java.awt.Color value.
-
getColor
Comfort function to get a java.awt.Color.- Specified by:
getColorin interfaceColorSetAndGetSupport- Returns:
- the built java.awt.Color object.
-
setGreen
public void setGreen(int g)Sets the 'green'-value.- Parameters:
g- the 'green'-value to be set.
-
getGreen
public int getGreen()Returns the 'green'-value of the encapsulated color.- Returns:
- the 'green'-value of the encapsulated color.
-
setOpacity
public void setOpacity(int t)Sets the 'opacity'-value.- Parameters:
t- the 'opacity'-value to be set.
-
getOpacity
public int getOpacity()Returns the 'opacity'-value of the encapsulated color.- Returns:
- the 'opacity'-value of the encapsulated color.
-
setRed
public void setRed(int r)Sets the 'red'-value.- Parameters:
r- the 'red'-value to be set.
-
getRed
public int getRed()Returns the 'red'-value of the encapsulated color.- Returns:
- the 'red'-value of the encapsulated color.
-
copy
Returns a deep copy of this object.- Specified by:
copyin interfaceDeepCopy- Overrides:
copyin classHashMapAttribute- Returns:
- A deep copy of this object.
-