uchicago.src.sim.gui
Class AbstractGraphLayout

java.lang.Object
  extended by uchicago.src.sim.gui.AbstractGraphLayout
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, GraphLayout
Direct Known Subclasses:
CircularGraphLayout, DefaultGraphLayout, LayoutWithDisplay, RandomGraphLayout

public abstract class AbstractGraphLayout
extends java.lang.Object
implements GraphLayout

Abstract implementation of the GraphLayout interface. This implements basic list operations, but no layout algorithm. Sub-classes are expected to implement updateLayout() to do the actual layout of the nodes in the nodeList. In addition subclasses may override the empty ActionListener implementation provided here.

Version:
$Revision: 1.6 $ $Date: 2004/11/03 19:50:59 $
Author:
Nick Collier

Field Summary
protected  int height
           
protected  java.util.ArrayList nodeList
           
protected  boolean update
           
protected  int width
           
 
Constructor Summary
AbstractGraphLayout(int width, int height)
           
AbstractGraphLayout(java.util.List nodes, int width, int height)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Empty implementation of ActionListener interface.
 void appendToList(DrawableNonGridNode node)
          Appends the specified nodes to the list of nodes to be laid out by this GraphLayout.
 void appendToList(java.util.List listOfNodes)
          Appends a list of nodes to the current list of nodes to be laid out by this GraphLayout.
 int getHeight()
          Gets the height of the area on which to layout the graph.
 java.util.ArrayList getNodeList()
          Gets the list of nodes.
 boolean getUpdate()
           
 int getWidth()
          Gets the width of the area on which to layout the graph.
 void setList(java.util.List listOfNodes)
          Sets the list of nodes to be laid out by this GraphLayout.
 void setUpdate(boolean doUpdate)
          Sets whether the display will update or not when updateLayout is called.
abstract  void updateLayout()
          Updates the layout of this graph by setting the x, y coordinate of each DrawableNonGridNode in the current list of nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeList

protected java.util.ArrayList nodeList

width

protected int width

height

protected int height

update

protected boolean update
Constructor Detail

AbstractGraphLayout

public AbstractGraphLayout(int width,
                           int height)

AbstractGraphLayout

public AbstractGraphLayout(java.util.List nodes,
                           int width,
                           int height)
Method Detail

getHeight

public int getHeight()
Gets the height of the area on which to layout the graph.

Specified by:
getHeight in interface GraphLayout

getWidth

public int getWidth()
Gets the width of the area on which to layout the graph.

Specified by:
getWidth in interface GraphLayout

setList

public void setList(java.util.List listOfNodes)
Sets the list of nodes to be laid out by this GraphLayout.

Specified by:
setList in interface GraphLayout

appendToList

public void appendToList(java.util.List listOfNodes)
Appends a list of nodes to the current list of nodes to be laid out by this GraphLayout.

Specified by:
appendToList in interface GraphLayout

appendToList

public void appendToList(DrawableNonGridNode node)
Appends the specified nodes to the list of nodes to be laid out by this GraphLayout.

Specified by:
appendToList in interface GraphLayout

getNodeList

public java.util.ArrayList getNodeList()
Gets the list of nodes.

Specified by:
getNodeList in interface GraphLayout

setUpdate

public void setUpdate(boolean doUpdate)
Description copied from interface: GraphLayout
Sets whether the display will update or not when updateLayout is called. This allows for the regular scheduling of updateLayout together with the ability to skip the actual execution of the method.

Specified by:
setUpdate in interface GraphLayout
Parameters:
doUpdate - if true, this GraphLayout will perform the layout when updateLayout is called. If false, then the layout will not be performed.

getUpdate

public boolean getUpdate()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Empty implementation of ActionListener interface. Sub-classes can override this to provide their own implementations.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

updateLayout

public abstract void updateLayout()
Updates the layout of this graph by setting the x, y coordinate of each DrawableNonGridNode in the current list of nodes.

Specified by:
updateLayout in interface GraphLayout