gumbo.visualize.data.layout
Class GraphLayoutWholeView

java.lang.Object
  |
  +--gumbo.visualize.data.layout.GraphLayoutWholeView
All Implemented Interfaces:
LayoutView, LayoutWhole, LayoutWholeView
Direct Known Subclasses:
KinkyGraphLayoutWholeView

public class GraphLayoutWholeView
extends java.lang.Object
implements LayoutWholeView

A base class for whole layout views used for graph layouts. Intended as input to a graph layout engine. As a layout part container, it only contains parts that directly correspond to the associated data model. Additional parts used for layout (e.g. kink nodes) should not be added.

Version:
$Revision: 1.12 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.

Constructor Summary
GraphLayoutWholeView(WholeView view)
           
 
Method Summary
protected  void addLayoutPart(GraphLayoutPart part)
          Used by the system to add a new layout part to this whole.
 void doRandomEdgeLayout(AxisBound3 bound)
          Randomly distributes the graph edges in the graphic world space within the specified bounds.
 void doRandomLayout(AxisBound3 bound)
          Randomly distributes the graph vertices and edges in the graphic world space within the specified bounds.
 void doRandomVertexLayout(AxisBound3 bound)
          Randomly distributes the graph vertices in the graphic world space within the specified bounds.
 DataView getDataView()
          Gets the data view associated with this layout view.
 java.util.Collection getEdges()
          Gets an immutable view of the layout parts in this whole associated with graph model edges.
 java.util.Collection getLayoutParts(java.util.Collection retVal)
          Gets the layout parts in this whole.
 java.util.Set getNodes()
          Gets an immutable view of the layout parts in this whole associated with layout nodes.
 AxisBound3 getPartsGraphicBound(AxisBound3 retVal)
          Returns the smallest bounds containing all of the parts in this whole, in graphic space.
 AxisBound3 getPartsLayoutBound(AxisBound3 retVal)
          Returns the smallest bounds containing all of the parts in this whole, in layout space.
 java.util.Collection getVertices()
          Gets an immutable view of the layout parts in this whole associated with graph model vertices.
 AxisBound3 getWholeGraphicBound(AxisBound3 retVal)
          Gets the largest bound allowed by the whole space, in graphic space.
 AxisBound3 getWholeLayoutBound(AxisBound3 retVal)
          Gets the largest bound allowed by the whole space, in layout space.
 void initLayoutWhole()
          Clears all layout parts and adds new ones according to the associated whole view's graph model.
protected  GraphLayoutEdge newLayoutEdge(PartView view)
          Used by the system to creates a new layout edge.
protected  GraphLayoutVertex newLayoutVertex(PartView view)
          Used by the system to creates a new layout vertex.
protected  void removeLayoutPart(GraphLayoutPart part)
          Used by the system to remove an old layout part from this whole.
 void validateLayoutDisplay(LayoutGraphicTransform xform)
          Called by layout engines to prepare and realize the display state of the graphic view associated with this layout view and any of its dependent layout views, possibly recusively.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphLayoutWholeView

public GraphLayoutWholeView(WholeView view)
Parameters:
view - The target whole view. Represents the data model and whole graphic view used for layout input and display. Never null.
Method Detail

newLayoutVertex

protected GraphLayoutVertex newLayoutVertex(PartView view)
Used by the system to creates a new layout vertex. Override to create a different flavor of vertex.

Parameters:
view - The associated part view. Never null.

newLayoutEdge

protected GraphLayoutEdge newLayoutEdge(PartView view)
Used by the system to creates a new layout edge. Override to create a different flavor of edge.

Parameters:
view - The associated part view. Never null.

addLayoutPart

protected void addLayoutPart(GraphLayoutPart part)
Used by the system to add a new layout part to this whole.

Parameters:
part - Layout part to be added to this whole. Ignored if null or unrecognized.

removeLayoutPart

protected void removeLayoutPart(GraphLayoutPart part)
Used by the system to remove an old layout part from this whole.

Parameters:
part - Layout part to be removed from this whole. Ignored if null or unrecognized.

initLayoutWhole

public void initLayoutWhole()
Clears all layout parts and adds new ones according to the associated whole view's graph model. The new parts will be initialized with the static graph topology imposed by the associated graph model. Should be called prior to performing each layout since the previous layout may have change the part states (e.g. kink nodes added to layout edges) or the whole model state may have changed.

Throws:
java.lang.IllegalArgumentException - if a layout part cannot be created and added to this layout whole as a result of an incompatibility in the associated data model or graphic views.

getNodes

public java.util.Set getNodes()
Gets an immutable view of the layout parts in this whole associated with layout nodes. Assumes initLayoutWhole() has been called recently.

Returns:
Reference to a collection of parts (GraphLayoutNode).

getVertices

public java.util.Collection getVertices()
Gets an immutable view of the layout parts in this whole associated with graph model vertices. Assumes initLayoutWhole() has been called recently.

Returns:
Reference to a collection of parts (GraphLayoutVertex).

getEdges

public java.util.Collection getEdges()
Gets an immutable view of the layout parts in this whole associated with graph model edges. Assumes initLayoutWhole() has been called recently.

Returns:
Reference to a collection of parts (GraphLayoutEdge).

doRandomVertexLayout

public void doRandomVertexLayout(AxisBound3 bound)
Randomly distributes the graph vertices in the graphic world space within the specified bounds. Assumes initLayoutWhole() has been called recently.


doRandomEdgeLayout

public void doRandomEdgeLayout(AxisBound3 bound)
Randomly distributes the graph edges in the graphic world space within the specified bounds. Assumes initLayoutWhole() has been called recently.


doRandomLayout

public void doRandomLayout(AxisBound3 bound)
Randomly distributes the graph vertices and edges in the graphic world space within the specified bounds. Assumes initLayoutWhole() has been called recently.


getDataView

public final DataView getDataView()
Description copied from interface: LayoutView
Gets the data view associated with this layout view.

Specified by:
getDataView in interface LayoutView
Returns:
Reference to the data view. The data view graphic must be a GraphicPresence. Never null.

validateLayoutDisplay

public void validateLayoutDisplay(LayoutGraphicTransform xform)
Description copied from interface: LayoutView
Called by layout engines to prepare and realize the display state of the graphic view associated with this layout view and any of its dependent layout views, possibly recusively. Includes transforming the layout state from layout to graphic space, transferring the layout graphic state to the graphic, and realizing the graphic's display state. For whole layout views, calls validateLayoutDisplay() on each of its layout view parts.

Specified by:
validateLayoutDisplay in interface LayoutView
Parameters:
xform - Transform between layout and graphic space. Never null.

getLayoutParts

public java.util.Collection getLayoutParts(java.util.Collection retVal)
Description copied from interface: LayoutWhole
Gets the layout parts in this whole.

Specified by:
getLayoutParts in interface LayoutWhole
Returns:
Reference to retVal. Never null.

getPartsLayoutBound

public AxisBound3 getPartsLayoutBound(AxisBound3 retVal)
Description copied from interface: LayoutWhole
Returns the smallest bounds containing all of the parts in this whole, in layout space.

Specified by:
getPartsLayoutBound in interface LayoutWhole
Parameters:
retVal - Return value object. Never null.
Returns:
Reference to retVal. Never null.

getWholeLayoutBound

public AxisBound3 getWholeLayoutBound(AxisBound3 retVal)
Description copied from interface: LayoutWhole
Gets the largest bound allowed by the whole space, in layout space.

Specified by:
getWholeLayoutBound in interface LayoutWhole
Parameters:
retVal - Return value object. Never null.
Returns:
Reference to retVal. Never null.

getPartsGraphicBound

public AxisBound3 getPartsGraphicBound(AxisBound3 retVal)
Description copied from interface: LayoutWholeView
Returns the smallest bounds containing all of the parts in this whole, in graphic space.

Specified by:
getPartsGraphicBound in interface LayoutWholeView
Parameters:
retVal - Return value object. Never null.
Returns:
Reference to retVal. Never null.

getWholeGraphicBound

public AxisBound3 getWholeGraphicBound(AxisBound3 retVal)
Description copied from interface: LayoutWholeView
Gets the largest bound allowed by the whole space, in graphic space.

Specified by:
getWholeGraphicBound in interface LayoutWholeView
Parameters:
retVal - Return value object. Never null.
Returns:
Reference to retVal. Never null.