org.wilmascope.graph
Class LayoutEngine<N extends NodeLayout,E extends EdgeLayout>

java.lang.Object
  extended by org.wilmascope.graph.LayoutEngine<N,E>
Direct Known Subclasses:
ColumnLayout, DotLayout, FastLayout, ForceLayout, HighDimensionLayout, MultiScaleLayout

public abstract class LayoutEngine<N extends NodeLayout,E extends EdgeLayout>
extends java.lang.Object

Classes which determine layout for a particular cluster must implement this interface.

Version:
$Id: LayoutEngine.java,v 1.15 2004/11/19 09:14:24 tgdwyer Exp $
Author:
Tim Dwyer

Constructor Summary
LayoutEngine()
           
 
Method Summary
abstract  boolean applyLayout()
          apply the changes calculated by calculateLayout()
 void calculateLayout()
          calculate the changes required to move the graph to a nicer layout.
abstract  E createEdgeLayout(Edge e)
          Factory method to create a new EdgeLayout implementation compatible with the layout engine implementing this interface.
abstract  N createNodeLayout(Node n)
          Factory method to create a new NodeLayout implementation compatible with the layout engine implementing this interface.
abstract  javax.swing.JPanel getControls()
           
abstract  java.lang.String getName()
          Return a string descriptor for the layout engine type.
 java.util.Properties getProperties()
          If you want custom properties for your layout you will need to override this method but be sure to super.getProperties()
 Cluster getRoot()
           
 void init(Cluster root)
          The LayoutEngine should have no constructor.
 boolean isIterative()
          The iterationsPerFrameSlider should be enabled for iterative layouts (like force directed) and disabled for layouts that complete in a single step (sugiyama)
 void resetProperties()
          process your custom properties by overriding this method, but, again call super.resetProperties in your overriding implementation
 void setProperties(java.util.Properties p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutEngine

public LayoutEngine()
Method Detail

calculateLayout

public void calculateLayout()
calculate the changes required to move the graph to a nicer layout. This method does not actually update the position of the nodes, rather this should be done by the applyLayout() method. Potentially, this means that the caller can calculate new positions (stored in the NodeLayouts), then opt not to apply the changes if it does not lead to an improvement. In practice this has not yet been utilised and such decisions are usually made internally to the layout engine.


applyLayout

public abstract boolean applyLayout()
apply the changes calculated by calculateLayout()

Returns:
true when a stable state is reached

getName

public abstract java.lang.String getName()
Return a string descriptor for the layout engine type. Useful in GUI elements such as comboboxes


createNodeLayout

public abstract N createNodeLayout(Node n)
Factory method to create a new NodeLayout implementation compatible with the layout engine implementing this interface.


createEdgeLayout

public abstract E createEdgeLayout(Edge e)
Factory method to create a new EdgeLayout implementation compatible with the layout engine implementing this interface.


getProperties

public java.util.Properties getProperties()
If you want custom properties for your layout you will need to override this method but be sure to super.getProperties()

Returns:
properties of this layout

setProperties

public final void setProperties(java.util.Properties p)

resetProperties

public void resetProperties()
process your custom properties by overriding this method, but, again call super.resetProperties in your overriding implementation


getControls

public abstract javax.swing.JPanel getControls()

init

public void init(Cluster root)
The LayoutEngine should have no constructor. It should be initialised with this method.


getRoot

public Cluster getRoot()

isIterative

public boolean isIterative()
The iterationsPerFrameSlider should be enabled for iterative layouts (like force directed) and disabled for layouts that complete in a single step (sugiyama)

Returns:
false by default. Override to return true if layout engine is iterative.