ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.conversation
Class CPGraphLoader

java.lang.Object
  |
  +--com.ibm.able.conversation.CPGraphLoader

public class CPGraphLoader
extends java.lang.Object

This reads CP data from a statemachine description and then constructs a graph from what it's read.

The loader creates the vertices, edges and positions them

OLD VERSION -- TO BE DELETED Replaced by AbleCpGraphLoader.


Constructor Summary
CPGraphLoader(StateMachineInterface machine)
          CPGraphLoader constructor.
 
Method Summary
 com.ibm.graph.Vertex findVertex(java.lang.String name)
          Returns the vertex for the given name
 StateMachineInterface 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 & 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

CPGraphLoader

public CPGraphLoader(StateMachineInterface machine)
CPGraphLoader 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 & 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

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

getStateMachine

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

Returns:
the state mahcine object associated with the graph loader

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.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003