|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.tree.AbstractNodePlacer
public abstract class AbstractNodePlacer
Abstract base class for implementations of the NodePlacer
interface.
This class provides convenience methods for sub-tasks that are often used during the arrangement of a local root
and its children. It also offers prepared implementations for the methods of the NodePlacer
interface.
Subclasses just need to override the following two abstract methods: placeSubtree(Node, byte)
and
determineChildConnectors(Node, DataMap)
.
Field Summary | |
---|---|
protected LayoutGraph |
graph
The graph instance this class is working on. |
Fields inherited from interface y.layout.tree.NodePlacer |
---|
DIRECTION_ANY, DIRECTION_EAST, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_SOUTH, DIRECTION_WEST |
Constructor Summary | |
---|---|
AbstractNodePlacer()
Creates a new instance of AbstractNodePlacer . |
Method Summary | |
---|---|
java.lang.Object |
clone()
Returns a clone of this NodePlacer instance. |
Processor |
createProcessor(GenericTreeLayouter layouter,
LayoutGraph graph,
Node currentRoot)
Creates an optional Processor for pre- and post-processing. |
protected abstract byte |
determineChildConnector(Node child)
Determines a connector direction for the given child node. |
void |
determineChildConnectors(Node localRoot,
DataMap connectorMap)
Provides the direction of the connector to the SubtreeShape for each child node. |
protected GenericTreeLayouter.SubtreeShape |
getNodeShape(Node node)
Returns the GenericTreeLayouter.SubtreeShape for the given node. |
protected GenericTreeLayouter.SubtreeShape |
getSubtreeShape(Node node)
Returns the GenericTreeLayouter.SubtreeShape for the subtree rooted at the given node. |
GenericTreeLayouter.SubtreeShape |
placeSubtree(DataProvider nodeShapeProvider,
DataProvider subtreeShapeProvider,
LayoutGraph graph,
Node localRoot,
byte parentConnectorDirection)
Initializes the local data structures and then delegates the work to the abstract variant of this method ( placeSubtree(Node, byte) ) |
protected abstract GenericTreeLayouter.SubtreeShape |
placeSubtree(Node localRoot,
byte parentConnectorDirection)
Arranges the local root relative to the GenericTreeLayouter.SubtreeShape of its children. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected LayoutGraph graph
Constructor Detail |
---|
public AbstractNodePlacer()
AbstractNodePlacer
.
Method Detail |
---|
public Processor createProcessor(GenericTreeLayouter layouter, LayoutGraph graph, Node currentRoot)
Processor
for pre- and post-processing.
This implementation returns null
. Hence, no pre- or post-processing will be done.
createProcessor
in interface NodePlacer
layouter
- the current GenericTreeLayouter
instancegraph
- the input graphcurrentRoot
- the root node handled by this NodePlacer
null
protected GenericTreeLayouter.SubtreeShape getSubtreeShape(Node node)
GenericTreeLayouter.SubtreeShape
for the subtree rooted at the given node.
This is a convenience method that retrieves a GenericTreeLayouter.SubtreeShape
of a complete subtree from the corresponding
DataProvider
.
This method is used in placeSubtree(Node, byte)
for retrieving the GenericTreeLayouter.SubtreeShape
s for the
subtrees that are arranged. It may be overridden to return a custom implementation of GenericTreeLayouter.SubtreeShape
.
placeSubtree(Node, byte)
.
Before, the DataProvider
for querying results will not have been initialized yet.node
- the local root node
GenericTreeLayouter.SubtreeShape
of the subtree rooted at the given local root nodeprotected GenericTreeLayouter.SubtreeShape getNodeShape(Node node)
GenericTreeLayouter.SubtreeShape
for the given node.
This is a convenience method that retrieves a GenericTreeLayouter.SubtreeShape
for a single node from the corresponding
DataProvider
.
This method is used in placeSubtree(Node, byte)
for retrieving the GenericTreeLayouter.SubtreeShape
s for the
local root nodes. It may be overridden to return a custom implementation of GenericTreeLayouter.SubtreeShape
.
placeSubtree(Node, byte)
.
Otherwise, the DataProvider
for querying results will not have been initialized yet.node
- the node
GenericTreeLayouter.SubtreeShape
for the given nodepublic void determineChildConnectors(Node localRoot, DataMap connectorMap)
SubtreeShape
for each child node.
This implementation uses determineChildConnector(Node)
to retrieve the direction for the connectors.
determineChildConnectors
in interface NodePlacer
localRoot
- the local root nodeconnectorMap
- the map that must be used for storing the direction specifiers of the child nodesprotected abstract byte determineChildConnector(Node child)
This method is used in determineChildConnectors(Node, DataMap)
and must be implemented by subclasses.
child
- the child node
NodePlacer
interfaceprotected abstract GenericTreeLayouter.SubtreeShape placeSubtree(Node localRoot, byte parentConnectorDirection)
GenericTreeLayouter.SubtreeShape
of its children.
This is the main method that must be implemented by subclasses. It is called by
placeSubtree(DataProvider, DataProvider, LayoutGraph, Node, byte)
.
localRoot
- the local root nodeparentConnectorDirection
- the direction of the connector
GenericTreeLayouter.SubtreeShape
instance that describes the shape of the whole subtree rooted at the given local rootpublic GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider, DataProvider subtreeShapeProvider, LayoutGraph graph, Node localRoot, byte parentConnectorDirection)
placeSubtree(Node, byte)
)
placeSubtree
in interface NodePlacer
nodeShapeProvider
- the DataProvider
for obtaining an initial shape of the root nodesubtreeShapeProvider
- the DataProvider
for accessing the pre-calculated shapes of the subtreesgraph
- the input graphlocalRoot
- the root of the subtree that should be arranged by this methodparentConnectorDirection
- the direction specifier for the connector of the local root node to its parent node
GenericTreeLayouter.SubtreeShape
for the subtree rooted at the local root nodeplaceSubtree(Node, byte)
public java.lang.Object clone()
NodePlacer
instance.
clone
in class java.lang.Object
NodePlacer
instance
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |