|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatt.grappa.Element
att.grappa.Subgraph
att.grappa.Graph
public class Graph
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.
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 |
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 java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String INDENT_STRING
boolean filterMode
private java.lang.StringBuffer indent
private java.io.PrintWriter errWriter
private boolean paintCalled
private boolean busy
private boolean synchronizePaint
private java.lang.String toolTipText
private java.util.List<GrappaPanel> panelList
private int gid
private int nid
private int eid
private boolean editable
private boolean menuable
private boolean selectable
private boolean directed
private boolean strict
java.util.Hashtable<java.lang.Long,Element> id2element
private java.util.Hashtable<java.lang.String,Attribute> grattributes
private static java.util.Hashtable<java.lang.String,Attribute> sysdfltNodeAttributes
private static java.util.Hashtable<java.lang.String,Attribute> sysdfltEdgeAttributes
private static java.util.Hashtable<java.lang.String,Attribute> sysdfltGraphAttributes
public final java.awt.font.FontRenderContext REFCNTXT
Constructor Detail |
---|
public Graph(java.lang.String graphName, boolean directed, boolean strict)
graphName
- the name of this graph.directed
- use true if graph is to be a directed graphstrict
- use true if graph is a strict graphpublic Graph(java.lang.String graphName)
graphName
- the name of this graph.Graph(java.lang.String, boolean, boolean)
Method Detail |
---|
private static void putAttribute(java.util.Hashtable<java.lang.String,Attribute> table, int type, java.lang.String name, java.lang.String value)
private void initialize(java.lang.String graphName)
private void setDirection(boolean directed)
public boolean setSynchronizePaint(boolean sync)
sync
- value to which indicator will be set
dropcloth(boolean, boolean)
public boolean getSynchronizePaint()
setSynchronizePaint(boolean)
public boolean dropcloth(boolean block, boolean auto)
block
- value to which to set the indicator flagauto
- when block is false, setting this parameter true will request a repaint() if any paint requests arrived while the dropcloth was laid out.
setSynchronizePaint(boolean)
boolean setPaint(boolean paint)
private boolean setBlocked(boolean state, boolean isPaint, boolean repaint)
public Attribute getGrappaAttribute(java.lang.String key) throws java.lang.IllegalArgumentException
key
- the search key for the corresponding attribute.
java.lang.IllegalArgumentException
- whenever the key is nullpublic java.lang.Object getGrappaAttributeValue(java.lang.String key) throws java.lang.IllegalArgumentException
key
- the search key for the corresponding attribute.
java.lang.IllegalArgumentException
- whenever the key is nullpublic java.lang.Object setGrappaAttribute(java.lang.String key, java.lang.String value) throws java.lang.IllegalArgumentException
key
- the search key for the corresponding attribute.
java.lang.IllegalArgumentException
- whenever the key is not prefixed by Grappa.PKG_LOWERGrappaConstants.PKG_LOWER
public static int attributeType(java.lang.String attrname)
attrname
- the attribute name
public java.util.Enumeration getGrappaAttributeKeys()
public static boolean validGrappaAttributeKey(java.lang.String key)
key
- the key to validate
GrappaConstants.PKG_LOWER
public static Attribute getGlobalAttribute(int type, java.lang.String key) throws java.lang.IllegalArgumentException
type
- indicates attribute type.key
- the search key for the corresponding attribute.
java.lang.IllegalArgumentException
- whenever the specified type is not validGrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
public static java.util.Enumeration getGlobalAttributeKeys(int type) throws java.lang.IllegalArgumentException
type
- indicates attribute type.
java.lang.IllegalArgumentException
- whenever the specified type is not validGrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
public static java.util.Enumeration getGlobalAttributePairs(int type) throws java.lang.IllegalArgumentException
type
- indicates attribute type.
java.lang.IllegalArgumentException
- whenever the specified type is not validGrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
public static int getGlobalAttributeSize(int type) throws java.lang.IllegalArgumentException
type
- indicates attribute type.
java.lang.IllegalArgumentException
- whenever the specified type is not validGrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
Element addIdMapping(Element elem)
elem
- the element associated with the idstatic java.lang.Long idMapKey(int type, int id) throws java.lang.IllegalArgumentException
type
- one of Grappa.NODE, Grappa.EDGE or Grappa.SUBGRAPHid
- an id number
java.lang.IllegalArgumentException
- whenever the specified type is not validGrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
static int idKeyType(java.lang.Long idKey)
idKey
- the id key to examine
GrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
static int idKeyId(java.lang.Long idKey)
idKey
- the id key to examine
GrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
Element element4Id(java.lang.Long idKey)
idKey
- the id key of the element to be located
void removeIdMapping(Element elem)
id
- the id number of the element entry to be removedpublic void printGraph(java.io.Writer output)
output
- the Writer for writingpublic void printGraph(java.io.OutputStream output)
output
- the OutputStream for writingint nextId(int type) throws java.lang.IllegalArgumentException
type
- type of id number to return
java.lang.IllegalArgumentException
- whenever the specified type is not validGrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
public int getId(int type) throws java.lang.IllegalArgumentException
type
- type of id number to return
java.lang.IllegalArgumentException
- whenever the specified type is not validGrappaConstants.NODE
,
GrappaConstants.EDGE
,
GrappaConstants.SUBGRAPH
public java.lang.String getIndent()
public void incrementIndent()
INDENT_STRING
public void decrementIndent()
INDENT_STRING
public boolean isDirected()
public boolean isStrict()
public java.lang.String setToolTipText(java.lang.String text)
text
- out-of-graph tooltip text
public java.lang.String getToolTipText()
public void reset()
public void reset(java.lang.String graphName, boolean directed, boolean strict)
public boolean isEditable()
public boolean setEditable(boolean mode)
mode
- true to turn on editability.
isEditable()
public boolean isSelectable()
public boolean setSelectable(boolean mode)
mode
- true to turn on selectability.
isSelectable()
public boolean isMenuable()
public boolean setMenuable(boolean mode)
mode
- true to turn on element-specific-menus.
isMenuable()
public java.io.PrintWriter setErrorWriter(java.io.PrintWriter errWriter)
errWriter
- the PrintWriter to use for error messages.
PrintWriter
public java.io.PrintWriter getErrorWriter()
PrintWriter
public void printError(java.lang.String msg)
msg
- the message to print on the error output.setErrorWriter(java.io.PrintWriter)
public void printError(java.lang.String msg, java.lang.Exception ex)
msg
- the message to print on the error output.ex
- if supplied, the stack trace associated with this exception is also printed.setErrorWriter(java.io.PrintWriter)
public void buildShapes()
public void resync()
public void repaint()
public void paintImmediately()
public void addPanel(GrappaPanel panel)
panel
- the GrappaPanel to be added to the listpublic void removePanel(GrappaPanel panel)
panel
- the GrappaPanel to be removed to the list
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |