Search this API

y.layout.tree
Class BusPlacer

java.lang.Object
  extended by y.layout.tree.AbstractRotatableNodePlacer
      extended by y.layout.tree.BusPlacer
All Implemented Interfaces:
FromSketchNodePlacer, NodePlacer

public class BusPlacer
extends AbstractRotatableNodePlacer

The BusPlacer creates a bus to which all child nodes and the local root node are connected.

Layout Style


The root node is marked

 

Nested Class Summary
 
Nested classes/interfaces inherited from class y.layout.tree.AbstractRotatableNodePlacer
AbstractRotatableNodePlacer.Matrix, AbstractRotatableNodePlacer.RootAlignment
 
Field Summary
 
Fields inherited from class y.layout.tree.AbstractRotatableNodePlacer
createdChildren, graph, modificationMatrix, nodeShapeProvider, spacing, subtreeShapeProvider
 
Fields inherited from interface y.layout.tree.NodePlacer
DIRECTION_ANY, DIRECTION_EAST, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_SOUTH, DIRECTION_WEST
 
Constructor Summary
BusPlacer()
          Creates a new instance of BusPlacer with default settings.
BusPlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix)
          Creates a new BusPlacer instance that uses the transformation defined by the given matrix.
 
Method Summary
 java.util.Comparator createComparator()
          Creates a Comparator for outgoing edges that takes the rotation into account.
protected  byte determineChildConnector(Node child)
          Determines a connector direction for the given child node.
 void determineChildConnectors(Node localRoot, DataMap connectorMap)
          Determines connector directions depending on whether or not the child nodes are placed above or below the bus.
protected  y.layout.tree.SubtreeShapeRotated placeSubtree(Node localRoot, byte parentConnectorDirection)
          Places all children of the local root below and above a bus segment that is shared by the edges.
 
Methods inherited from class y.layout.tree.AbstractRotatableNodePlacer
createFromSketchComparator, createProcessor, createRootNodeShape, createSubtreeShape, getModificationMatrix, getPortConstraint, getSourcePointAbs, getSpacing, placeSubtree, setSpacing, translateDirectionToModel, translateDirectionToReal, translatePoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BusPlacer

public BusPlacer()
Creates a new instance of BusPlacer with default settings.


BusPlacer

public BusPlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix)
Creates a new BusPlacer instance that uses the transformation defined by the given matrix.

Parameters:
modificationMatrix - the transformation matrix
Throws:
java.lang.IllegalArgumentException - if the given transformation matrix is null
Method Detail

determineChildConnector

protected byte determineChildConnector(Node child)
Determines a connector direction for the given child node.

Specified by:
determineChildConnector in class AbstractRotatableNodePlacer
 
This method should not be called! Finding the directions for the connectors is done by determineChildConnectors(Node, DataMap).
Parameters:
child - the child node
Returns:
a direction specifier as defined in the NodePlacer interface
Throws:
java.lang.IllegalStateException - if this method is called

determineChildConnectors

public void determineChildConnectors(Node localRoot,
                                     DataMap connectorMap)
Determines connector directions depending on whether or not the child nodes are placed above or below the bus.

When a child node is placed above the bus, the edge should connect north, otherwise it should connect south.

Specified by:
determineChildConnectors in interface NodePlacer
Overrides:
determineChildConnectors in class AbstractRotatableNodePlacer
Parameters:
localRoot - the local root
connectorMap - the map that must be used for storing the direction specifiers of the child nodes
See Also:
AbstractRotatableNodePlacer.determineChildConnector(Node)

placeSubtree

protected y.layout.tree.SubtreeShapeRotated placeSubtree(Node localRoot,
                                                         byte parentConnectorDirection)
Places all children of the local root below and above a bus segment that is shared by the edges.

The bus is located below the local root and the children are placed below this bus or next to the local root.

Specified by:
placeSubtree in class AbstractRotatableNodePlacer
Parameters:
localRoot - the local root node
parentConnectorDirection - the direction specifier for the connector of the local root node to its parent node
Returns:
the merged subtree shape that contains the local root node and all its children

createComparator

public java.util.Comparator createComparator()
Creates a Comparator for outgoing edges that takes the rotation into account.

This implementation keeps the current order of edges.

Overrides:
createComparator in class AbstractRotatableNodePlacer
Returns:
null

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.