Search this API

y.layout.hierarchic.incremental
Interface LayerConstraintFactory


public interface LayerConstraintFactory

This interface provides methods for creating layering constraints.

 
If you manually register a DataProvider with the graph with key Layouter.NODE_ID_DPKEY, you must use the corresponding node IDs stored in this DataProvider as arguments for all methods that create a constraint. Otherwise, you can just use the node instances themselves.
 
Your browser does not support SVG content.
Sample Graphs:

A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node.

After defining appropriate layer constraints and running the layout again, the labeled nodes now have their intended placement.

Field Summary
static java.lang.Object LAYER_CONSTRAINTS_MEMENTO_DPKEY
          A DataProvider key for storing the constraint graph
 
Method Summary
 LayerConstraint addPlaceNodeAboveConstraint(java.lang.Object referenceId, java.lang.Object aboveId)
          Adds a constraint that forces the Node with ID aboveId to lie above the Node with ID referenceId.
 LayerConstraint addPlaceNodeAboveConstraint(java.lang.Object referenceId, java.lang.Object aboveId, int minDistance)
          Adds a constraint that forces the Node with ID aboveId to lie at least minDistance layers above the Node with ID referenceId.
 LayerConstraint addPlaceNodeAboveConstraint(java.lang.Object referenceId, java.lang.Object aboveId, int minDistance, int weight)
          Adds a constraint that forces the Node with ID aboveId to lie at least minDistance layers above the Node with ID referenceId with a given weight penalty for larger layer differences.
 LayerConstraint addPlaceNodeAtBottomConstraint(java.lang.Object nodeId)
          Adds a constraint that places a Node on the bottom layer.
 LayerConstraint addPlaceNodeAtTopConstraint(java.lang.Object nodeId)
          Adds a constraint that places a Node on the topmost layer.
 LayerConstraint addPlaceNodeBelowConstraint(java.lang.Object referenceId, java.lang.Object belowId)
          Adds a constraint that forces a Node with ID belowId to lie below the Node with ID referenceId.
 LayerConstraint addPlaceNodeBelowConstraint(java.lang.Object referenceId, java.lang.Object belowId, int minDistance)
          Add a constraint that forces the Node with ID belowId to lie at least minDistance layers below the Node with ID referenceId.
 LayerConstraint addPlaceNodeBelowConstraint(java.lang.Object referenceId, java.lang.Object belowId, int minDistance, int weight)
          Adds a constraint that forces the Node with ID belowId to lie at least minDistance layers below the Node with ID referenceId with a given weight penalty for larger layer differences.
 LayerConstraint addPlaceNodeInSameLayerConstraint(java.lang.Object referenceId, java.lang.Object sameLayerId)
          Adds a constraint that forces the Node with ID sameLayerId to lie in the same layer as the Node with ID referenceId.
 void dispose()
          Disposes this factory.
 java.lang.Object getMemento()
          Returns a token that allows to bind a constraint factory to a graph instance after creation.
 void removeConstraints(java.lang.Object nodeId)
          Clears all constraints for a given Node.
 

Field Detail

LAYER_CONSTRAINTS_MEMENTO_DPKEY

static final java.lang.Object LAYER_CONSTRAINTS_MEMENTO_DPKEY
A DataProvider key for storing the constraint graph

Method Detail

getMemento

java.lang.Object getMemento()
Returns a token that allows to bind a constraint factory to a graph instance after creation.

This method should only be used if the constraint factory is not bound to a graph instance initially. It allows to bind this factory to a graph instance after creation. See the factory methods that create instances of this interface for a description.

Returns:
a token that allows to bind the constraint factory to a graph instance
See Also:
IncrementalHierarchicLayouter.createLayerConstraintFactory(y.base.Graph)

dispose

void dispose()
Disposes this factory.

This method should be called when this factory is not needed anymore, i.e. after the layout has been calculated. Calling this method also clears all constraints.


addPlaceNodeBelowConstraint

LayerConstraint addPlaceNodeBelowConstraint(java.lang.Object referenceId,
                                            java.lang.Object belowId)
Adds a constraint that forces a Node with ID belowId to lie below the Node with ID referenceId.

Parameters:
referenceId - the ID of the reference node
belowId - the ID of the node that should lie below
Returns:
a LayerConstraint object that represents the constraint
See Also:
LayerConstraint
Sample Graphs:

A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node.

After defining appropriate layer constraints and running the layout again, the labeled nodes now lie below the reference node.

addPlaceNodeBelowConstraint

LayerConstraint addPlaceNodeBelowConstraint(java.lang.Object referenceId,
                                            java.lang.Object belowId,
                                            int minDistance)
Add a constraint that forces the Node with ID belowId to lie at least minDistance layers below the Node with ID referenceId.

The minimum distance includes potentially empty layers that are removed by the Layerer instance. In that case, the actual layer difference may be smaller than the minimum distance.

Parameters:
referenceId - the ID of the reference node
belowId - the ID of the node that should lie below
minDistance - the minimum layer distance between the node and its reference node
Returns:
a LayerConstraint object that represents the constraint
See Also:
LayerConstraint
Sample Graphs:

A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node.

After defining appropriate layer constraints and running the layout again, the labeled nodes now lie below the reference node.

addPlaceNodeBelowConstraint

LayerConstraint addPlaceNodeBelowConstraint(java.lang.Object referenceId,
                                            java.lang.Object belowId,
                                            int minDistance,
                                            int weight)
Adds a constraint that forces the Node with ID belowId to lie at least minDistance layers below the Node with ID referenceId with a given weight penalty for larger layer differences.

The minimum distance includes potentially empty layers that are removed by the Layerer instance. In that case, the actual layer difference may be smaller than the minimum distance.

Parameters:
referenceId - the ID of the reference node
belowId - the ID of the node that should lie below
minDistance - the minimum layer distance between the node and its reference node
weight - the weight penalty for larger layer differences
Returns:
a LayerConstraint object that represents the constraint
See Also:
LayerConstraint
Sample Graphs:

A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node.

After defining appropriate layer constraints and running the layout again, the labeled nodes now lie below the reference node.

addPlaceNodeAboveConstraint

LayerConstraint addPlaceNodeAboveConstraint(java.lang.Object referenceId,
                                            java.lang.Object aboveId)
Adds a constraint that forces the Node with ID aboveId to lie above the Node with ID referenceId.

Parameters:
referenceId - the ID of the reference node
aboveId - the ID of the node that should lie above
Returns:
a LayerConstraint object that represents the constraint
See Also:
LayerConstraint
Sample Graphs:

A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node.

After defining appropriate layer constraints and running the layout again, the labeled nodes now lie above the reference node.

addPlaceNodeAboveConstraint

LayerConstraint addPlaceNodeAboveConstraint(java.lang.Object referenceId,
                                            java.lang.Object aboveId,
                                            int minDistance)
Adds a constraint that forces the Node with ID aboveId to lie at least minDistance layers above the Node with ID referenceId.

The minimum distance includes potentially empty layers that are removed by the Layerer instance. In that case, the actual layer difference may be smaller than the minimum distance.

Parameters:
referenceId - the ID of the reference node
aboveId - the ID of the node that should lie above
minDistance - the minimum layer distance between the node and its reference node
Returns:
a LayerConstraint object that represents the constraint
See Also:
LayerConstraint
Sample Graphs:

A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node.

After defining appropriate layer constraints and running the layout again, the labeled nodes now lie above the reference node.

addPlaceNodeAboveConstraint

LayerConstraint addPlaceNodeAboveConstraint(java.lang.Object referenceId,
                                            java.lang.Object aboveId,
                                            int minDistance,
                                            int weight)
Adds a constraint that forces the Node with ID aboveId to lie at least minDistance layers above the Node with ID referenceId with a given weight penalty for larger layer differences.

The minimum distance includes potentially empty layers that are removed by the Layerer instance. In that case, the actual layer difference may be smaller than the minimum distance.

Parameters:
referenceId - the ID of the reference node
aboveId - the ID of the node that should lie above
minDistance - the minimum layer distance between the node and its reference node
weight - the weight penalty for larger layer differences
Returns:
a LayerConstraint object that represents the constraint
See Also:
LayerConstraint
Sample Graphs:

A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node.

After defining appropriate layer constraints and running the layout again, the labeled nodes now lie above the reference node.

addPlaceNodeInSameLayerConstraint

LayerConstraint addPlaceNodeInSameLayerConstraint(java.lang.Object referenceId,
                                                  java.lang.Object sameLayerId)
Adds a constraint that forces the Node with ID sameLayerId to lie in the same layer as the Node with ID referenceId.

Parameters:
referenceId - the ID of the reference node
sameLayerId - the ID of the node that should lie in the same layer
Returns:
a LayerConstraint object that represents the constraint
See Also:
LayerConstraint
Sample Graphs:

A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node.

After defining appropriate layer constraints and running the layout again, the labeled nodes now lie in the same layer as the reference node.

addPlaceNodeAtTopConstraint

LayerConstraint addPlaceNodeAtTopConstraint(java.lang.Object nodeId)
Adds a constraint that places a Node on the topmost layer.

Parameters:
nodeId - the ID of the node that should lie on the top layer
Returns:
a LayerConstraint object that represents the constraint
See Also:
LayerConstraint
Sample Graphs:

A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node.

After defining appropriate layer constraints and running the layout again, the labeled nodes now lie in the first layer.

addPlaceNodeAtBottomConstraint

LayerConstraint addPlaceNodeAtBottomConstraint(java.lang.Object nodeId)
Adds a constraint that places a Node on the bottom layer.

Parameters:
nodeId - the ID of the node that should lie on the bottom layer
Returns:
a LayerConstraint object that represents the constraint
See Also:
LayerConstraint
Sample Graphs:

A graph laid out with IncrementalHierarchicLayouter with default settings. The labels indicate the desired placement of certain nodes relative to a reference node.

After defining appropriate layer constraints and running the layout again, the labeled nodes now lie in the last layer.

removeConstraints

void removeConstraints(java.lang.Object nodeId)
Clears all constraints for a given Node.

Parameters:
nodeId - the ID of the node for which all constraints should be cleared
See Also:
LayerConstraint

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