uchicago.src.sim.gui
Interface GraphLayout

All Superinterfaces:
java.awt.event.ActionListener, java.util.EventListener
All Known Implementing Classes:
AbstractGraphLayout, CircularGraphLayout, DefaultGraphLayout, FruchGraphLayout, KamadaGraphLayout, LayoutWithDisplay, RandomGraphLayout

public interface GraphLayout
extends java.awt.event.ActionListener

An Interface for laying out graphs (ie networks of nodes and edges). This is used by Network2DDisplay as the source of nodes and edges to draw. The intention here is that the layout algorithm is separated from the actual drawing code. Concrete implementations should work with lists of DrawableNonGridNodes. These nodes are expected to draw themselves, but have their x and y coordinates set via whatever layout algorithm is used by the implementing class.

GraphLayout extends ActionListener. The intent here is that computationally intensive layouts can listen for the Controller's stop, pause, etc. button clicks and interrupt themselves. See the source code to KamadaGraphLayout for an example of this.

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

Method Summary
 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.
 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.
 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 interface java.awt.event.ActionListener
actionPerformed
 

Method Detail

getHeight

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


getWidth

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


setList

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


appendToList

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


appendToList

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


updateLayout

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


getNodeList

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


setUpdate

void setUpdate(boolean doUpdate)
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.

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