Search this API

y.layout.tabular
Class NodeLayoutDescriptor

java.lang.Object
  extended by y.layout.tabular.NodeLayoutDescriptor

public class NodeLayoutDescriptor
extends java.lang.Object

This class is used by TabularLayouter to provide placement details for nodes during the layout process.

It allows to configure layout settings individually for each node of the input graph.

A NodeLayoutDescriptor can be specified individually for single nodes using a DataProvider that returns a descriptor instance for the node, or null if no individual descriptor is bound to a node. In the latter case, the default descriptor is used. The DataProvider must be registered with the graph with key TabularLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY.

See Also:
TabularLayouter.NODE_LAYOUT_DESCRIPTOR_DPKEY, TabularLayouter.setDefaultNodeLayoutDescriptor(NodeLayoutDescriptor)
 

Constructor Summary
NodeLayoutDescriptor()
           
 
Method Summary
 NodeLayoutDescriptor createCopy()
          Creates a copy of this descriptor instance.
 double getHorizontalAlignment()
          Returns the horizontal alignment of the node within its column.
 double getVerticalAlignment()
          Returns the vertical alignment of the node within its row.
 void setHorizontalAlignment(double horizontalAlignment)
          Specifies the horizontal alignment of the node within its column.
 void setVerticalAlignment(double verticalAlignment)
          Specifies the vertical alignment of the node within its row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeLayoutDescriptor

public NodeLayoutDescriptor()
Method Detail

getVerticalAlignment

public double getVerticalAlignment()
Returns the vertical alignment of the node within its row.

All nodes of the same row will be aligned according to their vertical alignment setting.

The vertical alignment value must be within [0,1].

Returns:
the vertical alignment value in interval [0,1]
See Also:
setVerticalAlignment(double)

setVerticalAlignment

public void setVerticalAlignment(double verticalAlignment)
Specifies the vertical alignment of the node within its row.

All nodes of the same row will be aligned according to their vertical alignment setting.

The vertical alignment value must be within [0,1].

Default Value:
The default value is 0.5. The node is center-aligned in its row.
Parameters:
verticalAlignment - the vertical alignment value in interval [0,1]
Throws:
java.lang.IllegalArgumentException - if the given value is not within interval [0,1]
Sample Graph:

Nodes in the first row are top-aligned, nodes in the second row are center-aligned, nodes in the third row are bottom-aligned.

getHorizontalAlignment

public double getHorizontalAlignment()
Returns the horizontal alignment of the node within its column.

All nodes of the same column will be aligned according to their horizontal alignment setting.

The horizontal alignment value must be within [0,1].

Returns:
the horizontal alignment value in interval [0,1]
See Also:
setHorizontalAlignment(double)

setHorizontalAlignment

public void setHorizontalAlignment(double horizontalAlignment)
Specifies the horizontal alignment of the node within its column.

All nodes of the same column will be aligned according to their horizontal alignment setting.

The horizontal alignment value must be within [0,1].

Default Value:
The default value is 0.5. The node is center-aligned in its column.
Parameters:
horizontalAlignment - the horizontal alignment value in interval [0,1]
Throws:
java.lang.IllegalArgumentException - if the given value is not within interval [0,1]
Sample Graph:

Nodes in the first column are left-aligned, nodes in the second column are center-aligned, nodes in the third column are right-aligned.

createCopy

public NodeLayoutDescriptor createCopy()
Creates a copy of this descriptor instance.

Returns:
a copy of this descriptor instance

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