Packagecom.yworks.yfiles.layout.hierarchic.incremental
Interfacepublic interface LayerConstraintFactory

Interface specification for classes that can create layering constraints.

If you manually register a DataProvider under com.yworks.yfiles.layout.LayouterKeys.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.

See also

com.yworks.yfiles.layout.LayouterKeys.NODE_ID_DPKEY


Public Properties
 PropertyDefined By
  memento : Object
[read-only] Get a token that allows to bind a constraint factory to a graph instance after creation.
LayerConstraintFactory
Public Methods
 MethodDefined By
  
addPlaceNodeAboveConstraint(referenceId:Object, aboveId:Object):LayerConstraint
Add a constraint that forces the node above to lie above the node reference.
LayerConstraintFactory
  
addPlaceNodeAboveConstraintWithDistance(referenceId:Object, aboveId:Object, minDistance:int):LayerConstraint
Add a constraint that forces the node with id above to lie at least minDistance layers above the node with id reference.
LayerConstraintFactory
  
addPlaceNodeAboveConstraintWithDistanceAndPenalty(referenceId:Object, aboveId:Object, minDistance:int, weight:int):LayerConstraint
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.
LayerConstraintFactory
  
Add a constraint that places a node in the bottom layer
LayerConstraintFactory
  
Add a constraint that places a node in the topmost layer
LayerConstraintFactory
  
addPlaceNodeBelowConstraint(referenceId:Object, belowId:Object):LayerConstraint
Add a constraint that forces the node with id with id below to lie below the node with id reference.
LayerConstraintFactory
  
addPlaceNodeBelowConstraintWithDistance(referenceId:Object, belowId:Object, minDistance:int):LayerConstraint
Add a constraint that forces the node with id below to lie at least minDistance layers below the node with id reference.
LayerConstraintFactory
  
addPlaceNodeBelowConstraintWithDistanceAndPenalty(referenceId:Object, belowId:Object, minDistance:int, weight:int):LayerConstraint
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.
LayerConstraintFactory
  
addPlaceNodeInSameLayerConstraint(referenceId:Object, sameLayerId:Object):LayerConstraint
Add a constraint that forces the node with id sameLayer to lie in the same layer as the node with id reference.
LayerConstraintFactory
  
dispose():void
Disposes the ConstraintFactory.
LayerConstraintFactory
  
removeConstraints(nodeId:Object):void
Clears all constraints for a given node
LayerConstraintFactory
Property Detail
mementoproperty
memento:Object  [read-only]

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.


Implementation
    public function get memento():Object

See also

Method Detail
addPlaceNodeAboveConstraint()method
public function addPlaceNodeAboveConstraint(referenceId:Object, aboveId:Object):LayerConstraint

Add a constraint that forces the node above to lie above the node reference.

Parameters

referenceId:Object — the id of the reference node
 
aboveId:Object — the id of the node that should lie above

Returns
LayerConstraint — a LayerConstraint object that represents the constraint.

See also

addPlaceNodeAboveConstraintWithDistance()method 
public function addPlaceNodeAboveConstraintWithDistance(referenceId:Object, aboveId:Object, minDistance:int):LayerConstraint

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:Object — the id of the reference node
 
aboveId:Object — the id of the node that should lie above
 
minDistance:int — the minimal layer distance between the node and its reference node

Returns
LayerConstraint — a LayerConstraint object that represents the constraint.

See also

addPlaceNodeAboveConstraintWithDistanceAndPenalty()method 
public function addPlaceNodeAboveConstraintWithDistanceAndPenalty(referenceId:Object, aboveId:Object, minDistance:int, weight:int):LayerConstraint

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:Object — the id of the reference node
 
aboveId:Object — the id of the node that should lie above
 
minDistance:int — the minimal layer distance between the node and its reference node
 
weight:int — the weight penalty for larger layer differences

Returns
LayerConstraint — a LayerConstraint object that represents the constraint.

See also

addPlaceNodeAtBottomConstraint()method 
public function addPlaceNodeAtBottomConstraint(nodeId:Object):LayerConstraint

Add a constraint that places a node in the bottom layer

Parameters

nodeId:Object — the id of the node that should lie at the bottom

Returns
LayerConstraint — a LayerConstraint object that represents the constraint.

See also

addPlaceNodeAtTopConstraint()method 
public function addPlaceNodeAtTopConstraint(nodeId:Object):LayerConstraint

Add a constraint that places a node in the topmost layer

Parameters

nodeId:Object — the id of the node that should lie at the top

Returns
LayerConstraint — a LayerConstraint object that represents the constraint.

See also

addPlaceNodeBelowConstraint()method 
public function addPlaceNodeBelowConstraint(referenceId:Object, belowId:Object):LayerConstraint

Add a constraint that forces the node with id with id below to lie below the node with id reference.

Parameters

referenceId:Object — the id of the reference node
 
belowId:Object — the id of the node that should lie below

Returns
LayerConstraint — a LayerConstraint object that represents the constraint.

See also

addPlaceNodeBelowConstraintWithDistance()method 
public function addPlaceNodeBelowConstraintWithDistance(referenceId:Object, belowId:Object, minDistance:int):LayerConstraint

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:Object — the id of the reference node
 
belowId:Object — the id of the node that should lie below
 
minDistance:int — the minimal layer distance between the node and its reference node

Returns
LayerConstraint — a LayerConstraint object that represents the constraint.

See also

addPlaceNodeBelowConstraintWithDistanceAndPenalty()method 
public function addPlaceNodeBelowConstraintWithDistanceAndPenalty(referenceId:Object, belowId:Object, minDistance:int, weight:int):LayerConstraint

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:Object — the id of the reference node
 
belowId:Object — the id of the node that should lie below
 
minDistance:int — the minimal layer distance between the node and its reference node
 
weight:int — the weight penalty for larger layer differences

Returns
LayerConstraint — a LayerConstraint object that represents the constraint.

See also

addPlaceNodeInSameLayerConstraint()method 
public function addPlaceNodeInSameLayerConstraint(referenceId:Object, sameLayerId:Object):LayerConstraint

Add a constraint that forces the node with id sameLayer to lie in the same layer as the node with id reference.

Parameters

referenceId:Object — the id of the reference node
 
sameLayerId:Object — the id of the node that should lie in the same layer

Returns
LayerConstraint — a LayerConstraint object that represents the constraint.

See also

dispose()method 
public function dispose():void

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.

removeConstraints()method 
public function removeConstraints(nodeId:Object):void

Clears all constraints for a given node

Parameters

nodeId:Object — the id of the node for which all constraints should be cleared

See also