public class SpaceTreeLayoutAlgorithm 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 |
---|
SpaceTreeLayoutAlgorithm()
Constructs an instance of
SpaceTreeLayoutAlgorithm that
places the root of a tree at the top of the graph. |
SpaceTreeLayoutAlgorithm(int direction)
Constructs an instance of
SpaceTreeLayoutAlgorithm that
places the root of a tree according to given direction |
Modifier and Type | Method and Description |
---|---|
void |
applyLayout(boolean clean)
Makes this algorithm perform layout computation and apply it to its
context.
|
double |
getBranchGap()
Returns the distance between branches.
|
int |
getDirection() |
double |
getLayerGap()
Returns the distance between layers.
|
LayoutContext |
getLayoutContext()
Returns the previously set
LayoutContext . |
double |
getLeafGap()
Returns the distance between leaf nodes.
|
void |
setBranchGap(double value)
Sets the distance between branches to the given value.
|
void |
setDirection(int direction)
Sets direction (placement) of the tree
|
void |
setLayerGap(double value)
Sets the distance between layers to the given value.
|
void |
setLayoutContext(LayoutContext context)
Sets the layout context for this algorithm.
|
void |
setLeafGap(double value)
Sets the distance between leaf nodes to the given value.
|
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 SpaceTreeLayoutAlgorithm()
SpaceTreeLayoutAlgorithm
that
places the root of a tree at the top of the graph.public SpaceTreeLayoutAlgorithm(int direction)
SpaceTreeLayoutAlgorithm
that
places the root of a tree according to given directiondirection
- direction of the tree, sould be one of the following:
TOP_DOWN
, BOTTOM_UP
, LEFT_RIGHT
,
RIGHT_LEFT
.public void setLeafGap(double value)
value
- The new distance between leaf nodes.public void setBranchGap(double value)
value
- The new distance between branches.public void setLayerGap(double value)
value
- The new distance between layers.public double getLeafGap()
public double getBranchGap()
public double getLayerGap()
public int getDirection()
public void setDirection(int direction)
direction
- direction of the tree, sould be one of the following:
TOP_DOWN
, BOTTOM_UP
, LEFT_RIGHT
,
RIGHT_LEFT
.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 void setLayoutContext(LayoutContext context)
ILayoutAlgorithm
setLayoutContext
in interface ILayoutAlgorithm
context
- a new layout context or null if this algorithm should not
perform any layoutpublic LayoutContext getLayoutContext()
ILayoutAlgorithm
LayoutContext
.getLayoutContext
in interface ILayoutAlgorithm
LayoutContext
Copyright (c) 2014 itemis AG and others. All rights reserved.