Search this API

y.layout.hierarchic.incremental
Class ConstraintIncrementalLayerer

java.lang.Object
  extended by y.layout.hierarchic.incremental.ConstraintIncrementalLayerer
All Implemented Interfaces:
Layerer

public class ConstraintIncrementalLayerer
extends Object
implements Layerer

Layerer implementation that observes relative and absolute layering constraints defined by the layering constraint factory LayerConstraintFactory. For a given graph instance, this factory can be created with method IncrementalHierarchicLayouter.createLayerConstraintFactory(y.base.Graph). The Layerer can be used for both common layering and layering of incremental nodes.

Note: This layerer is always used automatically if the graph instance has constraints created with the layering constraint factory.

See Also:
LayerConstraintFactory, IncrementalHierarchicLayouter

Field Summary
static String EDGE_WEIGHTS_DPKEY
          DataProvider key for additional edge weights of type int.
 
Constructor Summary
ConstraintIncrementalLayerer(Layerer coreLayerer)
           
 
Method Summary
 void assignLayers(LayoutGraph g, Layers layers, LayoutDataProvider ldp)
          Calculates a layering for the given graph.
protected  void checkConstraints()
          Checks if the current set of strong constraints is consistent (i.e. has no cycles)
 boolean isAllowSameLayerEdges()
          Returns whether same layer edges can be created by this layerer instance.
 void setAllowSameLayerEdges(boolean allowSameLayerEdges)
          Set whether same layer edges can be created by this layerer instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDGE_WEIGHTS_DPKEY

public static final String EDGE_WEIGHTS_DPKEY
DataProvider key for additional edge weights of type int.

The Layerer tries to keep edges with higher weights short.

See Also:
Constant Field Values
Constructor Detail

ConstraintIncrementalLayerer

public ConstraintIncrementalLayerer(Layerer coreLayerer)
Method Detail

isAllowSameLayerEdges

public boolean isAllowSameLayerEdges()
Returns whether same layer edges can be created by this layerer instance.

This only concerns edges between nodes that have no hard constraints that will force a same layer edge (i.e. a same layer constraint).

Default value is false.

Returns:
true iff unconstrained same layer edges are allowed.

setAllowSameLayerEdges

public void setAllowSameLayerEdges(boolean allowSameLayerEdges)
Set whether same layer edges can be created by this layerer instance.

This only concerns edges between nodes that have no hard constraints that will force a same layer edge (i.e. a same layer constraint).

Default value is false.

Parameters:
allowSameLayerEdges - true iff unconstrained same layer edges are allowed.

assignLayers

public void assignLayers(LayoutGraph g,
                         Layers layers,
                         LayoutDataProvider ldp)
Calculates a layering for the given graph.

Specified by:
assignLayers in interface Layerer
Parameters:
g - the graph containing all nodes and edges.
layers - a structure that is filled by the layerer. If the layerer is used for layering incremental nodes, the layers structure already have to contain all non-incremental nodes.
ldp - LayoutDataProvider that can be used to query information about the nodes - note that positional information (see NodeData.getPosition() and NodeData.getLayer()) cannot be available at any time.
See Also:
Layers.insert(byte, int), Layer.add(y.base.Node)

checkConstraints

protected void checkConstraints()
Checks if the current set of strong constraints is consistent (i.e. has no cycles)

Throws:
IllegalArgumentException - if the constraint network is inconsistent

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