org.jgraph.layout
Class MoenLayoutAlgorithm

java.lang.Object
  extended byorg.jgraph.layout.JGraphLayoutAlgorithm
      extended byorg.jgraph.layout.MoenLayoutAlgorithm

public class MoenLayoutAlgorithm
extends JGraphLayoutAlgorithm


Field Summary
static java.lang.Object CELL_WRAPPER
          layout,attachParent,layoutLeaf,join,merge,offset and bridge methods below were taken line by line from Moen's algorithm.
protected  int childParentDistance
           
static int DEFAULT_ORIENTATION
           
static int LEFT_TO_RIGHT
           
protected  int orientation
           
static int UP_TO_DOWN
           
 
Fields inherited from class org.jgraph.layout.JGraphLayoutAlgorithm
LAYOUT_ATTRIBUTES
 
Constructor Summary
MoenLayoutAlgorithm()
           
 
Method Summary
protected  void attachParent(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode t, int h)
           
protected  org.jgraph.layout.MoenLayoutAlgorithm.PolyLine bridge(org.jgraph.layout.MoenLayoutAlgorithm.PolyLine line1, int x1, int y1, org.jgraph.layout.MoenLayoutAlgorithm.PolyLine line2, int x2, int y2)
           
protected  void buildLayoutHelperTree(java.util.Collection roots)
           
 JGraphLayoutSettings createSettings()
          Returns an new instance of SugiyamaLayoutSettings
protected  void decorateNode(VertexView node)
           
protected  void display(java.util.Collection roots)
           
protected  void displayHelper(VertexView view)
           
protected  java.util.List getChildren(VertexView node)
           
 java.lang.String getHint()
          Get a human readable hint for using this layout.
protected  java.util.ArrayList getRootVertices(java.lang.Object[] selectedCells)
          If it is a Vertex and it has no source, it must be a root vertex.
protected  org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode getTreeLayoutNode(VertexView view)
           
protected  org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode getTreeLayoutNode(VertexView view, boolean createIfNotPresent)
           
protected  int join(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode t)
           
protected  void layout(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode t)
           
protected  void layoutLeaf(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode t)
           
protected  void layoutTrees(java.util.Collection roots)
           
protected  void leftRightNodeLayout(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode node, int off_x, int off_y)
           
protected  int merge(org.jgraph.layout.MoenLayoutAlgorithm.Polygon c1, org.jgraph.layout.MoenLayoutAlgorithm.Polygon c2)
           
protected  int offset(int p1, int p2, int a1, int a2, int b1, int b2)
           
 void run(JGraph graph, java.lang.Object[] dynamic_cells, java.lang.Object[] static_cells)
          This method assumes the graph describes a tree structure.
 void setChildParentDistance(int distance)
           
 void setLayoutOrientation(int orientation)
           
 java.lang.String toString()
          Returns the name of this algorithm in human readable form.
protected  void upDownNodeLayout(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode node, int off_x, int off_y)
           
 
Methods inherited from class org.jgraph.layout.JGraphLayoutAlgorithm
applyLayout, applyLayout, createDialog, createDialog, getMaximumProgress, getProgress, isAllowedToRun, populateDialog, run, setAllowedToRun, setMaximumProgress, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CELL_WRAPPER

public static final java.lang.Object CELL_WRAPPER
layout,attachParent,layoutLeaf,join,merge,offset and bridge methods below were taken line by line from Moen's algorithm. Attempts to understand the above methods without reading the paper first are strongly discouraged. http://www.computer.org/software/so1990/s4021abs.htm


LEFT_TO_RIGHT

public static final int LEFT_TO_RIGHT
See Also:
Constant Field Values

UP_TO_DOWN

public static final int UP_TO_DOWN
See Also:
Constant Field Values

DEFAULT_ORIENTATION

public static final int DEFAULT_ORIENTATION
See Also:
Constant Field Values

orientation

protected int orientation

childParentDistance

protected int childParentDistance
Constructor Detail

MoenLayoutAlgorithm

public MoenLayoutAlgorithm()
Method Detail

toString

public java.lang.String toString()
Returns the name of this algorithm in human readable form.


getHint

public java.lang.String getHint()
Get a human readable hint for using this layout.

Overrides:
getHint in class JGraphLayoutAlgorithm

createSettings

public JGraphLayoutSettings createSettings()
Returns an new instance of SugiyamaLayoutSettings

Overrides:
createSettings in class JGraphLayoutAlgorithm

setLayoutOrientation

public void setLayoutOrientation(int orientation)

setChildParentDistance

public void setChildParentDistance(int distance)

layout

protected void layout(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode t)

attachParent

protected void attachParent(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode t,
                            int h)

layoutLeaf

protected void layoutLeaf(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode t)

join

protected int join(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode t)

merge

protected int merge(org.jgraph.layout.MoenLayoutAlgorithm.Polygon c1,
                    org.jgraph.layout.MoenLayoutAlgorithm.Polygon c2)

offset

protected int offset(int p1,
                     int p2,
                     int a1,
                     int a2,
                     int b1,
                     int b2)

bridge

protected org.jgraph.layout.MoenLayoutAlgorithm.PolyLine bridge(org.jgraph.layout.MoenLayoutAlgorithm.PolyLine line1,
                                                                int x1,
                                                                int y1,
                                                                org.jgraph.layout.MoenLayoutAlgorithm.PolyLine line2,
                                                                int x2,
                                                                int y2)

leftRightNodeLayout

protected void leftRightNodeLayout(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode node,
                                   int off_x,
                                   int off_y)

upDownNodeLayout

protected void upDownNodeLayout(org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode node,
                                int off_x,
                                int off_y)

run

public void run(JGraph graph,
                java.lang.Object[] dynamic_cells,
                java.lang.Object[] static_cells)
This method assumes the graph describes a tree structure. It does not test to see if the graph is a network. Use extreme caution if applyToAll parameter is set to false and only the selected cells are to be used. In the set of selected cells, any vertex with no source edge in the set will be considered to be a tree root. This will work fine as long as all tree vertices in the set that are a child of a tree vertex in the set are connected by a path of edges to that parent tree vertex (I think).

Specified by:
run in class JGraphLayoutAlgorithm
Parameters:
graph - JGraph instance
dynamic_cells - List of all nodes the layout should move
static_cells - List of node the layout should not move but allow for

getRootVertices

protected java.util.ArrayList getRootVertices(java.lang.Object[] selectedCells)
If it is a Vertex and it has no source, it must be a root vertex. !!!todo I will need to enforce that there is always at least one vertex, and that is the acq portal.

Returns:
all the tree root vertices

getChildren

protected java.util.List getChildren(VertexView node)

layoutTrees

protected void layoutTrees(java.util.Collection roots)

buildLayoutHelperTree

protected void buildLayoutHelperTree(java.util.Collection roots)

decorateNode

protected void decorateNode(VertexView node)

getTreeLayoutNode

protected org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode getTreeLayoutNode(VertexView view)

getTreeLayoutNode

protected org.jgraph.layout.MoenLayoutAlgorithm.TreeLayoutNode getTreeLayoutNode(VertexView view,
                                                                                 boolean createIfNotPresent)

display

protected void display(java.util.Collection roots)

displayHelper

protected void displayHelper(VertexView view)