diva.graph.layout
Class RandomIncrLayout

java.lang.Object
  extended by diva.graph.layout.RandomIncrLayout
All Implemented Interfaces:
GlobalLayout, IncrementalLayout

public class RandomIncrLayout
extends java.lang.Object
implements IncrementalLayout

Randomly place newly-added nodes within the target viewport. This class tries to be smart by not placing nodes on top of one another if possible, but doesn't guarantee anything about the layout except that it will fall into the required viewport.

Version:
$Id: RandomIncrLayout.java 40814 2006-02-11 17:24:01Z cxh $
Author:
Michael Shilman
Accepted Rating:
Red

Field Summary
private  RandomLayout _global
           
private static int NUM_ITER
           
 
Constructor Summary
RandomIncrLayout(LayoutTarget target)
          Construct a random layout that lays out in the context of the given layout target.
 
Method Summary
 void edgeDrawn(java.lang.Object edge)
          Called in response to the given edge being drawn.
 void edgeRouted(java.lang.Object edge)
          Called in response to the connector representing the given edge being rereouted.
 LayoutTarget getLayoutTarget()
          Return the layout target.
 void layout(java.lang.Object composite)
          Layout the graph model in the viewport specified by the layout target environment.
 void nodeDrawn(java.lang.Object node)
          Lay out the given node randomly, trying not to overlap it with existing nodes.
 void nodeMoved(java.lang.Object node)
          Called in response to the figure representing the given node being moved.
 void setLayoutTarget(LayoutTarget target)
          Set the layout target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_global

private RandomLayout _global

NUM_ITER

private static final int NUM_ITER
See Also:
Constant Field Values
Constructor Detail

RandomIncrLayout

public RandomIncrLayout(LayoutTarget target)
Construct a random layout that lays out in the context of the given layout target.

Method Detail

edgeDrawn

public void edgeDrawn(java.lang.Object edge)
Called in response to the given edge being drawn.

Specified by:
edgeDrawn in interface IncrementalLayout

edgeRouted

public void edgeRouted(java.lang.Object edge)
Called in response to the connector representing the given edge being rereouted.

Specified by:
edgeRouted in interface IncrementalLayout

nodeDrawn

public void nodeDrawn(java.lang.Object node)
Lay out the given node randomly, trying not to overlap it with existing nodes.

Specified by:
nodeDrawn in interface IncrementalLayout

nodeMoved

public void nodeMoved(java.lang.Object node)
Called in response to the figure representing the given node being moved.

Specified by:
nodeMoved in interface IncrementalLayout

getLayoutTarget

public LayoutTarget getLayoutTarget()
Return the layout target.

Specified by:
getLayoutTarget in interface GlobalLayout

setLayoutTarget

public void setLayoutTarget(LayoutTarget target)
Set the layout target.

Specified by:
setLayoutTarget in interface GlobalLayout

layout

public void layout(java.lang.Object composite)
Layout the graph model in the viewport specified by the layout target environment.

Specified by:
layout in interface GlobalLayout