|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgraph.layout.JGraphLayoutAlgorithm
org.jgraph.layout.SugiyamaLayoutAlgorithm
Arranges the nodes with the Sugiyama Layout Algorithm.
Link to the algorithm
Field Summary | |
protected boolean |
flushToOrigin
Controls whether the graph should be placed as close to the origin as possible. |
protected int |
gridAreaSize
represents the size of the grid in horizontal grid elements |
protected java.awt.Point |
spacing
The default grid spacing is (250, 150). |
static java.lang.String |
SUGIYAMA_CELL_WRAPPER
Const to add the Cell Wrapper to the Nodes |
static java.lang.String |
SUGIYAMA_SELECTED
Const to add Attributes at the Nodes indicating that the cell was explicitly specified to the layout. |
static java.lang.String |
SUGIYAMA_VISITED
Const to add Attributes at the Nodes |
protected boolean |
vertical
The default layout direction is vertical (top-down) |
Fields inherited from class org.jgraph.layout.JGraphLayoutAlgorithm |
LAYOUT_ATTRIBUTES |
Constructor Summary | |
SugiyamaLayoutAlgorithm()
|
Method Summary | |
JGraphLayoutSettings |
createSettings()
Returns an new instance of SugiyamaLayoutSettings |
protected void |
drawGraph(JGraph jgraph,
java.util.List levels,
java.awt.Point min,
java.awt.Point spacing)
This Method draws the graph. |
protected java.util.List |
fillLevels(JGraph jgraph,
CellView[] selectedCellViews,
java.util.List rootVertexViews)
Method fills the levels and stores them in the member levels. |
protected void |
fillLevels(JGraph jgraph,
java.util.List levels,
int level,
VertexView vertexView)
Fills the Vector for the specified level with a wrapper for the MyGraphCell. |
protected java.awt.Point |
findMinimumAndSpacing(CellView[] graphCellViews,
java.awt.Point spacing)
calculates the minimum for the paint area. |
boolean |
getFlushToOrigin()
Get the FlushToOrigin value. |
java.lang.String |
getHint()
Get a human readable hint for using this layout. |
java.awt.Point |
getSpacing()
Returns the spacing. |
protected boolean |
isSelected(GraphLayoutCache cache,
java.lang.Object cell)
Detects whether the specified cell has been marked selected. |
boolean |
isVertical()
Returns the current layout direction |
protected void |
markSelected(CellView[] selectedCellViews,
boolean addMark)
Adds an attribute SUGIYAMA_SELECTED to the specified selected cell views. |
protected boolean |
move(boolean toRight,
java.util.List currentLevel,
int currentIndexInTheLevel,
int currentPriority)
|
protected void |
moveToBarycenter(JGraph jgraph,
CellView[] allSelectedViews,
java.util.List levels)
|
protected int |
moveToBarycenter(JGraph jgraph,
java.util.List levels,
int levelIndex)
|
void |
run(JGraph graph,
java.lang.Object[] dynamic_cells,
java.lang.Object[] static_cells)
Implementation. |
protected java.util.List |
searchRoots(JGraph jgraph,
CellView[] selectedCellViews)
Searches all Roots for the current Graph First the method marks any Node as not visited. |
protected void |
searchRoots(JGraph jgraph,
VertexView vertexViewToInspect,
java.util.List roots)
Searches Roots for the current Cell. |
void |
setFlushToOrigin(boolean newFlushToOrigin)
After layout, moves the graph as close to origin as possible. |
void |
setSpacing(java.awt.Point spacing)
Sets grid spacing. |
void |
setVertical(boolean vertical)
Sets the layout direction. |
protected int |
solveEdgeCrosses(JGraph jgraph,
boolean down,
java.util.List levels,
int levelIndex)
|
protected void |
solveEdgeCrosses(JGraph jgraph,
java.util.List levels)
|
java.lang.String |
toString()
Returns the name of this algorithm in human readable form. |
protected void |
updateProgress4Movements()
Updates the progress based on the movements count |
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 |
public static final java.lang.String SUGIYAMA_VISITED
public static final java.lang.String SUGIYAMA_CELL_WRAPPER
public static final java.lang.String SUGIYAMA_SELECTED
#run(org.jgraph.JGraph,Object[],Object[])
,
Constant Field Valuesprotected int gridAreaSize
protected boolean vertical
protected java.awt.Point spacing
protected boolean flushToOrigin
Constructor Detail |
public SugiyamaLayoutAlgorithm()
Method Detail |
public JGraphLayoutSettings createSettings()
createSettings
in class JGraphLayoutAlgorithm
public java.lang.String toString()
public java.lang.String getHint()
getHint
in class JGraphLayoutAlgorithm
public void run(JGraph graph, java.lang.Object[] dynamic_cells, java.lang.Object[] static_cells)
levels
.
The Member levels contains Vector Objects and the Vector per level
contains Cell Wrapper Objects. After that the Algorithm
tries to solve the edge crosses from level to level and
goes top down and bottom up. After minimization of the
edge crosses the algorithm moves each node to its
bary center. Last but not Least the method draws the Graph.
run
in class JGraphLayoutAlgorithm
graph
- JGraph instancedynamic_cells
- List of all nodes the layout should movestatic_cells
- List of node the layout should not move but allow forLayoutAlgorithm
protected void markSelected(CellView[] selectedCellViews, boolean addMark)
SUGIYAMA_SELECTED
to the specified selected cell views.
selectedCellViews
- the specified cell viewsaddMark
- true to add the mark, false to remove the markprotected boolean isSelected(GraphLayoutCache cache, java.lang.Object cell)
cell
- the cell to inspect
markSelected(CellView[], boolean)
protected java.util.List searchRoots(JGraph jgraph, CellView[] selectedCellViews)
searchRoots(JGraph, CellView[])
protected void searchRoots(JGraph jgraph, VertexView vertexViewToInspect, java.util.List roots)
protected java.util.List fillLevels(JGraph jgraph, CellView[] selectedCellViews, java.util.List rootVertexViews)
levels
Vector.
protected void fillLevels(JGraph jgraph, java.util.List levels, int level, VertexView vertexView)
level
- The level for the graphCellprotected java.awt.Point findMinimumAndSpacing(CellView[] graphCellViews, java.awt.Point spacing)
protected void updateProgress4Movements()
protected void solveEdgeCrosses(JGraph jgraph, java.util.List levels)
protected int solveEdgeCrosses(JGraph jgraph, boolean down, java.util.List levels, int levelIndex)
protected void moveToBarycenter(JGraph jgraph, CellView[] allSelectedViews, java.util.List levels)
protected int moveToBarycenter(JGraph jgraph, java.util.List levels, int levelIndex)
protected boolean move(boolean toRight, java.util.List currentLevel, int currentIndexInTheLevel, int currentPriority)
toRight
- true = try to move the currentWrapper to right; false = try to move the currentWrapper to left;currentLevel
- List which contains the CellWrappers for the current levelcurrentIndexInTheLevel
- currentPriority
-
protected void drawGraph(JGraph jgraph, java.util.List levels, java.awt.Point min, java.awt.Point spacing)
public java.awt.Point getSpacing()
setSpacing(java.awt.Point)
public void setSpacing(java.awt.Point spacing)
public boolean isVertical()
setVertical(boolean)
public void setVertical(boolean vertical)
vertical
- true for vertical and false for horizontal directionpublic final boolean getFlushToOrigin()
FlushToOrigin
value.
boolean
valuesetFlushToOrigin(boolean)
public final void setFlushToOrigin(boolean newFlushToOrigin)
After the layout has complete, this algorithm calculates the minimum X and Y coordinates over all selected cells. If flushToOrigin parameter is set to false, the algorithm will place cells starting at coordinates corresponding to those minimum values.
If set to true, the layout will place cells starting at the origin, possibly shrinking the overall graph canvas size
newFlushToOrigin
- The new FlushToOrigin value.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |