att.grappa
Class Graph

java.lang.Object
  extended by att.grappa.Element
      extended by att.grappa.Subgraph
          extended by att.grappa.Graph
All Implemented Interfaces:
GrappaConstants, java.util.Comparator

public class Graph
extends Subgraph

This class is the root of the overall graph and provides methods for working with the entire graph (for example. printing the graph). It is an extension of the Subgraph class.

Version:
1.2, 21 Aug 2005; Copyright 1996 - 2005 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Nested Class Summary
 
Nested classes/interfaces inherited from class att.grappa.Subgraph
Subgraph.Enumerator
 
Field Summary
private  boolean busy
           
private  boolean directed
           
private  boolean editable
           
private  int eid
           
private  java.io.PrintWriter errWriter
           
(package private)  boolean filterMode
          used internally by Grappa
private  int gid
           
private  java.util.Hashtable<java.lang.String,Attribute> grattributes
           
(package private)  java.util.Hashtable<java.lang.Long,Element> id2element
           
private  java.lang.StringBuffer indent
           
static java.lang.String INDENT_STRING
          The string used for indentation when printing out the graph.
private  boolean menuable
           
private  int nid
           
private  boolean paintCalled
           
private  java.util.List<GrappaPanel> panelList
           
 java.awt.font.FontRenderContext REFCNTXT
          Reference FontRenderContext
private  boolean selectable
           
private  boolean strict
           
private  boolean synchronizePaint
           
private static java.util.Hashtable<java.lang.String,Attribute> sysdfltEdgeAttributes
           
private static java.util.Hashtable<java.lang.String,Attribute> sysdfltGraphAttributes
           
private static java.util.Hashtable<java.lang.String,Attribute> sysdfltNodeAttributes
           
private  java.lang.String toolTipText
           
 
Fields inherited from class att.grappa.Subgraph
currentSelection, defaultNamePrefix
 
Fields inherited from class att.grappa.Element
attributes, attrsOfInterest, canonName, counter, grappaNexus, highlight, linewidth, name, object, printAllAttributes, printDefaultAttributes, usePrintList, visastamp, visible
 
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
 
Constructor Summary
Graph(java.lang.String graphName)
          Creates a directed graph that is not strict A convenience method equivalent to Graph(graphName,true,false).
Graph(java.lang.String graphName, boolean directed, boolean strict)
          Creates a new, empty Graph object.
 
Method Summary
(package private)  Element addIdMapping(Element elem)
          Add id to element lookup table (used in setId method)
 void addPanel(GrappaPanel panel)
          Adds a panel to the list of GrappaPanels that are displaying this graph.
static int attributeType(java.lang.String attrname)
          Returns the attribute conversion type for the supplied attribute name.
 void buildShapes()
          Builds any GrappaNexus object not already built for elements in this graph.
 void decrementIndent()
          Decrease the indent string by removing one INDENT_STRING.
 boolean dropcloth(boolean block, boolean auto)
          Sets and unsets a flag in a synchronized manner so that during the period that the flag is set, painting will not occur.
(package private)  Element element4Id(java.lang.Long idKey)
          Get the element associated with an id key
 java.io.PrintWriter getErrorWriter()
          Get the current PrintWriter used for error messages.
static Attribute getGlobalAttribute(int type, java.lang.String key)
          Gets a graph default attribute.
static java.util.Enumeration getGlobalAttributeKeys(int type)
          Gets an enumeration of the specified graph default attribute keys
static java.util.Enumeration getGlobalAttributePairs(int type)
          Gets an enumeration of the specified graph default attributes
static int getGlobalAttributeSize(int type)
          Get a count of the graph default attributes of a particular type.
 Attribute getGrappaAttribute(java.lang.String key)
          Gets Grappa default attribute.
 java.util.Enumeration getGrappaAttributeKeys()
          Get an enumeration of the Grappa package attribute keys.
 java.lang.Object getGrappaAttributeValue(java.lang.String key)
          Gets Grappa default attribute value.
 int getId(int type)
          Get the next id number for the specified type, but do not increment the counter.
 java.lang.String getIndent()
          Get the current indent string.
 boolean getSynchronizePaint()
          Get the current paint synchronization indicator value.
 java.lang.String getToolTipText()
          Get the tooltip text displayed when outside the graph area.
(package private) static int idKeyId(java.lang.Long idKey)
          Get the type of the id key.
(package private) static int idKeyType(java.lang.Long idKey)
          Get the type of the id key.
(package private) static java.lang.Long idMapKey(int type, int id)
          Creates a id key given a type and id number.
 void incrementIndent()
          Increase the indent string by appending INDENT_STRING.
private  void initialize(java.lang.String graphName)
           
 boolean isDirected()
          Check if the graph is directed.
 boolean isEditable()
          Check if this graph is interactively editable (i.e., through mouse events).
 boolean isMenuable()
          Check if an element-specific menu is available interactively (i.e., through mouse events).
 boolean isSelectable()
          Check if graph elements are interactively selectable (i.e., through mouse events).
 boolean isStrict()
          Check if the graph is strict (i.e., no self-loops).
(package private)  int nextId(int type)
          Get the next id number for the specified type and increment the counter.
 void paintImmediately()
          Makes a paintImmediately request of all GrappaPanels that are displaying this graph.
 void printError(java.lang.String msg)
          Print the supplied message to the error output.
 void printError(java.lang.String msg, java.lang.Exception ex)
          Print the supplied message and exception information to the error output.
 void printGraph(java.io.OutputStream output)
          Output graph to specified OutputStream.
 void printGraph(java.io.Writer output)
          Output graph to specified Writer.
private static void putAttribute(java.util.Hashtable<java.lang.String,Attribute> table, int type, java.lang.String name, java.lang.String value)
           
(package private)  void removeIdMapping(Element elem)
          Remove id2element dictionary element
 void removePanel(GrappaPanel panel)
          Removes a panel to the list of GrappaPanels that are displaying this graph.
 void repaint()
          Makes a repaint request of all GrappaPanels that are displaying this graph.
 void reset()
          Reset this graph by removing all its elements and re-initiailizing its internal variables.
 void reset(java.lang.String graphName, boolean directed, boolean strict)
          Reset this graph by removing all its elements and re-initiailizing its internal variables and possibly changing its name, directedness and strictness.
 void resync()
          Builds any GrappaNexus object not already built and rebuilds those that already exist for all elements in this graph.
private  boolean setBlocked(boolean state, boolean isPaint, boolean repaint)
           
private  void setDirection(boolean directed)
           
 boolean setEditable(boolean mode)
          Set the editability of the graph.
 java.io.PrintWriter setErrorWriter(java.io.PrintWriter errWriter)
          Set the PrintWriter for error messages.
 java.lang.Object setGrappaAttribute(java.lang.String key, java.lang.String value)
          Sets a Grappa package attribute.
 boolean setMenuable(boolean mode)
          Set whether element-specific menus are to be available interactively.
(package private)  boolean setPaint(boolean paint)
           
 boolean setSelectable(boolean mode)
          Set the selectability of the graph.
 boolean setSynchronizePaint(boolean sync)
          Sets or unsets indication that paint requests should be done within a synchronized wrapper that prevents concurrent paints and any paints between calls to the dropcloth method.
 java.lang.String setToolTipText(java.lang.String text)
          Set the tooltip text displayed when outside the graph area.
static boolean validGrappaAttributeKey(java.lang.String key)
          Check if the given key has a format consistent with Grappa package attribute keys.
 
Methods inherited from class att.grappa.Subgraph
addEdge, addNode, addSubgraph, addTypeTag, aspect, clearPatchWork, compare, computePatchWork, countOfElements, countOfLocalElements, createElement, edgeElements, elements, elements, equals, findEdgeByName, findNodeByName, findSubgraphByName, getBoundingBox, getEdgeAttribute, getEdgeAttributeKeys, getEdgeAttributePairs, getEdgeAttributeValue, getNodeAttribute, getNodeAttributeKeys, getNodeAttributePairs, getNodeAttributeValue, getPatches, getShowEdgeLabels, getShowNodeLabels, getShowSubgraphLabels, getType, hasEmptySubgraphs, hasTypeTag, hasTypeTags, isCluster, isLR, isRoot, isSubgraph, nodeElements, patchWork, preparePatchWork, printSubgraph, recurseVectorOfElements, removeEdge, removeEmptySubgraphs, removeNode, removeSubgraph, removeTypeTag, removeTypeTags, resetBoundingBox, score, setAttribute, setAttribute, setEdgeAttribute, setEdgeAttribute, setName, setName, setNodeAttribute, setNodeAttribute, setShowEdgeLabels, setShowNodeLabels, setShowSubgraphLabels, subgraphElements, vectorOfElements
 
Methods inherited from class att.grappa.Element
addTag, attrNotOfInterest, attrOfInterest, bdfs, buildShape, canonString, canonValue, clearBBox, delete, deleteCalled, getAttribute, getAttributePairs, getAttributeValue, getDefaultAttribute, getDefaultAttribute, getGraph, getGrappaNexus, getId, getIdKey, getLocalAttribute, getLocalAttributeKeys, getLocalAttributePairs, getName, getPatch, getPatchSize, getSubgraph, getThisAttribute, getThisAttributeValue, hasAttributeForKey, hasDefaultTag, hasDefaultTags, hasLocalTag, hasLocalTags, hasTag, hasTags, isEdge, isNode, isOfInterest, listAttrsOfInterest, printElement, release, removeTag, removeTags, reserve, setDefaultAttribute, setDefaultAttribute, setDefaultAttribute, setDefaultAttribute, setDelete, setGraph, setIdKey, setPatch, setPatch, setPatchSize, setSubgraph, setUserAttributeType, toString, typeString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INDENT_STRING

public static final java.lang.String INDENT_STRING
The string used for indentation when printing out the graph.

See Also:
Constant Field Values

filterMode

boolean filterMode
used internally by Grappa


indent

private java.lang.StringBuffer indent

errWriter

private java.io.PrintWriter errWriter

paintCalled

private boolean paintCalled

busy

private boolean busy

synchronizePaint

private boolean synchronizePaint

toolTipText

private java.lang.String toolTipText

panelList

private java.util.List<GrappaPanel> panelList

gid

private int gid

nid

private int nid

eid

private int eid

editable

private boolean editable

menuable

private boolean menuable

selectable

private boolean selectable

directed

private boolean directed

strict

private boolean strict

id2element

java.util.Hashtable<java.lang.Long,Element> id2element

grattributes

private java.util.Hashtable<java.lang.String,Attribute> grattributes

sysdfltNodeAttributes

private static java.util.Hashtable<java.lang.String,Attribute> sysdfltNodeAttributes

sysdfltEdgeAttributes

private static java.util.Hashtable<java.lang.String,Attribute> sysdfltEdgeAttributes

sysdfltGraphAttributes

private static java.util.Hashtable<java.lang.String,Attribute> sysdfltGraphAttributes

REFCNTXT

public final java.awt.font.FontRenderContext REFCNTXT
Reference FontRenderContext

Constructor Detail

Graph

public Graph(java.lang.String graphName,
             boolean directed,
             boolean strict)
Creates a new, empty Graph object.

Parameters:
graphName - the name of this graph.
directed - use true if graph is to be a directed graph
strict - use true if graph is a strict graph

Graph

public Graph(java.lang.String graphName)
Creates a directed graph that is not strict A convenience method equivalent to Graph(graphName,true,false).

Parameters:
graphName - the name of this graph.
See Also:
Graph(java.lang.String, boolean, boolean)
Method Detail

putAttribute

private static void putAttribute(java.util.Hashtable<java.lang.String,Attribute> table,
                                 int type,
                                 java.lang.String name,
                                 java.lang.String value)

initialize

private void initialize(java.lang.String graphName)

setDirection

private void setDirection(boolean directed)

setSynchronizePaint

public boolean setSynchronizePaint(boolean sync)
Sets or unsets indication that paint requests should be done within a synchronized wrapper that prevents concurrent paints and any paints between calls to the dropcloth method.

Parameters:
sync - value to which indicator will be set
Returns:
the previous indicator value
See Also:
dropcloth(boolean, boolean)

getSynchronizePaint

public boolean getSynchronizePaint()
Get the current paint synchronization indicator value.

Returns:
the current paint synchronization indicator value
See Also:
setSynchronizePaint(boolean)

dropcloth

public boolean dropcloth(boolean block,
                         boolean auto)
Sets and unsets a flag in a synchronized manner so that during the period that the flag is set, painting will not occur.

Parameters:
block - value to which to set the indicator flag
auto - when block is false, setting this parameter true will request a repaint() if any paint requests arrived while the dropcloth was laid out.
Returns:
returns false only when block is true and a paint is pending or in progress.
See Also:
setSynchronizePaint(boolean)

setPaint

boolean setPaint(boolean paint)

setBlocked

private boolean setBlocked(boolean state,
                           boolean isPaint,
                           boolean repaint)

getGrappaAttribute

public Attribute getGrappaAttribute(java.lang.String key)
                             throws java.lang.IllegalArgumentException
Gets Grappa default attribute.

Parameters:
key - the search key for the corresponding attribute.
Returns:
the value of the matching Grappa default attribute or null.
Throws:
java.lang.IllegalArgumentException - whenever the key is null

getGrappaAttributeValue

public java.lang.Object getGrappaAttributeValue(java.lang.String key)
                                         throws java.lang.IllegalArgumentException
Gets Grappa default attribute value.

Parameters:
key - the search key for the corresponding attribute.
Returns:
the value portion of the matching Grappa default attribute or null.
Throws:
java.lang.IllegalArgumentException - whenever the key is null

setGrappaAttribute

public java.lang.Object setGrappaAttribute(java.lang.String key,
                                           java.lang.String value)
                                    throws java.lang.IllegalArgumentException
Sets a Grappa package attribute. A Grappa package attribute is one specific to Grappa (for example, a display color) rather than an attribute that relates to a graph.

Parameters:
key - the search key for the corresponding attribute.
Returns:
the previous value of the matching Grappa default attribute or null.
Throws:
java.lang.IllegalArgumentException - whenever the key is not prefixed by Grappa.PKG_LOWER
See Also:
GrappaConstants.PKG_LOWER

attributeType

public static int attributeType(java.lang.String attrname)
Returns the attribute conversion type for the supplied attribute name. Only graph global specific attribute name/type mappings are checked.

Parameters:
attrname - the attribute name
Returns:
the currently associated attribute type

getGrappaAttributeKeys

public java.util.Enumeration getGrappaAttributeKeys()
Get an enumeration of the Grappa package attribute keys.

Returns:
an Enumeration of Attribute objects

validGrappaAttributeKey

public static boolean validGrappaAttributeKey(java.lang.String key)
Check if the given key has a format consistent with Grappa package attribute keys. A Grappa package key starts with Grappa.PKG_LOWER.

Parameters:
key - the key to validate
Returns:
true if the supplied key could serve as a Grappa package attribute key.
See Also:
GrappaConstants.PKG_LOWER

getGlobalAttribute

public static Attribute getGlobalAttribute(int type,
                                           java.lang.String key)
                                    throws java.lang.IllegalArgumentException
Gets a graph default attribute. A graph default attribute determines basic graph characteristics initially (e.g., node shape).

Parameters:
type - indicates attribute type.
key - the search key for the corresponding attribute.
Returns:
the value of the matching graph default attribute or null.
Throws:
java.lang.IllegalArgumentException - whenever the specified type is not valid
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

getGlobalAttributeKeys

public static java.util.Enumeration getGlobalAttributeKeys(int type)
                                                    throws java.lang.IllegalArgumentException
Gets an enumeration of the specified graph default attribute keys

Parameters:
type - indicates attribute type.
Returns:
an Enumeration of String objects
Throws:
java.lang.IllegalArgumentException - whenever the specified type is not valid
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

getGlobalAttributePairs

public static java.util.Enumeration getGlobalAttributePairs(int type)
                                                     throws java.lang.IllegalArgumentException
Gets an enumeration of the specified graph default attributes

Parameters:
type - indicates attribute type.
Returns:
an Enumeration of Attribute objects
Throws:
java.lang.IllegalArgumentException - whenever the specified type is not valid
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

getGlobalAttributeSize

public static int getGlobalAttributeSize(int type)
                                  throws java.lang.IllegalArgumentException
Get a count of the graph default attributes of a particular type.

Parameters:
type - indicates attribute type.
Returns:
a count of the specified graph default attributes
Throws:
java.lang.IllegalArgumentException - whenever the specified type is not valid
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

addIdMapping

Element addIdMapping(Element elem)
Add id to element lookup table (used in setId method)

Parameters:
elem - the element associated with the id

idMapKey

static java.lang.Long idMapKey(int type,
                               int id)
                        throws java.lang.IllegalArgumentException
Creates a id key given a type and id number.

Parameters:
type - one of Grappa.NODE, Grappa.EDGE or Grappa.SUBGRAPH
id - an id number
Returns:
an idKey for an element
Throws:
java.lang.IllegalArgumentException - whenever the specified type is not valid
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

idKeyType

static int idKeyType(java.lang.Long idKey)
Get the type of the id key.

Parameters:
idKey - the id key to examine
Returns:
the type of the id key (Grappa.NODE, Grappa.EDGE, Grappa.SUBGRAPH)
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

idKeyId

static int idKeyId(java.lang.Long idKey)
Get the type of the id key.

Parameters:
idKey - the id key to examine
Returns:
the type of the id key (Grappa.NODE, Grappa.EDGE, Grappa.SUBGRAPH)
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

element4Id

Element element4Id(java.lang.Long idKey)
Get the element associated with an id key

Parameters:
idKey - the id key of the element to be located
Returns:
the Element object matching the id key or null

removeIdMapping

void removeIdMapping(Element elem)
Remove id2element dictionary element

Parameters:
id - the id number of the element entry to be removed

printGraph

public void printGraph(java.io.Writer output)
Output graph to specified Writer.

Parameters:
output - the Writer for writing

printGraph

public void printGraph(java.io.OutputStream output)
Output graph to specified OutputStream. A convenience method to accomodate the OuputStreams easily.

Parameters:
output - the OutputStream for writing

nextId

int nextId(int type)
     throws java.lang.IllegalArgumentException
Get the next id number for the specified type and increment the counter.

Parameters:
type - type of id number to return
Returns:
the next sequential id number (counter is incremented).
Throws:
java.lang.IllegalArgumentException - whenever the specified type is not valid
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

getId

public int getId(int type)
          throws java.lang.IllegalArgumentException
Get the next id number for the specified type, but do not increment the counter.

Parameters:
type - type of id number to return
Returns:
the next sequential id number (counter is not incremented).
Throws:
java.lang.IllegalArgumentException - whenever the specified type is not valid
See Also:
GrappaConstants.NODE, GrappaConstants.EDGE, GrappaConstants.SUBGRAPH

getIndent

public java.lang.String getIndent()
Get the current indent string.

Returns:
the current indent string.

incrementIndent

public void incrementIndent()
Increase the indent string by appending INDENT_STRING.

See Also:
INDENT_STRING

decrementIndent

public void decrementIndent()
Decrease the indent string by removing one INDENT_STRING.

See Also:
INDENT_STRING

isDirected

public boolean isDirected()
Check if the graph is directed.

Returns:
true if graph is a directed graph

isStrict

public boolean isStrict()
Check if the graph is strict (i.e., no self-loops).

Returns:
true if the graph is strict

setToolTipText

public java.lang.String setToolTipText(java.lang.String text)
Set the tooltip text displayed when outside the graph area.

Parameters:
text - out-of-graph tooltip text
Returns:
previous out-of-graph tooltip text

getToolTipText

public java.lang.String getToolTipText()
Get the tooltip text displayed when outside the graph area.

Returns:
out-of-graph tooltip text

reset

public void reset()
Reset this graph by removing all its elements and re-initiailizing its internal variables.


reset

public void reset(java.lang.String graphName,
                  boolean directed,
                  boolean strict)
Reset this graph by removing all its elements and re-initiailizing its internal variables and possibly changing its name, directedness and strictness.


isEditable

public boolean isEditable()
Check if this graph is interactively editable (i.e., through mouse events).

Returns:
true if the graph can be edited interactively.

setEditable

public boolean setEditable(boolean mode)
Set the editability of the graph.

Parameters:
mode - true to turn on editability.
Returns:
previous value
See Also:
isEditable()

isSelectable

public boolean isSelectable()
Check if graph elements are interactively selectable (i.e., through mouse events).

Returns:
true if graph elements can be selected interactively.

setSelectable

public boolean setSelectable(boolean mode)
Set the selectability of the graph.

Parameters:
mode - true to turn on selectability.
Returns:
previous value
See Also:
isSelectable()

isMenuable

public boolean isMenuable()
Check if an element-specific menu is available interactively (i.e., through mouse events).

Returns:
true if an element-specific menu is available

setMenuable

public boolean setMenuable(boolean mode)
Set whether element-specific menus are to be available interactively.

Parameters:
mode - true to turn on element-specific-menus.
Returns:
previous value
See Also:
isMenuable()

setErrorWriter

public java.io.PrintWriter setErrorWriter(java.io.PrintWriter errWriter)
Set the PrintWriter for error messages.

Parameters:
errWriter - the PrintWriter to use for error messages.
Returns:
the previous PrintWriter used for error messages.
See Also:
PrintWriter

getErrorWriter

public java.io.PrintWriter getErrorWriter()
Get the current PrintWriter used for error messages.

Returns:
the current PrintWriter used for error messages.
See Also:
PrintWriter

printError

public void printError(java.lang.String msg)
Print the supplied message to the error output. Nothing happens if the error output is set to null.

Parameters:
msg - the message to print on the error output.
See Also:
setErrorWriter(java.io.PrintWriter)

printError

public void printError(java.lang.String msg,
                       java.lang.Exception ex)
Print the supplied message and exception information to the error output. Nothing happens if the error output is set to null.

Parameters:
msg - the message to print on the error output.
ex - if supplied, the stack trace associated with this exception is also printed.
See Also:
setErrorWriter(java.io.PrintWriter)

buildShapes

public void buildShapes()
Builds any GrappaNexus object not already built for elements in this graph.


resync

public void resync()
Builds any GrappaNexus object not already built and rebuilds those that already exist for all elements in this graph.


repaint

public void repaint()
Makes a repaint request of all GrappaPanels that are displaying this graph.


paintImmediately

public void paintImmediately()
Makes a paintImmediately request of all GrappaPanels that are displaying this graph.


addPanel

public void addPanel(GrappaPanel panel)
Adds a panel to the list of GrappaPanels that are displaying this graph.

Parameters:
panel - the GrappaPanel to be added to the list

removePanel

public void removePanel(GrappaPanel panel)
Removes a panel to the list of GrappaPanels that are displaying this graph.

Parameters:
panel - the GrappaPanel to be removed to the list