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

com.ibm.able.conversation
Class AbleCpGraphViewer

java.lang.Object
  |
  +--com.ibm.able.conversation.AbleCpGraphViewer
All Implemented Interfaces:
java.util.EventListener, java.beans.PropertyChangeListener

public class AbleCpGraphViewer
extends java.lang.Object
implements java.beans.PropertyChangeListener

This provides graphical display of a CpStateMachine.

Shows a single state machine's graph in its own frame. It supports highlighting of the conversation's current state and a popup window showing details of selected states & transitions. States may be dragged around on the screen. The graph's layout (i.e., positions of states) can be read from or written to file.

Typical usage:

  1. Create an AbleCpGraphViewer.
  2. Create an AbleCpGraphLoader and load a CpStateMachine into it.
  3. Pass the Loader to the Viewer via AbleCpGraphViewer.loadGraph(...)
  4. call AbleCpGraphViewer.loadFrame() to create the frame containing the graph and display it onscreen.


Constructor Summary
AbleCpGraphViewer(java.lang.String frameName)
          Constructor for AbleCpGraphViewer
AbleCpGraphViewer(java.lang.String frameName, java.lang.String viewerName)
          Constructor for AbleCpGraphViewer
 
Method Summary
protected  void changeCurrentState(java.lang.String oldValue, java.lang.String newValue)
           
 void fixDisplay()
          This tweaks the graph's display in misc ways:
 AbleCpGraphLoader getCPGraphLoader()
          Returns the associated graph loader object
 javax.swing.JFrame getFrame()
          Returns the bounding frame
 java.awt.Graphics getGraphics()
          Returns the graphics object associated with the canvas
 javax.swing.JComponent getGraphPane()
          Returns the Swing component on which the graph is displayed.
 java.awt.Point getLocation()
          Returns the location where the viewer is set to be displayed
 java.lang.String getName()
          Returns the name of the frame
 boolean isVisible()
          Returns true if the frame displaying the CP is visible, false if not
 void loadFrame()
          Displays the (state-machine) graph object on a frame and displays the menu
 void loadFromLayout(java.io.File f)
          Loads the layout from the file represented by the file object
 void loadGraph(AbleCpGraphLoader graphLoader)
          Loads the state-machine into the graph using a AbleCPGraphLoader.
static void main(java.lang.String[] args)
           
 void propertyChange(java.beans.PropertyChangeEvent event)
          Listens to changes in the active state property of the CPH
 void saveCurrentLayout(java.io.File f)
          Saves the current layout into the file represented by the file object
 void setLocation(java.awt.Point p)
          Sets the location for displaying the viewer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbleCpGraphViewer

public AbleCpGraphViewer(java.lang.String frameName)
Constructor for AbleCpGraphViewer

Parameters:
frameName - name to be assigned to the displaying frame

AbleCpGraphViewer

public AbleCpGraphViewer(java.lang.String frameName,
                         java.lang.String viewerName)
Constructor for AbleCpGraphViewer

Parameters:
frameName - name to be assigned to the displaying frame
viewerName - string identifier for the viewer
Method Detail

getFrame

public javax.swing.JFrame getFrame()
Returns the bounding frame

Returns:
return the bounding frame

getGraphics

public java.awt.Graphics getGraphics()
Returns the graphics object associated with the canvas

Returns:
the associated graphics object

getName

public java.lang.String getName()
Returns the name of the frame

Returns:
the name of the frame

fixDisplay

public void fixDisplay()
This tweaks the graph's display in misc ways:

(1) Moves the graph over & down a bit

(2) Fixes size of the canvas.


getGraphPane

public javax.swing.JComponent getGraphPane()
Returns the Swing component on which the graph is displayed.

Returns:
the Swing component on which the graph is displayed.

loadGraph

public void loadGraph(AbleCpGraphLoader graphLoader)
Loads the state-machine into the graph using a AbleCPGraphLoader.

Parameters:
graphLoader - AbleCPGraphLoader object used to load the state-machine

getCPGraphLoader

public AbleCpGraphLoader getCPGraphLoader()
Returns the associated graph loader object

Returns:
the associated graph loader object

saveCurrentLayout

public void saveCurrentLayout(java.io.File f)
Saves the current layout into the file represented by the file object

Parameters:
the - file object for storing the current layout

loadFromLayout

public void loadFromLayout(java.io.File f)
Loads the layout from the file represented by the file object

Parameters:
the - file object for loading the layout from

loadFrame

public void loadFrame()
Displays the (state-machine) graph object on a frame and displays the menu

isVisible

public boolean isVisible()
Returns true if the frame displaying the CP is visible, false if not

Returns:
Returns true if the frame displaying the CP is visible, false if not

setLocation

public void setLocation(java.awt.Point p)
Sets the location for displaying the viewer

Parameters:
p - the point to display the viewer at

getLocation

public java.awt.Point getLocation()
Returns the location where the viewer is set to be displayed

Returns:
the location of the viewer

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Listens to changes in the active state property of the CPH
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

changeCurrentState

protected void changeCurrentState(java.lang.String oldValue,
                                  java.lang.String newValue)

main

public static void main(java.lang.String[] args)

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

(C) Copyright IBM Corporation 1999, 2003