att.grappa
Class Grappa
java.lang.Object
att.grappa.Grappa
- All Implemented Interfaces:
- GrappaConstants
public abstract class Grappa
- extends java.lang.Object
- implements GrappaConstants
This class sets default option variables and other set-up.
In addition, some convenience methods for exception display are
included and some lookup tables are initialized.
The Grappa package itself has two roles:
- building, maintaining and manipulating graph structure, and
- drawing a positioned graph.
Grappa itself does not have any methods for graph positioning.
Grappa simply draws the nodes and edges based on the value of the
element's pos attribute, though it will treat an unpositioned
edge as a straight line between the center points of its attached nodes.
Some graph layout references are:
- "An Algorithm for Drawing General Undirected Graphs",
Tomihisa Kamada and Satoru Kawai,
Information Processing Letters, Vol. 31 (1989), pp. 7 - 15
- "Graph Drawing by Force-directed Placement",
Thomas M. J. Fruchterman and Edward M. Reingold,
Software - Practice and Experience, Vol. 21 No. 11 (1991), pp. 1129 - 1164
- "A Technique for Drawing Directed Graphs",
Emden R. Gansner, Eleftherios Koutsofios, Stephen C. North and
Kiem-Phong Vo,
IEEE Transactions on Software Engineering, Vol 19 No. 3 (1993), pp. 214 - 230
- "NicheWorks - Interactive Visualization of Very Large Graphs",
Graham J. Wills,
http://www.bell-labs.com:80/user/gwills/NICHEguide/nichepaper.html, circa 1997
Grappa does supply a utility, GrappaSupport.filterGraph(), for updating
a graph (including position information) from I/O streams such as might
be obtained from a java.net.URLConnection.
- Version:
- 1.2, 21 Aug 2005; Copyright 1996 - 2005 by AT&T Corp.
- Author:
- John Mocenigo, Research @ AT&T Labs
Field Summary |
static boolean |
antiAliasText
Indicates whether anti-aliasing should be used when drawing text. |
static boolean |
autoPositionNodeLabel
Indicates if the label position for node labels should automatically
be set to the center point of the node. |
static boolean |
backgroundDrawing
Indicates that background drawing, if any is provided via
a GrappaBacker implementation, should be displayed
or not. |
static boolean |
centerPointNodes
Indicates if element node position indicates the node center
point. |
static boolean |
doDisplayException
Boolean for enabling/disabling exception pop-up window display. |
static double |
edgeLabelsScaleCutoff
When the transform scale applied when drawing in a GrappaPanel is
less than this value, then edge labels are suppressed. |
static boolean |
elementPrintAllAttributes
Boolean to indicate if all element attributes should be printed. |
static boolean |
elementPrintDefaultAttributes
Boolean to indicate if the default attributes associated with
a subgraph should be printed. |
static int |
elementSelection
Indicates which classes of elements are suitable for selection
based on cursor position. |
static java.util.Vector |
emptyEnumeration
A convenience Vector useful when an enumeration is to be returned, but
the object to be enumerated is null (in which case, the return value can
be Grappa.emptyEnumeration.elements(), whose hasMoreElements() method
will return false). |
private static ExceptionDisplay |
exceptionDisplay
|
static java.util.Hashtable |
keyToShape
Look-up table that maps a shape name to its integer reference value. |
static boolean |
labelGraphBottom
Indicates that graph labels, when not explicitly positioned via
the lp attribute, should be placed at the bottom of the
graph instead of the top. |
static boolean |
labelGraphOutside
Indicates that graph labels, when not explicitly positioned via
the lp attribute, should be placed just outside the
graph bounding box instead of just inside. |
static boolean |
negateStringYCoord
Indicates whether the value of y-coordinates should be negated
when reading or writing y-coord information as string attributes. |
static double |
nodeLabelsScaleCutoff
When the transform scale applied when drawing in a GrappaPanel is
less than this value, then node labels are suppressed. |
static boolean |
orientationInDegrees
Indicates whether the orientation attribute is specifed
in degrees rather than radians. |
static boolean |
outlineSubgraphs
Cluster subgraphs will have their bounding box outlined. |
static boolean |
printVisibleOnly
Indicates whether only visible elements should be included
when printing a graph. |
static boolean |
provideBBoxAttribute
Indicates if the bb attribute of a subgraph should
automatically be set whenever the bounding box is calculated. |
static boolean |
rotationInDegrees
Indicates whether the rotation attribute is specifed
in degrees rather than radians. |
static boolean |
shapeBoundText
Indicates if element text should be included in the element
bounding box. |
static boolean |
shapeClearText
Indicates if the area bounding the element text should be
filled/outlined along with the element when being drawn. |
static boolean |
shapeDrawText
Indicates if element text should be drawn when drawing the
element. |
static java.util.Hashtable |
shapeToKey
Look-up table that maps a shape reference value to its name. |
static double |
subgLabelsScaleCutoff
When the transform scale applied when drawing in a GrappaPanel is
less than this value, then subgraph labels are suppressed. |
static boolean |
synchronizePaint
Indicates whether paints should be done within a synchronized
wrapper. |
static java.awt.Toolkit |
toolkit
The java.awt.Toolkit.getDefaultToolkit() value, if available |
private static java.lang.String |
toolTipText
|
static boolean |
useAntiAliasing
Indicates whether anti-aliasing should be used when drawing. |
static boolean |
useFractionalMetrics
Indicates whether fractional metrics should be used when drawing text. |
static boolean |
usePrintList
Indicates whether only the list of attributes found in the
PRINTLIST_ATTR should be printed. |
static boolean |
waitForImages
Indicates that an image requested via the IMAGE_ATTR of
an element should be loaded before the element is drawn. |
static int |
windingRule
Indicates what winding rule to use whenever a winding rule is
required. |
Fields inherited from interface att.grappa.GrappaConstants |
_NO_TYPE, ANONYMOUS_PREFIX, BBOX_ATTR, BBOX_HASH, BOX_SHAPE, BOX_TYPE, CLUSTERRANK_ATTR, COLOR_ATTR, COLOR_HASH, COLOR_TYPE, CUSTOM_ATTR, CUSTOM_HASH, CUSTOM_SHAPE, DELETION_MASK, DIAMOND_SHAPE, DIR_ATTR, DIR_HASH, DIR_TYPE, DISTORTION_ATTR, DISTORTION_HASH, DOUBLE_TYPE, DOUBLECIRCLE_SHAPE, DOUBLEOCTAGON_SHAPE, EDGE, EGG_SHAPE, FILLCOLOR_ATTR, FILLCOLOR_HASH, FONTCOLOR_ATTR, FONTCOLOR_HASH, FONTNAME_ATTR, FONTNAME_HASH, FONTSIZE_ATTR, FONTSIZE_HASH, FONTSTYLE_ATTR, FONTSTYLE_HASH, FONTSTYLE_TYPE, GRAPPA_BACKGROUND_COLOR_ATTR, GRAPPA_BACKGROUND_COLOR_HASH, GRAPPA_DELETION_STYLE_ATTR, GRAPPA_DELETION_STYLE_HASH, GRAPPA_FONTSIZE_ADJUSTMENT_ATTR, GRAPPA_FONTSIZE_ADJUSTMENT_HASH, GRAPPA_SELECTION_STYLE_ATTR, GRAPPA_SELECTION_STYLE_HASH, GRAPPA_SHAPE, HASHLIST_TYPE, HEADLABEL_ATTR, HEADLABEL_HASH, HEADLP_ATTR, HEADLP_HASH, HEIGHT_ATTR, HEIGHT_HASH, HEXAGON_SHAPE, HIGHLIGHT_MASK, HIGHLIGHT_OFF, HIGHLIGHT_ON, HIGHLIGHT_TOGGLE, HOUSE_SHAPE, IDENTXFRM, IMAGE_ATTR, IMAGE_HASH, INTEGER_TYPE, INVERTEDHOUSE_SHAPE, INVERTEDTRAPEZIUM_SHAPE, INVERTEDTRIANGLE_SHAPE, LABEL_ATTR, LABEL_HASH, LINE_SHAPE, LINE_TYPE, LOG10, LP_ATTR, LP_HASH, MARGIN_ATTR, MARGIN_HASH, MCIRCLE_SHAPE, MCLIMIT_ATTR, MCLIMIT_HASH, MDIAMOND_SHAPE, MINBOX_ATTR, MINBOX_HASH, MINLEN_ATTR, MINLEN_HASH, MINSIZE_ATTR, MINSIZE_HASH, MRECORD_SHAPE, MSQUARE_SHAPE, NBSP, NEW_LINE, NO_SHAPE, NODE, NODESEP_ATTR, NODESEP_HASH, OCTAGON_SHAPE, ORIENTATION_ATTR, ORIENTATION_HASH, OVAL_SHAPE, PACKAGE_PREFIX, PARALLELOGRAM_SHAPE, PATCH_ATTR, PATCH_HASH, PENTAGON_SHAPE, PERIPHERIES_ATTR, PERIPHERIES_HASH, PERIPHERY_GAP, PKG_LOWER, PKG_UPLOW, PKG_UPPER, PLAINTEXT_SHAPE, POINT_SHAPE, POINT_TYPE, PointsPerInch, POLYGON_SHAPE, POS_ATTR, POS_HASH, PRINTLIST_ATTR, PRINTLIST_HASH, RANKDIR_ATTR, RANKDIR_HASH, RANKSEP_ATTR, RANKSEP_HASH, RECORD_SHAPE, RECTS_ATTR, RECTS_HASH, ROTATION_ATTR, ROTATION_HASH, ROUNDEDBOX_SHAPE, SELECTION_MASK, SHAPE_ATTR, SHAPE_HASH, SHAPE_MASK, SHAPE_TYPE, SIDES_ATTR, SIDES_HASH, SIZE_ATTR, SIZE_HASH, SIZE_TYPE, SKEW_ATTR, SKEW_HASH, STRING_TYPE, STYLE_ATTR, STYLE_HASH, STYLE_TYPE, SUBGRAPH, SYSTEM, TAG_ATTR, TAG_HASH, TAILLABEL_ATTR, TAILLABEL_HASH, TAILLP_ATTR, TAILLP_HASH, TIP_ATTR, TIP_HASH, TRAPEZIUM_SHAPE, TRIANGLE_SHAPE, TRIPLEOCTAGON_SHAPE, TYPES_SHIFT, WEIGHT_ATTR, WEIGHT_HASH, WIDTH_ATTR, WIDTH_HASH |
Method Summary |
static void |
displayException(java.lang.Exception ex)
Method for displaying an exception in a pop-up window (if enabled). |
static void |
displayException(java.lang.Exception ex,
java.lang.String msg)
Method for displaying an exception in a pop-up window (if enabled). |
static java.lang.String |
getToolTipText()
Gets the current tool-tip text displayed when outside graph, but inside
the display panel. |
static java.lang.String |
setToolTipText(java.lang.String text)
Sets the tool-tip text displayed when outside graph, but inside
the display panel. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
keyToShape
public static java.util.Hashtable keyToShape
- Look-up table that maps a shape name to its integer reference value.
shapeToKey
public static java.util.Hashtable shapeToKey
- Look-up table that maps a shape reference value to its name.
toolkit
public static java.awt.Toolkit toolkit
- The java.awt.Toolkit.getDefaultToolkit() value, if available
exceptionDisplay
private static final ExceptionDisplay exceptionDisplay
doDisplayException
public static boolean doDisplayException
- Boolean for enabling/disabling exception pop-up window display.
emptyEnumeration
public static final java.util.Vector emptyEnumeration
- A convenience Vector useful when an enumeration is to be returned, but
the object to be enumerated is null (in which case, the return value can
be Grappa.emptyEnumeration.elements(), whose hasMoreElements() method
will return false).
toolTipText
private static java.lang.String toolTipText
elementPrintAllAttributes
public static boolean elementPrintAllAttributes
- Boolean to indicate if all element attributes should be printed.
By default, only the element specific attributes are printed and
attributes inherited from a parent element (subgraph) are skipped.
- See Also:
Subgraph.printSubgraph(java.io.PrintWriter)
,
Element.printAllAttributes
elementPrintDefaultAttributes
public static boolean elementPrintDefaultAttributes
- Boolean to indicate if the default attributes associated with
a subgraph should be printed.
By default, only those differing from the pre-defined defaults are
printed.
- See Also:
Subgraph.printSubgraph(java.io.PrintWriter)
,
Element.printDefaultAttributes
shapeBoundText
public static boolean shapeBoundText
- Indicates if element text should be included in the element
bounding box. By default, it is.
- See Also:
GrappaNexus.boundText
shapeClearText
public static boolean shapeClearText
- Indicates if the area bounding the element text should be
filled/outlined along with the element when being drawn.
By default, it is not.
- See Also:
GrappaNexus.clearText
shapeDrawText
public static boolean shapeDrawText
- Indicates if element text should be drawn when drawing the
element. By default, it is.
- See Also:
GrappaNexus.drawText
centerPointNodes
public static boolean centerPointNodes
- Indicates if element node position indicates the node center
point. Otherwise, the position is assumed to indicate the
upper-left corner of the nodes bounding box.
By default, the position indicates the node's center point.
autoPositionNodeLabel
public static boolean autoPositionNodeLabel
- Indicates if the label position for node labels should automatically
be set to the center point of the node. When true, positioning
information provided by the lp attribute is completely
ignored. By default, auto-positioning is used.
provideBBoxAttribute
public static boolean provideBBoxAttribute
- Indicates if the bb attribute of a subgraph should
automatically be set whenever the bounding box is calculated.
By default, the attribute is not set automatically.
windingRule
public static int windingRule
- Indicates what winding rule to use whenever a winding rule is
required. The default is the java.awt.geom.PathIterator
WIND_NON_ZERO rule.
orientationInDegrees
public static boolean orientationInDegrees
- Indicates whether the orientation attribute is specifed
in degrees rather than radians. Degrees is the default.
rotationInDegrees
public static boolean rotationInDegrees
- Indicates whether the rotation attribute is specifed
in degrees rather than radians. Degrees is the default.
usePrintList
public static boolean usePrintList
- Indicates whether only the list of attributes found in the
PRINTLIST_ATTR should be printed. See also printVisibleOnly.
The default is false.
printVisibleOnly
public static boolean printVisibleOnly
- Indicates whether only visible elements should be included
when printing a graph.
The default is false.
useAntiAliasing
public static boolean useAntiAliasing
- Indicates whether anti-aliasing should be used when drawing.
The default is true.
antiAliasText
public static boolean antiAliasText
- Indicates whether anti-aliasing should be used when drawing text.
The default is false.
useFractionalMetrics
public static boolean useFractionalMetrics
- Indicates whether fractional metrics should be used when drawing text.
The default is false.
negateStringYCoord
public static boolean negateStringYCoord
- Indicates whether the value of y-coordinates should be negated
when reading or writing y-coord information as string attributes.
Note: this indicator should be set to true when working
with string attributes generated by or to be read by the dot
graph layout program or to be compatible to earlier versions of Grappa.
The default is true.
labelGraphBottom
public static boolean labelGraphBottom
- Indicates that graph labels, when not explicitly positioned via
the lp attribute, should be placed at the bottom of the
graph instead of the top. The default is true, meaning the label
will be placed at the bottom of the graph.
labelGraphOutside
public static boolean labelGraphOutside
- Indicates that graph labels, when not explicitly positioned via
the lp attribute, should be placed just outside the
graph bounding box instead of just inside. The default is true,
meaning the label will be placed outside the bounding box.
backgroundDrawing
public static boolean backgroundDrawing
- Indicates that background drawing, if any is provided via
a GrappaBacker implementation, should be displayed
or not. The default of true means the background drawing should
be displayed, if provided.
nodeLabelsScaleCutoff
public static double nodeLabelsScaleCutoff
- When the transform scale applied when drawing in a GrappaPanel is
less than this value, then node labels are suppressed.
outlineSubgraphs
public static boolean outlineSubgraphs
- Cluster subgraphs will have their bounding box outlined. To
similarly outline all types of subgraphs (except the root subgraph),
set this value to true.
edgeLabelsScaleCutoff
public static double edgeLabelsScaleCutoff
- When the transform scale applied when drawing in a GrappaPanel is
less than this value, then edge labels are suppressed.
subgLabelsScaleCutoff
public static double subgLabelsScaleCutoff
- When the transform scale applied when drawing in a GrappaPanel is
less than this value, then subgraph labels are suppressed.
synchronizePaint
public static boolean synchronizePaint
- Indicates whether paints should be done within a synchronized
wrapper. When enable the Graph dropcloth method can be used to
prevent paints during certain critical operations.
- See Also:
Graph#dropcloth(boolan, boolean)
waitForImages
public static boolean waitForImages
- Indicates that an image requested via the IMAGE_ATTR of
an element should be loaded before the element is drawn.
By default, Grappa will wait.
- See Also:
GrappaNexus.drawImage(java.awt.Graphics2D)
elementSelection
public static int elementSelection
- Indicates which classes of elements are suitable for selection
based on cursor position. Value is the logical OR of NODE,
EDGE and SUBGRAPH. The default is SUBGRAPH|NODE|EDGE.
Grappa
public Grappa()
displayException
public static void displayException(java.lang.Exception ex)
- Method for displaying an exception in a pop-up window (if enabled).
- Parameters:
ex
- The exception value about which information is to be displayed.- See Also:
doDisplayException
,
DisplayException
displayException
public static void displayException(java.lang.Exception ex,
java.lang.String msg)
- Method for displaying an exception in a pop-up window (if enabled).
- Parameters:
ex
- The exception value about which information is to be displayed.msg
- Additional text to be displayed ahead of exception info.- See Also:
doDisplayException
,
DisplayException
setToolTipText
public static java.lang.String setToolTipText(java.lang.String text)
- Sets the tool-tip text displayed when outside graph, but inside
the display panel.
- Parameters:
text
- The new outside-the-graph tool-tip text to display.
- Returns:
- The former outside-the-graph tool-tip text.
getToolTipText
public static java.lang.String getToolTipText()
- Gets the current tool-tip text displayed when outside graph, but inside
the display panel.
- Returns:
- The current outside-the-graph tool-tip text.