Search this API

y.layout.tree
Class LeftRightPlacer.LeftRightDataProvider

java.lang.Object
  extended by y.util.DataProviderAdapter
      extended by y.layout.tree.LeftRightPlacer.LeftRightDataProvider
All Implemented Interfaces:
DataProvider
Enclosing class:
LeftRightPlacer

public static final class LeftRightPlacer.LeftRightDataProvider
extends DataProviderAdapter

A special DataProvider that determines whether a given node is placed left or right of the parent node.

This DataProvider can be registered with the graph with key LeftRightPlacer.LEFT_RIGHT_DPKEY. It calculates the side with respect to the initial coordinates of the nodes in the graph, considering the orientation of the subtree.

If a node is assigned to the left side, this DataProvider will return true. For the right side, it will return false.

 
LeftRightPlacer.LeftRightDataProvider provides a convenient way to determine the side of a node from the initial graph.
 
Since the side of a node depends on the rotation of the associated NodePlacer, LeftRightPlacer.LeftRightDataProvider demands a DataProvider containing the NodePlacer instances that are used for the layout calculation.
 
Your browser does not support SVG content.

Constructor Summary
LeftRightPlacer.LeftRightDataProvider(DataProvider nodePlacerMap)
          Creates a new LeftRightPlacer.LeftRightDataProvider instance.
 
Method Summary
 boolean getBool(java.lang.Object dataHolder)
          Determines whether or not the given node is left of its parent node.
 
Methods inherited from class y.util.DataProviderAdapter
defined, get, getDouble, getInt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LeftRightPlacer.LeftRightDataProvider

public LeftRightPlacer.LeftRightDataProvider(DataProvider nodePlacerMap)
Creates a new LeftRightPlacer.LeftRightDataProvider instance.

The given DataProvider is a reference to the one that specifies the NodePlacers for each node in the graph. These NodePlacers are used for retrieving their orientation, which is necessary to determine the side (left/right) for the node.

Parameters:
nodePlacerMap - a DataProvider containing the corresponding NodePlacers for the node
Method Detail

getBool

public boolean getBool(java.lang.Object dataHolder)
Determines whether or not the given node is left of its parent node.

The side for the node is retrieved according to the current orientation. For vertical subtree directions, the x-coordinates are compared. The y-coordinates are considered in the case of a horizontal orientation.

Specified by:
getBool in interface DataProvider
Overrides:
getBool in class DataProviderAdapter
 
The orientation can only be retrieved correctly from AbstractRotatableNodePlacer instances. If another NodePlacer is assigned to a node, this node is assigned to the right of its parent.
Parameters:
dataHolder - the node
Returns:
true if the given node is left of its parent node, false otherwise

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