All Packages Class Hierarchy This Package Previous Next Index
Class att.grappa.Graph
java.lang.Object
|
+----att.grappa.Element
|
+----att.grappa.Subgraph
|
+----att.grappa.Graph
- 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.1, 30 Sep 1999; Copyright 1996 - 1999 by AT&T Corp.
- Author:
- John Mocenigo, Research @ AT&T Labs
-
INDENT_STRING
- The string used for indentation when printing out the graph.
-
Graph(String)
- Creates a directed graph that is not strict
A convenience method equivalent to Graph(graphName,true,false).
-
Graph(String, boolean, boolean)
- Creates a new, empty Graph object.
-
addDrawPane(DrawPane)
- Adds a DrawPane to the graph's list of DrawPanes
if it is not already in the list.
-
addGroupingContext(GraphicContext)
- Add a GraphicContext to the list of GraphicContexts used when
indicating groupings of elements.
-
decrementIndent()
- Decrease the indent string by removing one INDENT_STRING.
-
getCurrent()
- Get the element marked as the current element.
-
getDeletionContext()
- Get the GraphicContext to use when an element is to be deleted.
-
getErrorWriter()
- Get the current PrintWriter used for error messages.
-
getGlobalAttribute(int, String)
- Gets a graph default attribute.
-
getGlobalAttributeKeys(int)
- Gets an enumeration of the specified graph default attribute keys
-
getGlobalAttributePairs(int)
- Gets an enumeration of the specified graph default attributes
-
getGlobalAttributeSize(int)
- Get a count of the graph default attributes of a particular type.
-
getGraphPanes()
- Get an enumeration of the panes upon which given graph is displayed.
-
getGraphPropertiesCard()
- Get the graph properties card.
-
getGrappaAttribute(String)
- Gets Grappa default attribute.
-
getGrappaAttributeKeys()
- Get an enumeration of the Grappa package attribute keys.
-
getGroupingContextAt(int)
- Get a specific GraphicContext from the list of
GraphicContexts used to indicate groupings
of elements.
-
getGroupingContextsSize()
- Get the size of the list of GraphicContexts used to indicate groupings
of elements.
-
getId(int)
- Get the next id number for the specified type, but do not increment the counter.
-
getIndent()
- Get the current indent string.
-
getSelectionContext()
- Get the GraphicContext to use when an element is selected.
-
hasAppObjectsSomewhere()
- Indicates that there are AppObjects somewhere in the graph.
-
hasDrawObjectsSomewhere()
- Indicates that there are DrawObjects somewhere in the graph.
-
incrementIndent()
- Increase the indent string by appending INDENT_STRING.
-
instantiateGraph()
- Instantiates both the application and drawing components of each of
the graph elements within the graph.
Deprecated.
-
isDirected()
- Check if the graph is directed.
-
isEditable()
- Check if this graph is interactively editable (i.e., through mouse events).
-
isMenuable()
- Check if an element-specific menu is available interactively (i.e., through mouse events).
-
isSelectable()
- Check if graph elements are interactively selectable (i.e., through mouse events).
-
isStrict()
- Check if the graph is strict (i.e., no self-loops).
-
printError(String)
- Print the supplied message to the error output.
-
printError(String, Exception)
- Print the supplied message and exception information to the error output.
-
printGraph(OutputStream)
- Output graph to specified OutputStream.
-
printGraph(Writer)
- Output graph to specified Writer.
-
removeDrawPane(DrawPane)
- Removes a DrawPane from the graph's list of DrawPanes.
-
replaceContents(Graph)
- Replace all aspects of the current graph with the supplied graph.
-
reset()
- Reset this graph by removing all its elements and re-initiailizing
its internal variables.
-
reset(String, boolean, boolean)
- Reset this graph by removing all its elements and re-initiailizing
its internal variables and possibly changing its name, directedness
and strictness.
-
setAsGraphPropertiesCard(PopUpCard)
- Sets the value of the graph properties card.
-
setCurrent(Element)
- Set the supplied element as the current element of the graph.
-
setDeletionContext(GraphicContext)
- Set the GraphicContext to use when an element is to be deleted.
-
setEditable(boolean)
- Set the editability of the graph.
-
setErrorWriter(PrintWriter)
- Set the PrintWriter for error messages.
-
setGrappaAttribute(String, String)
- Sets a Grappa package attribute.
-
setGroupingContexts(Vector)
- Set the list of GraphicContexts to use when indicating groupings of elements.
-
setMenuable(boolean)
- Set whether element-specific menus are to be available interactively.
-
setSelectable(boolean)
- Set the selectability of the graph.
-
setSelectionContext(GraphicContext)
- Set the GraphicContext to use when an element is selected.
-
validGrappaAttributeKey(String)
- Check if the given key has a format consistent with Grappa package
attribute keys.
INDENT_STRING
public static final String INDENT_STRING
- The string used for indentation when printing out the graph.
Graph
public Graph(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(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
hasDrawObjectsSomewhere
public boolean hasDrawObjectsSomewhere()
- Indicates that there are DrawObjects somewhere in the graph.
- Returns:
- true, if there are DrawObjects in the graph.
hasAppObjectsSomewhere
public boolean hasAppObjectsSomewhere()
- Indicates that there are AppObjects somewhere in the graph.
- Returns:
- true, if there are AppObjects in the graph.
getGrappaAttribute
public Attribute getGrappaAttribute(String key) throws 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: IllegalArgumentException
- whenever the key is null
setGrappaAttribute
public String setGrappaAttribute(String key,
String value) throws 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: IllegalArgumentException
- whenever the key is not prefixed by Grappa.PKG_LOWER
- See Also:
- PKG_LOWER
getGrappaAttributeKeys
public Enumeration getGrappaAttributeKeys()
- Get an enumeration of the Grappa package attribute keys.
- Returns:
- an Enumeration of Attribute objects
validGrappaAttributeKey
public static boolean validGrappaAttributeKey(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:
- PKG_LOWER
getGlobalAttribute
public Attribute getGlobalAttribute(int type,
String key) throws 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: IllegalArgumentException
- whenever the specified type is not valid
- See Also:
- NODE, EDGE, SUBGRAPH
getGlobalAttributeKeys
public Enumeration getGlobalAttributeKeys(int type) throws IllegalArgumentException
- Gets an enumeration of the specified graph default attribute keys
- Parameters:
- type - indicates attribute type.
- Returns:
- an Enumeration of String objects
- Throws: IllegalArgumentException
- whenever the specified type is not valid
- See Also:
- NODE, EDGE, SUBGRAPH
getGlobalAttributePairs
public Enumeration getGlobalAttributePairs(int type) throws IllegalArgumentException
- Gets an enumeration of the specified graph default attributes
- Parameters:
- type - indicates attribute type.
- Returns:
- an Enumeration of Attribute objects
- Throws: IllegalArgumentException
- whenever the specified type is not valid
- See Also:
- NODE, EDGE, SUBGRAPH
getGlobalAttributeSize
public int getGlobalAttributeSize(int type) throws 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: IllegalArgumentException
- whenever the specified type is not valid
- See Also:
- NODE, EDGE, SUBGRAPH
instantiateGraph
public void instantiateGraph() throws InstantiationException
- Note: instantiateGraph() is deprecated.
Replaced by
buildObjects()
.
- Instantiates both the application and drawing components of each of
the graph elements within the graph.
- Throws: InstantiationException
- occurs if there is a problem instantiating
the AppObjects or DrawObjects for this graph.
- See Also:
- buildObjects
printGraph
public void printGraph(Writer output)
- Output graph to specified Writer.
- Parameters:
- output - the Writer for writing
printGraph
public void printGraph(OutputStream output)
- Output graph to specified OutputStream.
A convenience method to accomodate the OuputStreams easily.
- Parameters:
- output - the OutputStream for writing
getId
public int getId(int type) throws 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: IllegalArgumentException
- whenever the specified type is not valid
- See Also:
- NODE, EDGE, SUBGRAPH
getIndent
public 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
reset
public void reset()
- Reset this graph by removing all its elements and re-initiailizing
its internal variables.
reset
public void reset(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 PrintWriter setErrorWriter(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 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(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
printError
public void printError(String msg,
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
getGraphPanes
public Enumeration getGraphPanes()
- Get an enumeration of the panes upon which given graph is displayed.
- Returns:
- an Enumeration of DrawPane objects
addDrawPane
public void addDrawPane(DrawPane pane)
- Adds a DrawPane to the graph's list of DrawPanes
if it is not already in the list.
- Parameters:
- pane - the DrawPane to be added
removeDrawPane
public void removeDrawPane(DrawPane pane)
- Removes a DrawPane from the graph's list of DrawPanes.
- Parameters:
- pane - the DrawPane to be removed
getGraphPropertiesCard
public PopUpCard getGraphPropertiesCard()
- Get the graph properties card. The graph properities card is used for
displaying information such as local and default
attribute values for a specific element. A single card is used
(and re-used) for all elements in the graph. Naturally, the content
displayed varies by element.
- Returns:
- the graph properties card for this graph
setAsGraphPropertiesCard
public PopUpCard setAsGraphPropertiesCard(PopUpCard newCard)
- Sets the value of the graph properties card.
- Parameters:
- newCard - the new card to use as the graph properties card
- Returns:
- the previous graph properties card
setSelectionContext
public GraphicContext setSelectionContext(GraphicContext context)
- Set the GraphicContext to use when an element is selected.
- Parameters:
- context - the GraphicContext to use for selection
- Returns:
- the previous GraphicContext used for selection
getSelectionContext
public GraphicContext getSelectionContext()
- Get the GraphicContext to use when an element is selected.
- Returns:
- the current GraphicContext used for selection
setDeletionContext
public GraphicContext setDeletionContext(GraphicContext context)
- Set the GraphicContext to use when an element is to be deleted.
- Parameters:
- context - the GraphicContext to use to indicate a pending deletion
- Returns:
- the previous GraphicContext used to indicate a pending deletion
getDeletionContext
public GraphicContext getDeletionContext()
- Get the GraphicContext to use when an element is to be deleted.
- Returns:
- the current GraphicContext used to indicate a pending deletion
setGroupingContexts
public Vector setGroupingContexts(Vector contexts)
- Set the list of GraphicContexts to use when indicating groupings of elements.
- Parameters:
- contexts - the Vector of GraphicContexts to use when indicating groupings of elements
- Returns:
- the previous Vector of GraphicContexts used when indicating groupings of elements
addGroupingContext
public GraphicContext addGroupingContext(GraphicContext gc)
- Add a GraphicContext to the list of GraphicContexts used when
indicating groupings of elements.
- Parameters:
- gc - the GraphicContext to be added
- Returns:
- the GraphicContext that was added (which is a clone of the supplied context)
getGroupingContextsSize
public int getGroupingContextsSize()
- Get the size of the list of GraphicContexts used to indicate groupings
of elements.
- Returns:
- the size of the grouping context list
getGroupingContextAt
public GraphicContext getGroupingContextAt(int slot)
- Get a specific GraphicContext from the list of
GraphicContexts used to indicate groupings
of elements.
- Parameters:
- slot - the slot number of the element in the list to return
- Returns:
- the requested GraphicContext or null if there is no such list element
setCurrent
public Element setCurrent(Element newValue)
- Set the supplied element as the current element of the graph.
A call to AppObject.setCurrent(boolean) is triggered also.
- Parameters:
- newValue - the element to set as the current element
- Returns:
- the element that had been marked as the current element
- See Also:
- setCurrent
getCurrent
public Element getCurrent()
- Get the element marked as the current element.
- Returns:
- the graph element marked as the current element
replaceContents
public void replaceContents(Graph demon)
- Replace all aspects of the current graph with the supplied graph.
- Parameters:
- demon - the graph taking possession of this graph.
All Packages Class Hierarchy This Package Previous Next Index