com.nwoods.jgo.layout
Class JGoAutoLayout

java.lang.Object
  extended bycom.nwoods.jgo.layout.JGoAutoLayout
Direct Known Subclasses:
JGoForceDirectedAutoLayout, JGoLayeredDigraphAutoLayout, JGoRandomAutoLayout

public abstract class JGoAutoLayout
extends java.lang.Object

JGoAutoLayout provides a common super-class for auto-layout algorithms. The key aspects of an auto-layout algorithm are an input JGoDocument, an input JGoNetwork and a performLayout method.


Constructor Summary
JGoAutoLayout()
          Constructs an AutoLayout with null values for its network, and document.
JGoAutoLayout(JGoDocument doc)
          Constructs an AutoLayout with the given document, and a JGoNetwork representing all top-level objects in that document.
JGoAutoLayout(JGoDocument doc, JGoNetwork network)
          Constructs an AutoLayout with the given document and network.
JGoAutoLayout(JGoSelection sel)
          Constructs an AutoLayout with a JGoNetwork representing all top-level objects in the given selection, and the selection's corresponding JGoDocument.
 
Method Summary
 JGoDocument getDocument()
          Returns the AutoLayout's JGoDocument.
 JGoNetwork getNetwork()
          Returns the AutoLayout's JGoNetwork.
abstract  void performLayout()
          Performs auto-layout.
 void progressUpdate(double progress)
          The function progressUpdate can be called at specific times in the layout routine to indicate progress through the layout.
 void setDocument(JGoDocument d)
          Sets the AutoLayout's JGoDocument to d.
 void setNetwork(JGoNetwork n)
          Sets the AutoLayout's JGoNetwork to n.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JGoAutoLayout

public JGoAutoLayout()
Constructs an AutoLayout with null values for its network, and document.


JGoAutoLayout

public JGoAutoLayout(JGoDocument doc)
Constructs an AutoLayout with the given document, and a JGoNetwork representing all top-level objects in that document.

Parameters:
doc - the JGoDocument containing the JGoObjects to layout

JGoAutoLayout

public JGoAutoLayout(JGoSelection sel)
Constructs an AutoLayout with a JGoNetwork representing all top-level objects in the given selection, and the selection's corresponding JGoDocument.

Parameters:
sel - the JGoSelection containing the JGoObjects to layout

JGoAutoLayout

public JGoAutoLayout(JGoDocument doc,
                     JGoNetwork network)
Constructs an AutoLayout with the given document and network.

Parameters:
doc - the JGoDocument containing the JGoObjects to layout
network - the JGoNetwork representation of the JGoObjects to layout
Method Detail

performLayout

public abstract void performLayout()
Performs auto-layout. This abstract method must be overridden by sub-classes to provide an auto-layout algorithm.


progressUpdate

public void progressUpdate(double progress)
The function progressUpdate can be called at specific times in the layout routine to indicate progress through the layout. In particular, progressUpdate should be called once at the start of the layout with a progress of 0.0 and at the end of the layout with a progress of 1.0. Other calls with progress values should be layout routine specific.

Parameters:
progress - a double between 0.0 and 1.0.

getDocument

public JGoDocument getDocument()
Returns the AutoLayout's JGoDocument.


setDocument

public void setDocument(JGoDocument d)
Sets the AutoLayout's JGoDocument to d. If getNetwork() is null, this also creates a JGoNetwork for the document and calls setNetwork.

Parameters:
d - the new value for the document

getNetwork

public JGoNetwork getNetwork()
Returns the AutoLayout's JGoNetwork.


setNetwork

public void setNetwork(JGoNetwork n)
Sets the AutoLayout's JGoNetwork to n.

Parameters:
n - the new value for the network