public class TreeComponentLayout extends Object implements ILayoutStage
TreeComponentLayout
arranges tree-like subgraph structures in a mixed layout style.
The tree components are marked
Modifier and Type | Field and Description |
---|---|
static NodeDpKey<Boolean> |
DUMMY_NODE_DPKEY
A
DataProvider key for identifying dummy nodes during the layout calculation
This IDataProvider is registered and also removed in
applyLayoutUsingDummies(LayoutGraph, IDataProvider) . |
Constructor and Description |
---|
TreeComponentLayout(ILayoutAlgorithm treeCoreLayouter)
Creates a new
TreeComponentLayout instance using the specified layouter for arranging the subtrees. |
Modifier and Type | Method and Description |
---|---|
void |
applyLayout(LayoutGraph graph)
Finds the tree components inside the given graph and applies a
tree layout to
them. |
protected void |
applyLayoutUsingDummies(LayoutGraph graph,
IDataProvider dummyDp)
Delegates the layout calculation to the
core layout algorithm and handles the dummy nodes. |
ILayoutAlgorithm |
getCoreLayout()
Gets the core layout algorithm.
|
ILayoutAlgorithm |
getTreeComponentCoreLayout()
Gets the layout algorithm that is applied to tree components.
|
boolean |
isOrientationOptimizationEnabled()
Gets whether or not tree component arrangement is improved by changing the orientation of components.
|
void |
setCoreLayout(ILayoutAlgorithm value)
Sets the core layout algorithm.
|
void |
setOrientationOptimizationEnabled(boolean value)
Sets whether or not tree component arrangement is improved by changing the orientation of components.
|
void |
setTreeComponentCoreLayout(ILayoutAlgorithm value)
Sets the layout algorithm that is applied to tree components.
|
public static final NodeDpKey<Boolean> DUMMY_NODE_DPKEY
DataProvider
key for identifying dummy nodes during the layout calculation
This IDataProvider
is registered and also removed in
applyLayoutUsingDummies(LayoutGraph, IDataProvider)
.
public TreeComponentLayout(ILayoutAlgorithm treeCoreLayouter)
TreeComponentLayout
instance using the specified layouter for arranging the subtrees.IllegalArgumentException
- if the specified layout algorithm is null
treeCoreLayouter
- the layout algorithm used for arranging the tree componentspublic void applyLayout(LayoutGraph graph)
tree layout
to
them.applyLayout
in interface ILayoutAlgorithm
graph
- the input graphprotected void applyLayoutUsingDummies(LayoutGraph graph, IDataProvider dummyDp)
core layout algorithm
and handles the dummy nodes.
The dummy nodes are marked using the given IDataProvider
.
This implementation just registers the dummy node IDataProvider
with the graph with key
DUMMY_NODE_DPKEY
, executes the core layout algorithm and finally removes the data provider again.
This method is called by applyLayout(LayoutGraph)
to invoke the core layout algorithm. It may be overridden to
customize the handling of the dummy nodes.
graph
- the input graphdummyDp
- the IDataProvider
which marks the dummy nodespublic ILayoutAlgorithm getCoreLayout()
ILayoutStage
This algorithm is wrapped by this stage. It is invoked in
ILayoutAlgorithm.applyLayout(com.yworks.yfiles.layout.LayoutGraph)
. The ILayoutStage
may add pre-
and post-processing steps before and after calling the core layout algorithm.
getCoreLayout
in interface ILayoutStage
ILayoutStage.setCoreLayout(ILayoutAlgorithm)
public ILayoutAlgorithm getTreeComponentCoreLayout()
setTreeComponentCoreLayout(ILayoutAlgorithm)
public boolean isOrientationOptimizationEnabled()
false
. Components keep their orientation.true
if the component arrangement is optimized, false
otherwisesetOrientationOptimizationEnabled(boolean)
public void setCoreLayout(ILayoutAlgorithm value)
ILayoutStage
This algorithm is wrapped by this stage. It is invoked in
ILayoutAlgorithm.applyLayout(com.yworks.yfiles.layout.LayoutGraph)
. The ILayoutStage
may add pre-
and post-processing steps before and after calling the core layout algorithm.
setCoreLayout
in interface ILayoutStage
value
- the core layout algorithmILayoutStage.getCoreLayout()
public void setOrientationOptimizationEnabled(boolean value)
false
. Components keep their orientation.value
- true
if the component arrangement is optimized, false
otherwiseisOrientationOptimizationEnabled()
public void setTreeComponentCoreLayout(ILayoutAlgorithm value)
value
- the layout algorithm for tree componentsgetTreeComponentCoreLayout()