Top Description Fields Constructors Methods
org.abego.treelayout.util

public Class DefaultConfiguration<TreeNode>

extends Object
implements Configuration<TreeNode>
Class Inheritance
All Implemented Interfaces
org.abego.treelayout.Configuration
Type Parameters
<TreeNode>
Type of elements used as nodes in the tree
Static Imports
org.abego.treelayout.internal.util.Contract.checkArg

Specify a Configuration through configurable parameters, or falling back to some frequently used defaults.
Author
Udo Borkowski ([email protected])

Field Summary

Modifier and TypeField and Description
private Configuration.AlignmentInLevel
private final double
private final double
private final Configuration.Location

Constructor Summary

AccessConstructor and Description
public
DefaultConfiguration(double
 
gapBetweenLevels
,
double
 
gapBetweenNodes
,
Configuration.Location
[default: Top]
location
,
Configuration.AlignmentInLevel
[default: Center]
alignmentInLevel
)

Specifies the constants to be used for this Configuration.

public
DefaultConfiguration(double
 
gapBetweenLevels
,
double
 
gapBetweenNodes
,
Configuration.Location
 
location
)

Convenience constructor, using a default for the alignmentInLevel.

public
DefaultConfiguration(double
 
gapBetweenLevels
,
double
 
gapBetweenNodes
)

Convenience constructor, using a default for the rootLocation and the alignmentInLevel.

Method Summary

Modifier and TypeMethod and Description
public Configuration.AlignmentInLevel
getAlignmentInLevel()

Implements org.abego.treelayout.Configuration.getAlignmentInLevel.

Returns the alignment of "smaller" nodes within a level.
public double
getGapBetweenLevels(int
[nextLevel > 0]
nextLevel
)

Implements org.abego.treelayout.Configuration.getGapBetweenLevels.

Returns the size of the gap between subsequent levels.
public double
getGapBetweenNodes(TreeNode
 
node1
,
TreeNode
 
node2
)

Implements org.abego.treelayout.Configuration.getGapBetweenNodes.

Returns the size of the minimal gap of nodes within a level.
public Configuration.Location
getRootLocation()

Implements org.abego.treelayout.Configuration.getRootLocation.

Returns the position of the root node in the diagram.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

alignmentInLevelback to summary
private Configuration.AlignmentInLevel alignmentInLevel
gapBetweenLevelsback to summary
private final double gapBetweenLevels
gapBetweenNodesback to summary
private final double gapBetweenNodes
locationback to summary
private final Configuration.Location location

Constructor Detail

DefaultConfigurationback to summary
public DefaultConfiguration(double gapBetweenLevels, double gapBetweenNodes, Configuration.Location location, Configuration.AlignmentInLevel alignmentInLevel)

Specifies the constants to be used for this Configuration.

Parameters
gapBetweenLevels:double

 

gapBetweenNodes:double

 

location:Configuration.Location

[default: Top]

alignmentInLevel:Configuration.AlignmentInLevel

[default: Center]

DefaultConfigurationback to summary
public DefaultConfiguration(double gapBetweenLevels, double gapBetweenNodes, Configuration.Location location)

Convenience constructor, using a default for the alignmentInLevel.

see DefaultConfiguration(double, double, org.abego.treelayout.Configuration.Location, org.abego.treelayout.Configuration.AlignmentInLevel)

Parameters
gapBetweenLevels:double

 

gapBetweenNodes:double

 

location:Configuration.Location

 

DefaultConfigurationback to summary
public DefaultConfiguration(double gapBetweenLevels, double gapBetweenNodes)

Convenience constructor, using a default for the rootLocation and the alignmentInLevel.

see DefaultConfiguration(double, double, org.abego.treelayout.Configuration.Location, org.abego.treelayout.Configuration.AlignmentInLevel)

Parameters
gapBetweenLevels:double

 

gapBetweenNodes:double

 

Method Detail

getAlignmentInLevelback to summary
public Configuration.AlignmentInLevel getAlignmentInLevel()

Implements org.abego.treelayout.Configuration.getAlignmentInLevel.

Doc from org.abego.treelayout.Configuration.getAlignmentInLevel.

Returns the alignment of "smaller" nodes within a level.

By default all nodes of one level are centered in the level. However one may also align them "towards the root" or "away from the root". When the root is located at the top this means the nodes are aligned "to the top of the level" or "to the bottom of the level".

Alignment in level when root is at the top
Center (Default) TowardsRoot ("top of level") AwayFromRoot ("bottom of level")
Tree with root at top and nodes center aligned Tree with root at top and nodes aligned to top Tree with root at top and nodes aligned to bottom

Alignment in level when root is at the left:

Table: Possible Alignments of Nodes (when root at left side)
Center (Default) TowardsRoot ("left of level") AwayFromRoot
("right of level")
Tree with root at left side and nodes center aligned Tree with root at left side and nodes left aligned Tree with root at left side and nodes right aligned

Of cause the alignment also works when the root is at the bottom or at the right side.

Returns:Configuration.AlignmentInLevel

the alignment of "smaller" nodes within a level

Annotations
@Override
getGapBetweenLevelsback to summary
public double getGapBetweenLevels(int nextLevel)

Implements org.abego.treelayout.Configuration.getGapBetweenLevels.

Doc from org.abego.treelayout.Configuration.getGapBetweenLevels.

Returns the size of the gap between subsequent levels.

gapBetweenLevels Visualization

Parameters
nextLevel:int

[nextLevel > 0]

Returns:double

the size of the gap between level (nextLevel-1) and nextLevel [result >= 0]

Annotations
@Override
getGapBetweenNodesback to summary
public double getGapBetweenNodes(TreeNode node1, TreeNode node2)

Implements org.abego.treelayout.Configuration.getGapBetweenNodes.

Doc from org.abego.treelayout.Configuration.getGapBetweenNodes.

Returns the size of the minimal gap of nodes within a level.

In the layout there will be a gap of at least the returned size between both given nodes.

gapBetweenNodes Visualization

node1 and node2 are at the same level and are placed next to each other.

Parameters
node1:TreeNode

 

node2:TreeNode

 

Returns:double

the minimal size of the gap between node1 and node2 [result >= 0]

Annotations
@Override
getRootLocationback to summary
public Configuration.Location getRootLocation()

Implements org.abego.treelayout.Configuration.getRootLocation.

Doc from org.abego.treelayout.Configuration.getRootLocation.

Returns the position of the root node in the diagram.

By default the root of the tree is located at the top of the diagram. However one may also put it at the left, right or bottom of the diagram.

Possible Root Positions
Top (Default) Left Right Bottom
Tree with root at top Tree with root at left side Tree with root at right side Tree with root at bottom
Returns:Configuration.Location

the position of the root node in the diagram

Annotations
@Override