|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgraph.graph.GraphConstants
public class GraphConstants
A collection of well known or common attribute keys and methods to apply to an Map to get/set the properties in a typesafe manner. The following attributes and methods need special attention: removeAttributes, removeAll and value. RemoveAttributes and RemoveAll are not stored in a map, but remove the specified entries. The value entry of a propertyMap is always in sync with the userObject of a GraphCell. The isMoveable, isAutoSize and isSizeable are used indepedently (see http://sourceforge.net/forum/forum.php?thread_id=770111&forum_id=140880)
Field Summary | |
---|---|
static String |
ABSOLUTE
Key for the absolute attribute. |
static int |
ARROW_CIRCLE
Represents a circle decoration |
static int |
ARROW_CLASSIC
Represents a classic arrow decoration |
static int |
ARROW_DIAMOND
Represents a diamond decoration |
static int |
ARROW_DOUBLELINE
Represents a double line decoration |
static int |
ARROW_LINE
Represents a line decoration |
static int |
ARROW_NONE
Represents no decoration |
static int |
ARROW_SIMPLE
Represents a simple arrow decoration |
static int |
ARROW_TECHNICAL
Represents a technical arrow decoration |
static String |
AUTOSIZE
Key for the sizeable attribute. |
static String[] |
availableKeys
|
static String |
BACKGROUND
Key for the background attribute. |
static String |
BEGINFILL
Key for the startsize attribute. |
static String |
BEGINSIZE
Key for the startsize attribute. |
static String |
BENDABLE
Key for the sizeable attribute. |
static String |
BORDER
Key for the border attribute. |
static String |
BORDERCOLOR
Key for the bordercolor attribute. |
static String |
BOUNDS
Key for the bounds attribute. |
static String |
CONNECTABLE
Key for the moveable attribute. |
protected static float[] |
dash
Global Stroke To Highlight Selection |
static String |
DASHPATTERN
Key for the dashPattern attribute. |
static int |
DEFAULTDECORATIONSIZE
Default decoration size. |
static Font |
defaultFont
|
static float |
DEFAULTFONTSIZE
Default Font size. |
static int |
DEFAULTFONTSTYLE
Default Font style. |
static String |
DISCONNECTABLE
Key for the moveable attribute. |
static Point |
dummyPoint
|
static String |
EDITABLE
Key for the editable attribute. |
static String |
ENDFILL
Key for the endsize attribute. |
static String |
ENDSIZE
Key for the endsize attribute. |
static String |
FONT
Key for the font attribute. |
static String |
FOREGROUND
Key for the foreground attribute. |
static String |
HORIZONTAL_ALIGNMENT
Key for the horizontalAlignment attribute. |
static String |
HORIZONTAL_TEXT_POSITION
Key for the horizontalTextPosition attribute. |
static String |
ICON
Key for the icon attribute. |
static String |
LABELPOSITION
Key for the labelposition attribute. |
static String |
LINEBEGIN
Key for the start attribute. |
static String |
LINECOLOR
Key for the linecolor attribute. |
static String |
LINEEND
Key for the start attribute. |
static String |
LINESTYLE
Key for the lineStyle attribute. |
static String |
LINEWIDTH
Key for the linewidth attribute. |
static String |
MOVEABLE
Key for the moveable attribute. |
static String |
OFFSET
Key for the translate attribute. |
static String |
OPAQUE
Key for the opaque attribute. |
static int |
PERCENT
100 percent unit for relative positioning. |
static String |
POINTS
Key for the points attribute. |
static String |
REMOVEALL
Key for the removeAll attribute. |
static String |
REMOVEATTRIBUTES
Key for the removeAttributes attribute. |
static String |
REPLACEATTRIBUTES
Key for the replaceAttributes attribute. |
static String |
ROUTING
Key for the routing attribute. |
static Edge.Routing |
ROUTING_SIMPLE
A simple default Routing. |
static Stroke |
SELECTION_STROKE
|
static String |
SIZE
Key for the resize attribute. |
static String |
SIZEABLE
Key for the sizeable attribute. |
static int |
STYLE_BEZIER
Represents an bezier line style |
static int |
STYLE_ORTHOGONAL
Represents an orthogonal line style |
static int |
STYLE_QUADRATIC
Represents an quadratic line style |
static String |
VALUE
Key for the value attribute. |
static String |
VERTICAL_ALIGNMENT
Key for the verticalAlignment attribute. |
static String |
VERTICAL_TEXT_POSITION
Key for the verticalTextPosition attribute. |
Constructor Summary | |
---|---|
GraphConstants()
|
Method Summary | |
---|---|
static Map |
applyMap(Map change,
Map target)
Apply the change to the target . |
static Map |
cloneMap(Map map)
Returns a clone of map , from keys to values. |
static List |
clonePoints(List points)
Returns a list where all instances of PortView are replaced by their correspnding Point instance. |
static Map |
createAttributes(Object[] elements,
CellMapper cm)
Returns a new map, from cells to property maps. |
static Map |
createAttributes(Object[] cells,
Object[] keys,
Object[] values)
Returns a new (nested) map, from cells to attribute maps. |
static Map |
createAttributes(Object[] cells,
Object key,
Object value)
|
static Map |
createAttributes(Object cell,
Object key,
Object value)
|
static Map |
createAttributesFromModel(Object[] elements,
GraphModel model)
|
static Map |
createMap()
Creates an empty map. |
static Color |
getBackground(Map map)
Returns the value attribute from the specified map. |
static int |
getBeginSize(Map map)
Returns the opaque attribute from the specified map. |
static Border |
getBorder(Map map)
Returns the value attribute from the specified map. |
static Color |
getBorderColor(Map map)
Returns the value attribute from the specified map. |
static Rectangle |
getBounds(Map map)
Returns the bounds attribute from the specified map. |
static float[] |
getDashPattern(Map map)
Returns the value attribute from the specified map. |
static int |
getEndSize(Map map)
Returns the opaque attribute from the specified map. |
static Font |
getFont(Map map)
Returns the font for the specified attribute map. |
static Color |
getForeground(Map map)
Returns the value attribute from the specified map. |
static int |
getHorizontalAlignment(Map map)
Returns the opaque attribute from the specified map. |
static int |
getHorizontalTextPosition(Map map)
Returns the opaque attribute from the specified map. |
static Icon |
getIcon(Map map)
Returns the value attribute from the specified map. |
static Point |
getLabelPosition(Map map)
Returns the label position attribute from the specified map. |
static int |
getLineBegin(Map map)
Returns the opaque attribute from the specified map. |
static Color |
getLineColor(Map map)
Returns the value attribute from the specified map. |
static int |
getLineEnd(Map map)
Returns the opaque attribute from the specified map. |
static int |
getLineStyle(Map map)
Returns the opaque attribute from the specified map. |
static float |
getLineWidth(Map map)
Returns the opaque attribute from the specified map. |
static Point |
getOffset(Map map)
Returns the offset attribute from the specified map. |
static List |
getPoints(Map map)
Returns the points attribute from the specified map. |
static Object[] |
getRemoveAttributes(Map map)
Returns the value attribute from the specified map. |
static Edge.Routing |
getRouting(Map map)
Returns the routing attribute from the specified map. |
static Dimension |
getSize(Map map)
Returns the size attribute from the specified map. |
static Object |
getValue(Map map)
Returns the value attribute from the specified map. |
static int |
getVerticalAlignment(Map map)
Returns the opaque attribute from the specified map. |
static int |
getVerticalTextPosition(Map map)
Returns the opaque attribute from the specified map. |
static boolean |
isAbsolute(Map map)
Returns the offset attribute from the specified map. |
static boolean |
isAutoSize(Map map)
Returns the autosize attribute from the specified map. |
static boolean |
isBeginFill(Map map)
Returns the offset attribute from the specified map. |
static boolean |
isBendable(Map map)
Returns the bendable attribute from the specified map. |
static boolean |
isConnectable(Map map)
Returns the connectable attribute from the specified map. |
static boolean |
isDisconnectable(Map map)
Returns the disconnectable attribute from the specified map. |
static boolean |
isEditable(Map map)
Returns the editable attribute from the specified map. |
static boolean |
isEndFill(Map map)
Returns the offset attribute from the specified map. |
static boolean |
isMoveable(Map map)
Returns the moveable attribute from the specified map. |
static boolean |
isOpaque(Map map)
Returns the opaque attribute from the specified map. |
static boolean |
isRemoveAll(Map map)
Returns the offset attribute from the specified map. |
static boolean |
isSizeable(Map map)
Returns the sizeable attribute from the specified map. |
static Map |
replaceKeys(Map keyMap,
Map map)
Replace the keys in map using keyMap
|
static void |
scale(Map map,
double sx,
double sy,
Point origin)
Scales map by the given amount. |
static void |
setAbsolute(Map map,
boolean flag)
Sets the offset attribute in the specified map to the specified value. |
static void |
setAutoSize(Map map,
boolean flag)
Sets the autosize attribute in the specified map to the specified value. |
static void |
setBackground(Map map,
Color value)
Sets the value attribute in the specified map to the specified value. |
static void |
setBeginFill(Map map,
boolean flag)
Sets the offset attribute in the specified map to the specified value. |
static void |
setBeginSize(Map map,
int style)
Sets the opaque attribute in the specified map to the specified value. |
static void |
setBendable(Map map,
boolean flag)
Sets the bendable attribute in the specified map to the specified value. |
static void |
setBorder(Map map,
Border value)
Sets the value attribute in the specified map to the specified value. |
static void |
setBorderColor(Map map,
Color value)
Sets the value attribute in the specified map to the specified value. |
static void |
setBounds(Map map,
Rectangle bounds)
Sets the bounds attribute in the specified map to the specified value. |
static void |
setConnectable(Map map,
boolean flag)
Sets the connectable attribute in the specified map to the specified value. |
static void |
setDashPattern(Map map,
float[] value)
Sets the value attribute in the specified map to the specified value. |
static void |
setDisconnectable(Map map,
boolean flag)
Sets the disconnectable attribute in the specified map to the specified value. |
static void |
setEditable(Map map,
boolean flag)
Sets the editable attribute in the specified map to the specified value. |
static void |
setEndFill(Map map,
boolean flag)
Sets the offset attribute in the specified map to the specified value. |
static void |
setEndSize(Map map,
int style)
Sets the opaque attribute in the specified map to the specified value. |
static void |
setFont(Map map,
Font font)
Sets the value attribute in the specified map to the specified font value. |
static void |
setForeground(Map map,
Color value)
Sets the value attribute in the specified map to the specified value. |
static void |
setHorizontalAlignment(Map map,
int width)
Sets the opaque attribute in the specified map to the specified value. |
static void |
setHorizontalTextPosition(Map map,
int width)
Sets the opaque attribute in the specified map to the specified value. |
static void |
setIcon(Map map,
Icon value)
Sets the value attribute in the specified map to the specified value. |
static void |
setLabelPosition(Map map,
Point position)
Sets the label position attribute in the specified map to the specified value. |
static void |
setLineBegin(Map map,
int style)
Sets the opaque attribute in the specified map to the specified value. |
static void |
setLineColor(Map map,
Color value)
Sets the value attribute in the specified map to the specified value. |
static void |
setLineEnd(Map map,
int style)
Sets the opaque attribute in the specified map to the specified value. |
static void |
setLineStyle(Map map,
int style)
Sets the opaque attribute in the specified map to the specified value. |
static void |
setLineWidth(Map map,
float width)
Sets the opaque attribute in the specified map to the specified value. |
static void |
setMoveable(Map map,
boolean flag)
Sets the moveable attribute in the specified map to the specified value. |
static void |
setOffset(Map map,
Point offset)
Sets the offset attribute in the specified map to the specified value. |
static void |
setOpaque(Map map,
boolean flag)
Sets the opaque attribute in the specified map to the specified value. |
static void |
setPoints(Map map,
List list)
Sets the points attribute in the specified map to the specified value. |
static void |
setRemoveAll(Map map,
boolean flag)
Sets the offset attribute in the specified map to the specified value. |
static void |
setRemoveAttributes(Map map,
Object[] value)
Sets the value attribute in the specified map to the specified value. |
static void |
setRouting(Map map,
Edge.Routing routing)
Sets the routing attribute in the specified map to the specified value. |
static void |
setSize(Map map,
Dimension size)
Sets the size attribute in the specified map to the specified value. |
static void |
setSizeable(Map map,
boolean flag)
Sets the sizeable attribute in the specified map to the specified value. |
static void |
setValue(Map map,
Object value)
Sets the value attribute in the specified map to the specified value. |
static void |
setVerticalAlignment(Map map,
int width)
Sets the opaque attribute in the specified map to the specified value. |
static void |
setVerticalTextPosition(Map map,
int width)
Sets the opaque attribute in the specified map to the specified value. |
static void |
translate(Collection c,
int dx,
int dy)
Translates the maps in c using
translate(Map, int, int) . |
static void |
translate(Map map,
int dx,
int dy)
Translates map by the given amount. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Point dummyPoint
public static final Font defaultFont
public static String[] availableKeys
public static final float DEFAULTFONTSIZE
public static final int DEFAULTFONTSTYLE
public static final int DEFAULTDECORATIONSIZE
public static final int PERCENT
protected static float[] dash
public static Stroke SELECTION_STROKE
public static final int ARROW_NONE
public static final int ARROW_CLASSIC
public static final int ARROW_TECHNICAL
public static final int ARROW_SIMPLE
public static final int ARROW_CIRCLE
public static final int ARROW_LINE
public static final int ARROW_DOUBLELINE
public static final int ARROW_DIAMOND
public static final int STYLE_ORTHOGONAL
public static final int STYLE_QUADRATIC
public static final int STYLE_BEZIER
public static final Edge.Routing ROUTING_SIMPLE
public static final String REPLACEATTRIBUTES
replaceAttributes
attribute. This special
attribute contains a Boolean instance indicating whether a map of
attributes should replace the attributes of the receiving view.
public static final String REMOVEATTRIBUTES
removeAttributes
attribute. This special
attribute contains a list of attribute-keys which should be removed
at the receiving views.
public static final String REMOVEALL
removeAll
attribute. This causes the
receivers attributes to be replaced by the the map that contains
this attribute.
public static final String ICON
icon
attribute. Use instances of
Icon as values for this key.
public static final String FONT
font
attribute. Use instances of
Font as values for this key.
public static final String OPAQUE
opaque
attribute. Use instances of
Boolean as values for this key.
public static final String BORDER
border
attribute. Use instances of
Border as values for this key. Optionally, you can set the global
instance of LineBorder.
public static final String LINECOLOR
linecolor
attribute. Use instances of
Color as values for this key.
public static final String BORDERCOLOR
bordercolor
attribute. Use instances of
Color as values for this key.
public static final String LINEWIDTH
linewidth
attribute. Use instances of
Float as values for this key.
public static final String FOREGROUND
foreground
attribute. Use instances of
Color as values for this key.
public static final String BACKGROUND
background
attribute. Use instances of
Color as values for this key.
public static final String VERTICAL_ALIGNMENT
verticalAlignment
attribute. Use instances of
Integer as values for this key. Constants defined in JLabel class.
public static final String HORIZONTAL_ALIGNMENT
horizontalAlignment
attribute. Use instances of
Integer as values for this key. Constants defined in JLabel class.
public static final String VERTICAL_TEXT_POSITION
verticalTextPosition
attribute. Use instances of
Integer as values for this key. Constants defined in JLabel class.
public static final String HORIZONTAL_TEXT_POSITION
horizontalTextPosition
attribute. Use instances of
Integer as values for this key. Constants defined in JLabel class.
public static final String DASHPATTERN
dashPattern
attribute. Use instances of
float[] as values for this key.
public static final String LINESTYLE
lineStyle
attribute. Use instances of
Integer as values for this key. Constants defined in this class.
public static final String LINEBEGIN
start
attribute. Use instances of
Integer as values for this key. Constants defined in this class.
public static final String LINEEND
start
attribute. Use instances of
Integer as values for this key. Constants defined in this class.
public static final String BEGINSIZE
startsize
attribute. Use instances of
Integer as values for this key.
public static final String ENDSIZE
endsize
attribute. Use instances of
Integer as values for this key.
public static final String BEGINFILL
startsize
attribute. Use instances of
Integer as values for this key.
public static final String ENDFILL
endsize
attribute. Use instances of
Integer as values for this key.
public static final String VALUE
value
attribute. You can use any Object
as a value for this key.
public static final String EDITABLE
editable
attribute. Use instances of
Boolean as values for this key.
public static final String MOVEABLE
moveable
attribute. Use instances of
Boolean as values for this key.
public static final String SIZEABLE
sizeable
attribute. Use instances of
Boolean as values for this key.
public static final String AUTOSIZE
sizeable
attribute. Use instances of
Boolean as values for this key.
public static final String BENDABLE
sizeable
attribute. Use instances of
Boolean as values for this key.
public static final String CONNECTABLE
moveable
attribute. Use instances of
Boolean as values for this key.
public static final String DISCONNECTABLE
moveable
attribute. Use instances of
Boolean as values for this key.
public static final String BOUNDS
bounds
attribute. Use instances of
Rectangle as values for this key.
public static final String POINTS
points
attribute. Use instances of List
as values for this key. The list should contain Point instances.
public static final String ROUTING
routing
attribute. Use instances of EdgeView.EdgeRouter
as values for this key. The list should contain Point instances.
public static final String LABELPOSITION
labelposition
attribute. Use instances of
Point as values for this key.
public static final String ABSOLUTE
absolute
attribute. Use instances of
Boolean as values for this key.
public static final String OFFSET
translate
attribute. Use instances of
Point as values for this key.
public static final String SIZE
resize
attribute. Use instances of
Dimension as values for this key.
Constructor Detail |
---|
public GraphConstants()
Method Detail |
---|
public static Map createAttributes(Object cell, Object key, Object value)
public static Map createAttributes(Object[] cells, Object key, Object value)
public static Map createAttributes(Object[] cells, Object[] keys, Object[] values)
keys
and values
parameters must match in size.
public static Map createAttributes(Object[] elements, CellMapper cm)
elements
may be instances of CellView
, in which case the cell view's
corresponding cell is used as a key, and its attributes are used as
a property map. In any other case, the element
is considered
as a cell and looked-up in the cell mapper to find the corresponding
view. If a view is found, its attributes are cloned and used as a
property map, along with the cell as a key.Note: This method returns a map of maps! This is different from the createMap method, which creates a map, from keys to values. This method returns a map, from cells to maps, which in turn map from keys to values.
public static Map createAttributesFromModel(Object[] elements, GraphModel model)
public static Map createMap()
Hashtable
.
public static Map replaceKeys(Map keyMap, Map map)
map
using keyMap
map must itself
be a map, and is cloned using cloneMap
.
public static Map cloneMap(Map map)
map
, from keys to values. If the map
contains bounds or points, these are cloned as well. References to
PortViews
are replaces by points.
public static List clonePoints(List points)
public static void translate(Collection c, int dx, int dy)
c
using
translate(Map, int, int)
.
public static void translate(Map map, int dx, int dy)
map
by the given amount.
public static void scale(Map map, double sx, double sy, Point origin)
map
by the given amount.
public static void setFont(Map map, Font font)
map
- The map to store the font attribute in.font
- The value to set the font attribute to.public static Font getFont(Map map)
public static final void setRemoveAttributes(Map map, Object[] value)
public static final Object[] getRemoveAttributes(Map map)
public static Map applyMap(Map change, Map target)
change
to the target
.
change
must be a Map
previously
obtained from this object.
Returns a map that may be used to undo the change to target.
public static final void setIcon(Map map, Icon value)
public static final Icon getIcon(Map map)
public static final void setOpaque(Map map, boolean flag)
public static final boolean isOpaque(Map map)
public static final void setBorder(Map map, Border value)
public static final Border getBorder(Map map)
public static final void setLineColor(Map map, Color value)
public static final Color getLineColor(Map map)
public static final void setBorderColor(Map map, Color value)
public static final Color getBorderColor(Map map)
public static final void setLineWidth(Map map, float width)
public static final float getLineWidth(Map map)
public static final void setForeground(Map map, Color value)
public static final Color getForeground(Map map)
public static final void setBackground(Map map, Color value)
public static final Color getBackground(Map map)
public static final void setVerticalAlignment(Map map, int width)
public static final int getVerticalAlignment(Map map)
public static final void setHorizontalAlignment(Map map, int width)
public static final int getHorizontalAlignment(Map map)
public static final void setVerticalTextPosition(Map map, int width)
public static final int getVerticalTextPosition(Map map)
public static final void setHorizontalTextPosition(Map map, int width)
public static final int getHorizontalTextPosition(Map map)
public static final void setDashPattern(Map map, float[] value)
public static final float[] getDashPattern(Map map)
public static final void setLineStyle(Map map, int style)
public static final int getLineStyle(Map map)
public static final void setBeginSize(Map map, int style)
public static final int getBeginSize(Map map)
public static final void setEndSize(Map map, int style)
public static final int getEndSize(Map map)
public static final void setLineBegin(Map map, int style)
public static final int getLineBegin(Map map)
public static final void setLineEnd(Map map, int style)
public static final int getLineEnd(Map map)
public static final void setValue(Map map, Object value)
public static final Object getValue(Map map)
public static final void setLabelPosition(Map map, Point position)
public static final Point getLabelPosition(Map map)
public static final void setEditable(Map map, boolean flag)
public static final boolean isEditable(Map map)
public static final void setMoveable(Map map, boolean flag)
public static final boolean isMoveable(Map map)
public static final void setSizeable(Map map, boolean flag)
public static final boolean isSizeable(Map map)
public static final void setAutoSize(Map map, boolean flag)
public static final boolean isAutoSize(Map map)
public static final void setBendable(Map map, boolean flag)
public static final boolean isBendable(Map map)
public static final void setConnectable(Map map, boolean flag)
public static final boolean isConnectable(Map map)
public static final void setDisconnectable(Map map, boolean flag)
public static final boolean isDisconnectable(Map map)
public static final void setPoints(Map map, List list)
public static final List getPoints(Map map)
public static final void setRouting(Map map, Edge.Routing routing)
public static final Edge.Routing getRouting(Map map)
public static final void setBounds(Map map, Rectangle bounds)
public static final Rectangle getBounds(Map map)
public static final void setSize(Map map, Dimension size)
public static final Dimension getSize(Map map)
public static final void setOffset(Map map, Point offset)
public static final Point getOffset(Map map)
public static final void setBeginFill(Map map, boolean flag)
public static final boolean isBeginFill(Map map)
public static final void setEndFill(Map map, boolean flag)
public static final boolean isEndFill(Map map)
public static final void setAbsolute(Map map, boolean flag)
public static final boolean isAbsolute(Map map)
public static final void setRemoveAll(Map map, boolean flag)
public static final boolean isRemoveAll(Map map)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |