Search this API

y.layout.hierarchic.incremental
Interface LayerConstraintFactory


public interface LayerConstraintFactory

Interface specification for classes that can create layering constraints.

If you manually register a DataProvider under Layouter.NODE_ID_DPKEY on the graph, 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.


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

Field Detail

LAYER_CONSTRAINTS_MEMENTO_DPKEY

static final Object LAYER_CONSTRAINTS_MEMENTO_DPKEY
DataProvider key to store the constraints.

Method Detail

getMemento

Object getMemento()
Get 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 the ConstraintFactory to a graph instance after creation. Please 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:
ConstraintLayerer.createConstraintFactory(y.base.Graph)

dispose

void dispose()
Disposes the ConstraintFactory.

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


addPlaceNodeBelowConstraint

LayerConstraint addPlaceNodeBelowConstraint(Object referenceId,
                                            Object belowId)
Add a constraint that forces the node with id with id below to lie below the node with id reference.

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

addPlaceNodeBelowConstraint

LayerConstraint addPlaceNodeBelowConstraint(Object referenceId,
                                            Object belowId,
                                            int minDistance)
Add a constraint that forces the node with id below to lie at least minDistance layers below the node with id reference.

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

Parameters:
referenceId - the id of the reference node
belowId - the id of the node that should lie below
minDistance - the minimal layer distance between the node and its reference node
Returns:
a LayerConstraint object that represents the constraint.
See Also:
LayerConstraint

addPlaceNodeBelowConstraint

LayerConstraint addPlaceNodeBelowConstraint(Object referenceId,
                                            Object belowId,
                                            int minDistance,
                                            int weight)
Add a constraint that forces the node with id below to lie at least minDistance layers below the node with id reference with a given weight penalty for larger layer differences.

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

Parameters:
referenceId - the id of the reference node
belowId - the id of the node that should lie below
minDistance - the minimal 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

addPlaceNodeAboveConstraint

LayerConstraint addPlaceNodeAboveConstraint(Object referenceId,
                                            Object aboveId)
Add a constraint that forces the node above to lie above the node reference.

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

addPlaceNodeAboveConstraint

LayerConstraint addPlaceNodeAboveConstraint(Object referenceId,
                                            Object aboveId,
                                            int minDistance)
Add a constraint that forces the node with id above to lie at least minDistance layers above the node with id reference.

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

Parameters:
referenceId - the id of the reference node
aboveId - the id of the node that should lie above
minDistance - the minimal layer distance between the node and its reference node
Returns:
a LayerConstraint object that represents the constraint.
See Also:
LayerConstraint

addPlaceNodeAboveConstraint

LayerConstraint addPlaceNodeAboveConstraint(Object referenceId,
                                            Object aboveId,
                                            int minDistance,
                                            int weight)
Add a constraint that forces the node with id above to lie at least minDistance layers above the node with id reference with a given weight penalty for larger layer differences.

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

Parameters:
referenceId - the id of the reference node
aboveId - the id of the node that should lie above
minDistance - the minimal 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

addPlaceNodeInSameLayerConstraint

LayerConstraint addPlaceNodeInSameLayerConstraint(Object referenceId,
                                                  Object sameLayerId)
Add a constraint that forces the node with id sameLayer to lie in the same layer as the node with id reference.

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

addPlaceNodeAtTopConstraint

LayerConstraint addPlaceNodeAtTopConstraint(Object nodeId)
Add a constraint that places a node in the topmost layer

Parameters:
nodeId - the id of the node that should lie at the top
Returns:
a LayerConstraint object that represents the constraint.
See Also:
LayerConstraint

addPlaceNodeAtBottomConstraint

LayerConstraint addPlaceNodeAtBottomConstraint(Object nodeId)
Add a constraint that places a node in the bottom layer

Parameters:
nodeId - the id of the node that should lie at the bottom
Returns:
a LayerConstraint object that represents the constraint.
See Also:
LayerConstraint

removeConstraints

void removeConstraints(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-2013,
yWorks GmbH.
All rights reserved.