public class JGraphCompactTreeLayout extends JGraphAbstractTreeLayout
Modifier and Type | Class and Description |
---|---|
protected class |
JGraphCompactTreeLayout.CompactTreeNode
Abstraction of node in a tree structure
|
JGraphAbstractTreeLayout.TreeNode
JGraphLayout.Stoppable
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ORIENTATION
Deprecated.
use SwingConstants compass directions instead
|
static int |
LEFT_TO_RIGHT
Deprecated.
use SwingConstants.WEST instead
|
static int |
UP_TO_DOWN
Deprecated.
use SwingConstants.NORTH instead
|
graph, levelDistance, lowerLevelValues, nodeDistance, nodes, oldOrigin, orientation, positionMultipleTrees, routeTreeEdges, treeBoundary, treeDistance, upperLevelValues
VERSION
Constructor and Description |
---|
JGraphCompactTreeLayout()
Default constructor, sets level distance and orientation to defaults
|
Modifier and Type | Method and Description |
---|---|
protected void |
attachParent(JGraphCompactTreeLayout.CompactTreeNode t,
double h)
Attaches the specified tree node in a parent-child relationship taking
into account node shape
|
protected void |
branch(JGraphCompactTreeLayout.CompactTreeNode parent,
JGraphCompactTreeLayout.CompactTreeNode child,
JGraphCompactTreeLayout.CompactTreeNode sibling) |
protected com.jgraph.layout.tree.JGraphCompactTreeLayout.PolyLine |
bridge(com.jgraph.layout.tree.JGraphCompactTreeLayout.PolyLine line1,
double x1,
double y1,
com.jgraph.layout.tree.JGraphCompactTreeLayout.PolyLine line2,
double x2,
double y2) |
protected void |
dispatchResult(java.util.Collection treeLayoutNodes)
Sets the new positions of the cells in the graph based on the information
from the interal tree nodes.
|
double |
getChildParentDistance()
Deprecated.
use getLevelDistance
|
double |
getNodeBorder() |
int |
getOrientation() |
protected JGraphCompactTreeLayout.CompactTreeNode |
getTreeLayoutNode(java.lang.Object cell)
Obtains the mapped node from the internal tree representation used from
the cell specified
|
protected JGraphCompactTreeLayout.CompactTreeNode |
getTreeLayoutNode(java.lang.Object cell,
boolean createIfNotPresent)
Obtains the mapped node from the internal tree representation used from
the cell specified
|
protected double |
join(JGraphCompactTreeLayout.CompactTreeNode t)
joins the specified tree node
|
protected void |
layout(JGraphCompactTreeLayout.CompactTreeNode t)
Laids out the specified tree node in the internal tree representation
|
protected void |
layoutLeaf(JGraphCompactTreeLayout.CompactTreeNode t)
Laids out a tree node as a leaf, taking into account node shape
|
protected void |
layoutTree(JGraphCompactTreeLayout.CompactTreeNode root)
Top-level layout method for Moen
|
protected void |
leftRightNodeLayout(JGraphCompactTreeLayout.CompactTreeNode node,
double off_x,
double off_y)
Lays out a Moen in the left-right orientation
|
protected double |
merge(com.jgraph.layout.tree.JGraphCompactTreeLayout.Polygon c1,
com.jgraph.layout.tree.JGraphCompactTreeLayout.Polygon c2) |
protected double |
offset(double p1,
double p2,
double a1,
double a2,
double b1,
double b2) |
void |
run(JGraphFacade graph)
The run method of this layout that executes a Moen using the cell data
and configuration information in the specified facade It first builds a
representation of the tree using the inner tree class by doing a depth
first search of the graph from the root.
|
void |
setChildParentDistance(double distance)
Deprecated.
use setLevelDistance
|
void |
setNodeBorder(double nodeBorder) |
void |
setOrientation(int orientation)
SwingConstants.NORTH SwingConstants.WEST are valid inputs to this method
|
java.lang.String |
toString()
Returns
Compact Tree , the name of this algorithm. |
protected void |
unzip(JGraphCompactTreeLayout.CompactTreeNode node) |
protected void |
upDownNodeLayout(JGraphCompactTreeLayout.CompactTreeNode node,
JGraphCompactTreeLayout.CompactTreeNode parent,
double off_x,
double off_y)
Lays out a Moen in the up-down orientation
|
protected void |
zip(JGraphCompactTreeLayout.CompactTreeNode node) |
getLevelDistance, getNodeDistance, getRouteTreeEdges, getTreeDistance, isPositionMultipleTrees, setLevelDistance, setNodeDistance, setPositionMultipleTrees, setRouteTreeEdges, setTreeDistance
public static final int LEFT_TO_RIGHT
public static final int UP_TO_DOWN
public static final int DEFAULT_ORIENTATION
public JGraphCompactTreeLayout()
public void run(JGraphFacade graph)
run
in interface JGraphLayout
run
in class JGraphAbstractTreeLayout
graph
- the facade describing the graph and its configurationprotected void layoutTree(JGraphCompactTreeLayout.CompactTreeNode root)
root
- the root node of the treeprotected JGraphCompactTreeLayout.CompactTreeNode getTreeLayoutNode(java.lang.Object cell)
cell
- the cell whose TreeLayoutNode
is to be foundprotected JGraphCompactTreeLayout.CompactTreeNode getTreeLayoutNode(java.lang.Object cell, boolean createIfNotPresent)
cell
- the cell whose TreeLayoutNode
is to be foundcreateIfNotPresent
- whether or not to create the internal node if it doesn't
already existprotected void dispatchResult(java.util.Collection treeLayoutNodes)
treeLayoutNodes
- the nodes of the internal tree structure that describe the new
tree layoutprotected void layout(JGraphCompactTreeLayout.CompactTreeNode t)
t
- the node to be laid outprotected void attachParent(JGraphCompactTreeLayout.CompactTreeNode t, double h)
t
- the internal tree nodeprotected void layoutLeaf(JGraphCompactTreeLayout.CompactTreeNode t)
t
- the node to be laid outprotected double join(JGraphCompactTreeLayout.CompactTreeNode t)
t
- the tree node to be joinedprotected double merge(com.jgraph.layout.tree.JGraphCompactTreeLayout.Polygon c1, com.jgraph.layout.tree.JGraphCompactTreeLayout.Polygon c2)
c1
- c2
- protected double offset(double p1, double p2, double a1, double a2, double b1, double b2)
p1
- p2
- a1
- a2
- b1
- b2
- protected com.jgraph.layout.tree.JGraphCompactTreeLayout.PolyLine bridge(com.jgraph.layout.tree.JGraphCompactTreeLayout.PolyLine line1, double x1, double y1, com.jgraph.layout.tree.JGraphCompactTreeLayout.PolyLine line2, double x2, double y2)
line1
- x1
- y1
- line2
- x2
- y2
- PolyLine
protected void branch(JGraphCompactTreeLayout.CompactTreeNode parent, JGraphCompactTreeLayout.CompactTreeNode child, JGraphCompactTreeLayout.CompactTreeNode sibling)
protected void unzip(JGraphCompactTreeLayout.CompactTreeNode node)
protected void zip(JGraphCompactTreeLayout.CompactTreeNode node)
protected void leftRightNodeLayout(JGraphCompactTreeLayout.CompactTreeNode node, double off_x, double off_y)
node
- the current node being laid outoff_x
- x-axis offsetoff_y
- y-axis offsetprotected void upDownNodeLayout(JGraphCompactTreeLayout.CompactTreeNode node, JGraphCompactTreeLayout.CompactTreeNode parent, double off_x, double off_y)
node
- the current node being laid outparent
- the parent of the current nodeoff_x
- the total x-axis offset of the parent nodeoff_y
- the total y-axis offset of the parent nodepublic void setOrientation(int orientation)
setOrientation
in class JGraphAbstractTreeLayout
orientation
- public int getOrientation()
getOrientation
in class JGraphAbstractTreeLayout
public void setChildParentDistance(double distance)
distance
- the minimum distancepublic double getChildParentDistance()
public double getNodeBorder()
public void setNodeBorder(double nodeBorder)
nodeBorder
- The nodeBorder to set.public java.lang.String toString()
Compact Tree
, the name of this algorithm.toString
in class java.lang.Object
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.