public class TreeLayoutAlgorithm extends java.lang.Object implements ILayoutAlgorithm
Modifier and Type | Field and Description |
---|---|
static int |
BOTTOM_UP
Tree direction constant for which root is placed at the bottom and
branches spread upwards
|
static int |
LEFT_RIGHT
Tree direction constant for which root is placed at the left and branches
spread to the right
|
static int |
RIGHT_LEFT
Tree direction constant for which root is placed at the right and
branches spread to the left
|
static int |
TOP_DOWN
Tree direction constant for which root is placed at the top and branches
spread downwards
|
Constructor and Description |
---|
TreeLayoutAlgorithm()
Create a default Tree Layout.
|
TreeLayoutAlgorithm(int direction)
Create a Tree Layout with a specified direction.
|
TreeLayoutAlgorithm(int direction,
Dimension nodeSpace)
Create a Tree Layout with fixed size spacing around nodes.
|
Modifier and Type | Method and Description |
---|---|
void |
applyLayout(boolean clean)
Makes this algorithm perform layout computation and apply it to its
context.
|
int |
getDirection()
Returns the direction of this
TreeLayoutAlgorithm . |
ILayoutContext |
getLayoutContext()
Returns the previously set
ILayoutContext . |
boolean |
isResizing() |
void |
setDirection(int direction)
Changes the direction of this
TreeLayoutAlgorithm to the given
value. |
void |
setLayoutContext(ILayoutContext context)
Sets the layout context for this algorithm.
|
void |
setNodeSpace(Dimension nodeSpace) |
void |
setResizing(boolean resizing) |
java.lang.String |
toString() |
public static final int TOP_DOWN
public static final int BOTTOM_UP
public static final int LEFT_RIGHT
public static final int RIGHT_LEFT
public TreeLayoutAlgorithm()
public TreeLayoutAlgorithm(int direction)
direction
- The direction, one of BOTTOM_UP
,
LEFT_RIGHT
,
RIGHT_LEFT
,
TOP_DOWN
public TreeLayoutAlgorithm(int direction, Dimension nodeSpace)
direction
- The direction, one of BOTTOM_UP
,
LEFT_RIGHT
,
RIGHT_LEFT
,
TOP_DOWN
nodeSpace
- the size to make each node. May be null.public void setNodeSpace(Dimension nodeSpace)
nodeSpace
- the nodeSpace size to setpublic int getDirection()
TreeLayoutAlgorithm
.TreeLayoutAlgorithm
.public void setDirection(int direction)
TreeLayoutAlgorithm
to the given
value. The direction may either be TOP_DOWN
, BOTTOM_UP
,
LEFT_RIGHT
, or RIGHT_LEFT
.direction
- The new direction for this TreeLayoutAlgorithm
.public boolean isResizing()
public void setResizing(boolean resizing)
resizing
- true if this algorithm should resize elements (default is
false)public void setLayoutContext(ILayoutContext context)
ILayoutAlgorithm
setLayoutContext
in interface ILayoutAlgorithm
context
- a new layout context or null if this algorithm should not
perform any layoutpublic ILayoutContext getLayoutContext()
ILayoutAlgorithm
ILayoutContext
.getLayoutContext
in interface ILayoutAlgorithm
ILayoutContext
public void applyLayout(boolean clean)
ILayoutAlgorithm
applyLayout
in interface ILayoutAlgorithm
clean
- if true the receiver should assume that the layout context has
changed significantly and recompute the whole layout even if
it keeps track of changes with listeners. False can be used
after dynamic layout in a context is turned back on so that
layout algorithm working in background can apply accumulated
changes. Static layout algorithm can ignore this call entirely
if clean is false.public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2014 itemis AG and others. All rights reserved.