|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.DisplayGraph scale.visual.DaVinci
public class DaVinci
This class implements methods to generate commands to display a graph using daVinci.
$Id: DaVinci.java,v 1.40 2007-10-04 19:58:40 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
This wrapper uses the daVinci program to provide an Xwindow display of a graph. This wrapper assumes a single tasking environment, but supports multiple graphs.
A user of this class will in general, have the following code:
Called once per graph.
Field Summary |
---|
Fields inherited from class scale.common.DisplayGraph |
---|
DISPLAY_EDGE_LABELS, outputPath, SHOW_ANNO, SHOW_CDG, SHOW_CLEF, SHOW_DD, SHOW_DEFUSE, SHOW_DOM, SHOW_EXPR, SHOW_EXPR_MASK, SHOW_HIGH_EXPR, SHOW_LOW_EXPR, SHOW_MAYUSE, SHOW_PDOM, SHOW_TYPE |
Constructor Summary | |
---|---|
DaVinci()
|
Method Summary | |
---|---|
void |
addEdge(DisplayNode n1,
DisplayNode n2,
DColor color,
DEdge edgeAttributes,
java.lang.Object edgeInfo)
Add an edge to the graph from node n1 to node n2. |
void |
addNode(DisplayNode n)
Add a node to the graph. |
protected boolean |
checkOk()
Checks input from visualizer to see if it has returned an "ok". |
void |
closeWindow(java.lang.String context)
This closes an existing new visualization window. |
java.lang.String |
dashedEdgeAttr()
Return attribute for dashed edges. |
java.lang.String |
dottedEdgeAttr()
Retrn attribute for dotted edges. |
protected java.lang.String |
getContext()
Reads line from input which is expected to be a context indicator and parses it to extract the context. |
java.lang.Object |
getLocation(java.lang.String context,
java.lang.String key)
Return the node or edge represented by the key in the specified graph. |
void |
interact()
Respond to interative events with this display. |
void |
newGraph(java.lang.String context,
boolean top)
Initialize for a new graph. |
void |
openWindow(java.lang.String context,
java.lang.String title,
int graphAttributes)
This opens a new visualization window. |
protected boolean |
processResponse(java.lang.String context)
High level method which handles reading input until an acknowledgement is received from the expected window. |
protected void |
showMessage(java.lang.String context,
java.lang.String message)
Show a message in the window. |
void |
terminate()
Terminates the visualizer process. |
boolean |
visited(DisplayNode n)
Return true if the node has been processed. |
boolean |
windowExists(java.lang.String context)
Return true if the window for the given context still exists. |
Methods inherited from class scale.common.DisplayGraph |
---|
addDisplayString, getVisualizer, initColors, setOutputPath, setVisualizer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DaVinci()
Method Detail |
---|
public void newGraph(java.lang.String context, boolean top)
newGraph
in class DisplayGraph
context
- is the name associated with the graphtop
- if true places the root node at the top of the displaypublic java.lang.String dottedEdgeAttr()
public java.lang.String dashedEdgeAttr()
public boolean visited(DisplayNode n)
visited
in class DisplayGraph
n
- is the node to checkpublic void addNode(DisplayNode n)
addNode
in class DisplayGraph
n
- is the nodepublic void addEdge(DisplayNode n1, DisplayNode n2, DColor color, DEdge edgeAttributes, java.lang.Object edgeInfo)
bits | use |
---|---|
5-0 | color |
6 | type: normal, backedge |
8-7 | pattern: solid, dashed, dotted
addEdge
in class DisplayGraph
n1
- is the first noden2
- is the second nodecolor
- specifies the edge coloredgeAttributes
- specifies the type, and form of the edgeedgeInfo
- is additional information about the edgepublic java.lang.Object getLocation(java.lang.String context, java.lang.String key)
public void terminate()
terminate
in class DisplayGraph
public void openWindow(java.lang.String context, java.lang.String title, int graphAttributes)
openWindow
in class DisplayGraph
context
- is the user defined string to distinguish between
different windowstitle
- is title for the windowgraphAttributes
- species attributes for the graphDisplayGraph.newGraph(java.lang.String, boolean)
public void closeWindow(java.lang.String context)
closeWindow
in class DisplayGraph
context
- is the user defined string to distinguish between
different windowsDisplayGraph.newGraph(java.lang.String, boolean)
protected boolean checkOk()
To avoid problems if user manually terminates the visualization tool, this method returns true if the input is null. Null input occurs when the pipe is broken.
protected java.lang.String getContext()
protected boolean processResponse(java.lang.String context)
This method currently doesn't handle errors well. It simply returns whether or not it encounters an error.
This method may have to be made public once we support mouse input.
context
- indicates from which window input is expected
protected void showMessage(java.lang.String context, java.lang.String message)
context
- indicates to which window the graph is to be drawnmessage
- is the message to displaypublic boolean windowExists(java.lang.String context)
windowExists
in class DisplayGraph
public void interact()
interact
in class DisplayGraph
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |