ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.conversation
Class AbleCpGraphLoader

java.lang.Object
  extended bycom.ibm.able.conversation.AbleCpGraphLoader

public class AbleCpGraphLoader
extends java.lang.Object

This takes a CpStateMachine and constructs an equivalent com.ibm.graph.Net object.

Used by AbleCpGraphViewer.


Constructor Summary
AbleCpGraphLoader(CpStateMachine machine)
          AbleCPGraphLoader constructor.
 
Method Summary
 com.ibm.graph.Vertex findVertex(java.lang.String name)
          Returns the vertex for the given name.
 CpStateMachine getStateMachine()
          Returns the state-machine associated with the graph loader.
 java.util.Hashtable getVertexTable()
          Returns the internal vertex table.
 void initDrawable(com.ibm.graph.Edge edge, int idx)
          Creates and adds a drawable appropriate to the edge.
 boolean isLayoutDone()
          Returns if the graph has been laid out.
 java.awt.Dimension loadFromLayout(java.io.File file)
          Loads the graph layout (vertex co-ordinates) from the disc file.
 void loadGraph(com.ibm.graph.Net graph)
          Typically the function that defines the main point of entry into the class.
 void saveCurrentLayout(java.io.File file, java.awt.Dimension frameSize, java.lang.String policyName)
          Saves the current layout (vertex co-ordinates) into the specified file.
 void tuneEdgeLayout(com.ibm.graph.Net graph)
          Fiddle with edges' layout parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbleCpGraphLoader

public AbleCpGraphLoader(CpStateMachine machine)
AbleCPGraphLoader constructor.

Parameters:
machine - a state machine description
Method Detail

findVertex

public com.ibm.graph.Vertex findVertex(java.lang.String name)
Returns the vertex for the given name.

Parameters:
name - the name of the vertex

Returns:
the corresponding vertex if present, null otherwise

getVertexTable

public java.util.Hashtable getVertexTable()
Returns the internal vertex table.

Returns:
Hashtable of vertices indexed by vertex name

initDrawable

public void initDrawable(com.ibm.graph.Edge edge,
                         int idx)
Creates and adds a drawable appropriate to the edge.

Parameters:
edge - the edge to be initialized

idx - integer index that counts which of the source's out-edges this is.

isLayoutDone

public boolean isLayoutDone()
Returns if the graph has been laid out.

Returns:
true if the graph has been laid out, false otherwise

getStateMachine

public CpStateMachine getStateMachine()
Returns the state-machine associated with the graph loader.

Returns:
the state mahcine object associated with the graph loader

loadGraph

public void loadGraph(com.ibm.graph.Net graph)
Typically the function that defines the main point of entry into the class. Loads the state machine being visualized into the graph object passed. Creates vertices, edges and performs initial layout.

Parameters:
graph - the graph to load the state machine into

tuneEdgeLayout

public void tuneEdgeLayout(com.ibm.graph.Net graph)
Fiddle with edges' layout parameters. Assumes that the graph has been laid out already, and in particular, that the nodes' positions have been set.

Parameters:
graph - the graph object that needd its edges to be tuned

loadFromLayout

public java.awt.Dimension loadFromLayout(java.io.File file)
Loads the graph layout (vertex co-ordinates) from the disc file.

Parameters:
file - the file object for the GLF (Graph Layout Format) file

Returns:
the size of the frame required to display the graph as specified in the GLF file

saveCurrentLayout

public void saveCurrentLayout(java.io.File file,
                              java.awt.Dimension frameSize,
                              java.lang.String policyName)
Saves the current layout (vertex co-ordinates) into the specified file.

Parameters:
file - the file object for storing the layout

frameSize - the size of the frame for displaying the saved layout. the frame size is also stored into the file

ABLE 2.3.0 07/13/2005 14:21:00

(C) Copyright IBM Corporation 1999, 2005