Search this API

y.layout.hierarchic.incremental
Class DefaultLayeredComponentsMerger

java.lang.Object
  extended by y.layout.hierarchic.incremental.DefaultLayeredComponentsMerger
All Implemented Interfaces:
LayeredComponentsMerger

public class DefaultLayeredComponentsMerger
extends Object
implements LayeredComponentsMerger

A default implementation of a LayeredComponentsMerger that provides simple default behaviors. Instances of this class are used internally by HierarchicLayouter and MultiComponentLayerer e.g.


Field Summary
static byte POLICY_ADD_ABOVE
          Constant for merging policy.
static byte POLICY_ADD_BELOW
          Constant for merging policy.
static byte POLICY_ADD_LEFT_BOTTOM_ALIGNED
          Constant for merging policy.
static byte POLICY_ADD_LEFT_CENTER_ALIGNED
          Constant for merging policy.
static byte POLICY_ADD_LEFT_TOP_ALIGNED
          Constant for merging policy.
static byte POLICY_ADD_RIGHT_BOTTOM_ALIGNED
          Constant for merging policy.
static byte POLICY_ADD_RIGHT_CENTER_ALIGNED
          Constant for merging policy.
static byte POLICY_ADD_RIGHT_TOP_ALIGNED
          Constant for merging policy.
 
Constructor Summary
DefaultLayeredComponentsMerger()
          Creates a new instance of DefaultLayeredComponentsMerger with default policy (POLICY_ADD_RIGHT_TOP_ALIGNED)
DefaultLayeredComponentsMerger(byte policy)
          Creates a new instance of DefaultLayeredComponentsMerger using the given policy constant.
 
Method Summary
 byte getPolicy()
          Returns the current policy constant.
 void merge(LayoutGraph graph, LayoutDataProvider ldp, Layers srcLayers, Layers targetLayers)
          All nodes in srcLayers and targetLayers are part of graph at the moment of invocation.
 void setPolicy(byte policy)
          Sets the policy constant as defined in DefaultLayeredComponentsMerger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLICY_ADD_BELOW

public static final byte POLICY_ADD_BELOW
Constant for merging policy. This policy adds new layers from the source layering below the layers in the target layering.

See Also:
Constant Field Values

POLICY_ADD_ABOVE

public static final byte POLICY_ADD_ABOVE
Constant for merging policy. This policy adds new layers from the source layering above the layers in the target layering.

See Also:
Constant Field Values

POLICY_ADD_RIGHT_TOP_ALIGNED

public static final byte POLICY_ADD_RIGHT_TOP_ALIGNED
Constant for merging policy. This policy adds new layers from the source layering to the right of the layers in the target layering. Both layerings will be top aligned before the merge.

See Also:
Constant Field Values

POLICY_ADD_RIGHT_BOTTOM_ALIGNED

public static final byte POLICY_ADD_RIGHT_BOTTOM_ALIGNED
Constant for merging policy. This policy adds new layers from the source layering to the right of the layers in the target layering. Both layerings will be bottom aligned before the merge.

See Also:
Constant Field Values

POLICY_ADD_RIGHT_CENTER_ALIGNED

public static final byte POLICY_ADD_RIGHT_CENTER_ALIGNED
Constant for merging policy. This policy adds new layers from the source layering to the right of the layers in the target layering. Both layerings will be center aligned before the merge.

See Also:
Constant Field Values

POLICY_ADD_LEFT_TOP_ALIGNED

public static final byte POLICY_ADD_LEFT_TOP_ALIGNED
Constant for merging policy. This policy adds new layers from the source layering to the left of the layers in the target layering. Both layerings will be top aligned before the merge.

See Also:
Constant Field Values

POLICY_ADD_LEFT_BOTTOM_ALIGNED

public static final byte POLICY_ADD_LEFT_BOTTOM_ALIGNED
Constant for merging policy. This policy adds new layers from the source layering to the left of the layers in the target layering. Both layerings will be bottom aligned before the merge.

See Also:
Constant Field Values

POLICY_ADD_LEFT_CENTER_ALIGNED

public static final byte POLICY_ADD_LEFT_CENTER_ALIGNED
Constant for merging policy. This policy adds new layers from the source layering to the left of the layers in the target layering. Both layerings will be center aligned before the merge.

See Also:
Constant Field Values
Constructor Detail

DefaultLayeredComponentsMerger

public DefaultLayeredComponentsMerger()
Creates a new instance of DefaultLayeredComponentsMerger with default policy (POLICY_ADD_RIGHT_TOP_ALIGNED)


DefaultLayeredComponentsMerger

public DefaultLayeredComponentsMerger(byte policy)
Creates a new instance of DefaultLayeredComponentsMerger using the given policy constant.

Method Detail

getPolicy

public byte getPolicy()
Returns the current policy constant.

Returns:
the policy constant

setPolicy

public void setPolicy(byte policy)
Sets the policy constant as defined in DefaultLayeredComponentsMerger.

Parameters:
policy - the new policy constant

merge

public void merge(LayoutGraph graph,
                  LayoutDataProvider ldp,
                  Layers srcLayers,
                  Layers targetLayers)
Description copied from interface: LayeredComponentsMerger
All nodes in srcLayers and targetLayers are part of graph at the moment of invocation. The state of srcLayers is discarded after this call and need not be updated to reflect the changes. targetLayers must be updated accordingly.

Specified by:
merge in interface LayeredComponentsMerger
Parameters:
graph - the graph that contains the nodes in srcLayers and targetLayers.
ldp - the LayoutDataProvider that can be used to query the layer indices
srcLayers - the Layers implementation that contains the layers that will be merged into targetLayers
targetLayers - the Layers that will be modified to contain the resulting layering

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