ilog.views.graphlayout.recursive
Class IlvRecursiveMultipleLayout

java.lang.Object
  extended by ilog.views.graphlayout.IlvGraphLayout
      extended by ilog.views.graphlayout.recursive.IlvRecursiveLayout
          extended by ilog.views.graphlayout.recursive.IlvRecursiveMultipleLayout
All Implemented Interfaces:
GraphLayoutEventListener, GraphModelListener, LabelLayoutEventListener, Serializable, EventListener

public class IlvRecursiveMultipleLayout
extends IlvRecursiveLayout
implements LabelLayoutEventListener

The main class for the Recursive Multiple Layout algorithm.

This is not a layout algorithm but rather a facility to perform multiple layouts recursively in a nested grapher. In principle, this is just the combination of Recursive Layout and Multiple Layout.

Unless otherwise mentioned, the normal layout algorithms such as IlvHierarchicalLayout, IlvTreeLayout, IlvMultipleLayout, and so forth work on a flat graph, that is, they lay out the attached graph but not the subgraphs of the attached graph. Similarly, label layout algorithms work only on flat managers, not on nested graphs. The Recursive Multiple Layout is different: it traverses the nesting structure starting from the attached graph and recursively applies a first graph layout, then a second graph layout, and finally a label layout on all subgraphs. It can be tailored for which sublayouts have to be applied to which subgraph.

The Recursive Multiple Layout is a Recursive Layout (see IlvRecursiveLayout) where all layouts of subgraphs are Multiple Layouts (see IlvMultipleLayout).

For instance, assume that you want to apply a Tree layout, then a Link layout for the nontree links, and finally a Label layout for the link labels to each subgraph. It would be unfortunate to call IlvGraphLayout.performLayout(boolean, boolean, boolean) multiple times to achieve this, because the tree layout of the parent graph would be finished before the link layout of its subgraph has started; hence the link layout of the subgraph invalidates the tree layout of the parent graph again. To avoid this effect, the Tree layout, Link layout, and Label layout of the subgraph should be finished before any layout of the parent graph has started. The following examples shows how to achieve this by using the Recursive Multiple Layout class. There are basically two scenarios:

First scenario: Same layout styles everywhere

To perform a Tree Layout, a Link Layout, and an Annealing Label Layout on a nested graph, call:

 IlvGraphLayout layout = new IlvMultipleRecursiveLayout(
                               new IlvTreeLayout(),
                               new IlvLinkLayout(),
                               new IlvAnnealingLabelLayout());
 layout.attach(grapher);
 layout.performLayout(true, true); 
If you simply want to apply a label layout in a nested grapher, call:
 IlvGraphLayout layout = new IlvMultipleRecursiveLayout(
                               new IlvAnnealingLabelLayout());
 layout.attach(grapher);
 layout.performLayout(true, true); 
In this case, each subgraph is treated bottom-up. First a tree layout is performed on the subgraph. Then a link layout is performed on the subgraph, finally the label layout is performed on the subgraph. All subgraphs of the nested graph including the top-level graph are treated in this way. All layouts are performed with the same global layout parameters as the layout instances passed as arguments to the constructor of IlvRecursiveMultipleLayout, which are called the reference layouts. You can access the reference layout instances to change the global layout parameters:
 IlvTreeLayout treeLayout =
     (IlvTreeLayout)layout.getFirstReferenceGraphLayout();
 treeLayout.setFlowDirection(IlvDirection.Left);
 IlvLinkLayout linkLayout =
     (IlvLinkLayout)layout.getSecondReferenceGraphLayout();
 linkLayout.setLinkOffset(5f);
 IlvAnnealingLabelLayout labelLayout =
     (IlvAnnealingLabelLayout)layout.getReferenceLabelLayout();
 labelLayout.setObstacleOffset(20f); 
Internally, a clone of the reference instance is created for each subgraph. This clone remains attached as long as the Recursive Multiple Layout is attached to the top-level graph. Before layout is performed, the global layout parameters are copied from the reference instance to each clone. If you need to set layout parameters for individual nodes, links, or labels, you have to access the layout instance of the subgraph that owns the node, link, or label:
 IlvTreeLayout treeLayout = (IlvTreeLayout)layout.getFirstGraphLayout(subgraph);
 treeLayout.setAlignment(node, IlvTreeLayout.TIP_OVER);
 IlvLinkLayout linkLayout = (IlvLinkLayout)layout.getSecondGraphLayout(subgraph);
 linkLayout.setLinkStyle(link, IlvLinkLayout.ORTHOGONAL_STYLE);
 IlvAnnealingLabelLayout labelLayout = (IlvAnnealingLabelLayout)layout.getLabelLayout(subgraph);
 labelLayout.setLabelDescriptor(label, descriptor); 

In the typical case, when you use instances of IlvGraphic as nodes and instances of IlvGrapher as subgraphs, it is:

 IlvTreeLayout treeLayout = (IlvTreeLayout)layout.getFirstGraphLayout(node.getGraphicBag());
 treeLayout.setAlignment(node, IlvTreeLayout.TIP_OVER);
 ... 

Second scenario: Different layout styles at different subgraphs

The following example shows the second scenario: Each subgraph should be laid out by a different layout style or with individual layout parameters. In this case, there are no reference layouts. You specify the layouts of subgraphs in a very convenient way:

 IlvRecursiveMultipleLayout layout = new IlvRecursiveMultipleLayout();
 layout.attach(topLevelGrapher);
 // specify the layout of the top-level graph
 layout.setLayout(null, new IlvGridLayout(),
                        new IlvLinkLayout(),
                        new IlvRandomLabelLayout()); 
 // specify the layout of subgraphs
 layout.setLayout(subgraph1, new IlvTreeLayout(),
                             new IlvLinkLayout(),
                             new IlvAnnealingLabelLayout()); 
 layout.setLayout(subgraph2, new IlvHierarchicalLayout(),
                             new IlvLinkLayout(),
                             new IlvAnnealingLabelLayout()); 
 // perform the layout
 IlvLayoutReport report = layout.performLayout(true, true); 
In this scenario, all layout parameters of different subgraphs are independent. You access the layout instance of each individual subgraph in the same way as when you have a reference layout. This allows you to change global layout parameters for this subgraph as well as parameters of nodes, links, or labels of the subgraph.

Notes:

Since:
JViews 5.5
See Also:
Serialized Form

Field Summary
static int ACTIVE
          The sublayout is active for all subgraphs.
static int INACTIVE
          The sublayout is inactive for all subgraphs.
static int MIXED
          The sublayout can be active or inactive for individual subgraphs.
 
Fields inherited from class ilog.views.graphlayout.recursive.IlvRecursiveLayout
INTERNAL_PROVIDER_MODE, PROPAGATE_CLASS_MISMATCH, PROPAGATE_EXCEPTION, PROPAGATE_PARAMETER_AMBIGUOUS, PROPAGATE_PARAMETER_MISMATCH, PROPAGATE_PARAMETER_SET, REFERENCE_LAYOUT_MODE, SPECIFIED_PROVIDER_MODE
 
Fields inherited from class ilog.views.graphlayout.IlvGraphLayout
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
 
Constructor Summary
IlvRecursiveMultipleLayout()
          Creates a new instance of the Recursive Multiple Layout algorithm that allows you to apply layouts to the entire nested graph.
IlvRecursiveMultipleLayout(IlvGraphLayout referenceLayout1, IlvGraphLayout referenceLayout2)
          Creates a new instance of the Recursive Multiple Layout algorithm.
IlvRecursiveMultipleLayout(IlvGraphLayout referenceLayout1, IlvGraphLayout referenceLayout2, IlvLabelLayout referenceLayout3)
          Creates a new instance of the Recursive Multiple Layout algorithm that allows you to apply the reference layouts to the entire nested graph.
IlvRecursiveMultipleLayout(IlvLabelLayout referenceLayout)
          Creates a new instance of the Recursive Multiple Layout algorithm that allows you to apply the reference label layout to the entire nested graph.
IlvRecursiveMultipleLayout(IlvRecursiveMultipleLayout source)
          Creates a new layout instance by copying an existing one.
 
Method Summary
 void addSubLabelLayoutEventListener(LabelLayoutEventListener listener)
          Adds a listener for the layout events delivered during the label layout of subgraphs.
 void attach(IlvGraphModel graphModel)
          Allows you to specify the top-level graph model of the nested graph you want to lay out.
 IlvGraphLayout copy()
          Copies the layout instance.
 void copyParameters(IlvGraphLayout source)
          Copies the parameters from a given layout instance.
 void detach()
          Detaches the graph model from the layout instance.
 IlvGraphLayout getFirstGraphLayout(Object subgraph)
          Returns the layout instance to be used for the input subgraph as the first layout.
 int getFirstGraphLayoutActive()
          Returns whether the first graph layout of all subgraphs is active.
 int getFirstGraphLayoutActiveDuringAutoLayout()
          Tests if the first graph layout of all subgraphs is active during automatic layout.
 IlvGraphLayout getFirstReferenceGraphLayout()
          Returns the first reference graph layout, if the reference layout mode is used.
 IlvLabelLayout getLabelLayout(Object subgraph)
          Returns the layout instance to be used for the input subgraph as the label layout.
 int getLabelLayoutActive()
          Returns whether the label layout of all subgraphs is active.
 int getLabelLayoutActiveDuringAutoLayout()
          Tests if the label layout of all subgraphs is active during automatic layout.
 IlvGraphLayout getLayout(Object subgraph)
          Returns the layout instance to be used for the input subgraph.
 IlvLabelingModel getReferenceLabelingModel()
          Returns the reference labeling model used for the label layout.
 IlvLabelLayout getReferenceLabelLayout()
          Returns the reference label layout, if the reference layout mode is used.
 IlvGraphLayout getSecondGraphLayout(Object subgraph)
          Returns the layout instance to be used for the input subgraph as the second layout.
 int getSecondGraphLayoutActive()
          Tests if the second graph layout of all subgraphs is active.
 int getSecondGraphLayoutActiveDuringAutoLayout()
          Tests if the second graph layout of all subgraphs is active during automatic layout.
 IlvGraphLayout getSecondReferenceGraphLayout()
          Returns the second reference graph layout, if the reference layout mode is used.
protected  void init()
          Initializes instance variables.
 void layoutStepPerformed(GraphLayoutEvent event)
          This method is called by the graph layouts of subgraphs.
 void layoutStepPerformed(LabelLayoutEvent event)
          This method is called by the label layout.
protected  int performSublayout(Object subgraph, IlvGraphLayout layout, boolean force, boolean redraw)
          Starts the input layout algorithm.
 void propagateFirstGraphLayoutActive(boolean active)
          Sets whether the first graph layout of all subgraphs is active.
 void propagateLabelLayoutActive(boolean active)
          Sets whether the label layout of all subgraphs is active.
 void propagateSecondGraphLayoutActive(boolean active)
          Sets whether the second graph layout of all subgraphs is active.
 void removeSubLabelLayoutEventListener(LabelLayoutEventListener listener)
          Removes a listener for the layout events delivered during the label layout of subgraphs.
 void setFirstGraphLayoutActive(boolean active)
          Deprecated. Beginning with ILOG JViews 8.1, use propagateFirstGraphLayoutActive(boolean) instead.
 void setFirstGraphLayoutActive(int active)
          Sets whether the first graph layout of all subgraphs is active.
 void setFirstGraphLayoutActiveDuringAutoLayout(int active)
          Sets whether the first graph layout of all subgraphs is active during automatic layout.
 void setLabelLayoutActive(boolean active)
          Deprecated. Beginning with ILOG JViews 8.1, use propagateLabelLayoutActive(boolean) instead.
 void setLabelLayoutActive(int active)
          Sets whether the label layout of all subgraphs is active.
 void setLabelLayoutActiveDuringAutoLayout(int active)
          Sets whether the label layout of all subgraphs is active during automatic layout.
 void setLayout(Object subgraph, IlvGraphLayout layout)
          Sets the layout instance to be used for the input subgraph.
 void setLayout(Object subgraph, IlvGraphLayout layout, boolean detachPrevious, boolean traverse)
          Sets the layout instance to be used for the input subgraph.
 void setLayout(Object subgraph, IlvGraphLayout layout1, IlvGraphLayout layout2)
          Sets the layout instances to be used for the input subgraph.
 void setLayout(Object subgraph, IlvGraphLayout layout1, IlvGraphLayout layout2, IlvLabelLayout layout3)
          Sets the layout instances to be used for the input subgraph.
 void setReferenceLabelingModel(IlvLabelingModel model)
          Sets the reference labeling model to be used for the label layouts.
 void setSecondGraphLayoutActive(boolean active)
          Deprecated. Beginning with ILOG JViews 8.1, use propagateSecondGraphLayoutActive(boolean) instead.
 void setSecondGraphLayoutActive(int active)
          Sets whether the second graph layout of all subgraphs is active.
 void setSecondGraphLayoutActiveDuringAutoLayout(int active)
          Sets whether the second graph layout of all subgraphs is active during automatic layout.
 
Methods inherited from class ilog.views.graphlayout.recursive.IlvRecursiveLayout
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, addSubLayoutEventListener, checkAppropriateLinks, contentsChanged, createLayoutGrapherProperty, createLayoutReport, getLayoutMode, getLayoutProvider, getLayoutReport, getLayouts, getReferenceLayout, getSubgraphCorrectionInterface, isGeometryUpToDate, isLoadLayoutModeFromNamesProperties, isParametersUpToDate, isSavePreferredLayoutsToNamedProperties, isStructureUpToDate, layout, performLayout, performLayout, performLayout, propagateAndApply, propagateLayoutOfConnectedComponents, propagateLayoutOfConnectedComponentsEnabled, propagateLayoutParameter, propagateLayoutParameter, propagateLayoutParameter, propagateLayoutParameter, propagateLayoutParameter, propagateLayoutParameter, propagateLayoutParameter, propagateLinkClipInterface, propagateLinkConnectionBoxInterface, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, removeSubLayoutEventListener, setAutoLayout, setConnectionPointCheckEnabled, setCoordinatesMode, setInputCheckEnabled, setLinkCheckEnabled, setLoadLayoutModeFromNamesProperties, setMinBusyTime, setSavePreferredLayoutsToNamedProperties, setSubgraphCorrectionInterface, setUseDefaultParameters, stopImmediately, supportsAllowedTime, supportsPercentageComplete, supportsSaveParametersToNamedProperties, supportsStopImmediately, useAnimateRedraw
 
Methods inherited from class ilog.views.graphlayout.IlvGraphLayout
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, afterLayoutOfSubgraph, attach, beforeLayout, beforeLayoutOfSubgraph, callLayoutStepPerformedIfNeeded, checkAppropriateLink, cleanGraphModel, cleanLink, cleanNode, clipAllLinks, clipLink, createLayoutLinkProperty, createLayoutNodeProperty, getAllowedTime, getAutoLayoutHandler, getBalanceSplineCurveThreshold, getCalcLayoutRegion, getCoordinatesMode, getGrapher, getGraphModel, getInstanceId, getLayoutOfConnectedComponents, getLayoutOfConnectedComponentsReport, getLayoutRegion, getLayoutReport, getLinkClipInterface, getLinkConnectionBoxInterface, getMaxSplineCurveSize, getMinBusyTime, getMinSplineCurveSize, getMovingNodes, getParentLayout, getProperty, getProperty, getRecursiveLayout, getRemainingAllowedTime, getSeedValueForRandomGenerator, getSpecLayoutRegion, getSplineLinkFilter, increasePercentageComplete, isAnimate, isAutoLayout, isFitToView, isFixed, isInputCheckEnabled, isLayoutNeeded, isLayoutOfConnectedComponentsEnabled, isLayoutOfConnectedComponentsEnabledByDefault, isLayoutRunning, isLayoutTimeElapsed, isMemorySavings, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performAutoLayout, performLayout, PerformLayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, setAllowedTime, setAnimate, setAutoLayoutHandler, setBalanceSplineCurveThreshold, setFixed, setGeometryUpToDate, setGrapher, setGraphModel, setLayoutOfConnectedComponents, setLayoutOfConnectedComponentsEnabled, setLayoutRegion, setLayoutRegion, setLayoutRegion, setLayoutReport, setLinkClipInterface, setLinkConnectionBoxInterface, setMaxSplineCurveSize, setMemorySavings, setMinSplineCurveSize, setParametersUpToDate, setParentLayout, setPreserveFixedLinks, setPreserveFixedNodes, setProperty, setProperty, setSeedValueForRandomGenerator, setSplineLinkFilter, setSplineRoutingEnabled, setStructureUpToDate, setUseSeedValueForRandomGenerator, supportsAnimation, supportsLayoutOfConnectedComponents, supportsLayoutRegion, supportsLinkClipping, supportsLinkConnectionBox, supportsMemorySavings, supportsPreserveFixedLinks, supportsPreserveFixedNodes, supportsRandomGenerator, supportsSplineRouting, unfixAllLinks, unfixAllNodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTIVE

public static final int ACTIVE
The sublayout is active for all subgraphs.

Since:
JViews 8.1
See Also:
setFirstGraphLayoutActive(int), setFirstGraphLayoutActiveDuringAutoLayout(int), setSecondGraphLayoutActive(int), setSecondGraphLayoutActiveDuringAutoLayout(int), setLabelLayoutActive(int), setLabelLayoutActiveDuringAutoLayout(int), Constant Field Values

INACTIVE

public static final int INACTIVE
The sublayout is inactive for all subgraphs.

Since:
JViews 8.1
See Also:
setFirstGraphLayoutActive(int), setFirstGraphLayoutActiveDuringAutoLayout(int), setSecondGraphLayoutActive(int), setSecondGraphLayoutActiveDuringAutoLayout(int), setLabelLayoutActive(int), setLabelLayoutActiveDuringAutoLayout(int), Constant Field Values

MIXED

public static final int MIXED
The sublayout can be active or inactive for individual subgraphs.

Since:
JViews 8.1
See Also:
setFirstGraphLayoutActive(int), setFirstGraphLayoutActiveDuringAutoLayout(int), setSecondGraphLayoutActive(int), setSecondGraphLayoutActiveDuringAutoLayout(int), setLabelLayoutActive(int), setLabelLayoutActiveDuringAutoLayout(int), Constant Field Values
Constructor Detail

IlvRecursiveMultipleLayout

public IlvRecursiveMultipleLayout(IlvGraphLayout referenceLayout1,
                                  IlvGraphLayout referenceLayout2)
Creates a new instance of the Recursive Multiple Layout algorithm. This algorithm allows you to apply the reference layouts to the entire nested graph.

Use this constructor if you want to apply the same layout styles with the same global layout parameters to all subgraphs of the nested graph. The layout mode of this Recursive Multiple Layout is IlvRecursiveLayout.REFERENCE_LAYOUT_MODE.

This constructor behaves like a recursive layout that contains a multiple layout. The following code example using IlvRecursiveMultipleLayout:

 layout = new IlvRecursiveMultipleLayout(layout1, layout2);
is equivalent to:
 layout = new IlvRecursiveLayout(
                new IlvMultipleLayout(layout1, layout2));

The reference graph layouts must not be an instance of IlvRecursiveLayout.

To indicate the top-level grapher of the nesting hierarchy you want to lay out, use the method attach(IlvGrapher).
To indicate the graph model of the top-level graph of the nesting hierarchy to lay out, call attach(IlvGraphModel).
To perform the layout, call performLayout(boolean, boolean).

Since:
JViews 8.1
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvGraphLayout.performLayout(boolean, boolean), IlvRecursiveLayout.getLayoutMode()

IlvRecursiveMultipleLayout

public IlvRecursiveMultipleLayout(IlvGraphLayout referenceLayout1,
                                  IlvGraphLayout referenceLayout2,
                                  IlvLabelLayout referenceLayout3)
Creates a new instance of the Recursive Multiple Layout algorithm that allows you to apply the reference layouts to the entire nested graph. You should use this constructor if you want to apply the same layout styles with the same global layout parameters to all subgraphs of the nested graph. The layout mode of this Recursive Multiple Layout is IlvRecursiveLayout.REFERENCE_LAYOUT_MODE.

This constructor behaves basically like a Recursive Layout that contains a Multiple Layout. The code

 layout = new IlvRecursiveMultipleLayout(layout1, layout2, layout3);
is equivalent to
 layout = new IlvRecursiveLayout(
                new IlvMultipleLayout(layout1, layout2, layout3));

The reference graph layouts must not be an instance of IlvRecursiveLayout.

To indicate the top-level grapher of the nesting hierarchy you want to lay out, use the method attach(IlvGrapher).
To indicate the graph model of the top-level graph of the nesting hierarchy you want to lay out, use the method attach(IlvGraphModel).
To perform the layout, use the method performLayout(boolean, boolean).

See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvGraphLayout.performLayout(boolean, boolean), IlvRecursiveLayout.getLayoutMode()

IlvRecursiveMultipleLayout

public IlvRecursiveMultipleLayout(IlvLabelLayout referenceLayout)
Creates a new instance of the Recursive Multiple Layout algorithm that allows you to apply the reference label layout to the entire nested graph. You should use this constructor if you want to apply the same label layout algorithm with the same global layout parameters to all subgraphs of the nested graph. The layout mode of this Recursive Multiple Layout is IlvRecursiveLayout.REFERENCE_LAYOUT_MODE.

This constructor behaves basically like a Recursive Layout that contains a Multiple Layout that contains the label layout. The code

 layout = new IlvRecursiveMultipleLayout(labelLayout);
is equivalent to
 layout = new IlvRecursiveLayout(
                new IlvMultipleLayout(null, null, labelLayout));

To indicate the top-level grapher of the nesting hierarchy you want to lay out, use the method attach(IlvGrapher).
To indicate the graph model of the top-level graph of the nesting hierarchy you want to lay out, use the method attach(IlvGraphModel).
To perform the layout, use the method performLayout(boolean, boolean).

See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvGraphLayout.performLayout(boolean, boolean), IlvRecursiveLayout.getLayoutMode()

IlvRecursiveMultipleLayout

public IlvRecursiveMultipleLayout()
Creates a new instance of the Recursive Multiple Layout algorithm that allows you to apply layouts to the entire nested graph. You should use this constructor if you want to apply different layout styles or individual layout parameters to each subgraph of the nested graph. After attaching the top-level grapher or graph model, you can specify which layout is applied to which subgraph by using setLayout(Object, IlvGraphLayout, IlvGraphLayout, IlvLabelLayout). The layout mode of this Recursive Multiple Layout is IlvRecursiveLayout.INTERNAL_PROVIDER_MODE.

To indicate the top-level grapher of the nesting hierarchy you want to lay out, use the method attach(IlvGrapher).
To indicate the graph model of the top-level graph of the nesting hierarchy you want to lay out, use the method attach(IlvGraphModel).
To perform the layout, use the method performLayout(boolean, boolean).

See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvGraphLayout.performLayout(boolean, boolean), IlvRecursiveLayout.getLayoutMode()

IlvRecursiveMultipleLayout

public IlvRecursiveMultipleLayout(IlvRecursiveMultipleLayout source)
Creates a new layout instance by copying an existing one. This constructor is used by the copy() method. Any subclass should provide a copy constructor.

The parameters of the source layout are copied using the method copyParameters(IlvGraphLayout).

Parameters:
source - The layout instance that is copied.
See Also:
copy(), copyParameters(ilog.views.graphlayout.IlvGraphLayout)
Method Detail

init

protected void init()
Initializes instance variables.

You should not call this method directly. The method is called internally by the constructor without arguments and by the copy constructor. The method must be overridden by subclasses that need to initialize additional instance variables.

Overrides:
init in class IlvRecursiveLayout

copy

public IlvGraphLayout copy()
Copies the layout instance.

This method copies the layout instance by calling the copy constructor. Note that the parameters which are specific to a node or a link are not copied. The reference labeling model is not copied. It depends on the layout mode what is copied:

Overrides:
copy in class IlvRecursiveLayout
Returns:
A copy of the layout instance.
See Also:
IlvRecursiveMultipleLayout(IlvRecursiveMultipleLayout), copyParameters(ilog.views.graphlayout.IlvGraphLayout), IlvRecursiveLayout.getLayoutMode()

copyParameters

public void copyParameters(IlvGraphLayout source)
Copies the parameters from a given layout instance. Note that the parameters which are specific to a node or a link are not copied. The reference labeling model is not copied. It depends on the layout mode what is copied:

Overrides:
copyParameters in class IlvRecursiveLayout
Parameters:
source - The layout instance from which the parameters are copied.
See Also:
copy(), IlvRecursiveLayout.getLayoutMode()

setReferenceLabelingModel

public void setReferenceLabelingModel(IlvLabelingModel model)
Sets the reference labeling model to be used for the label layouts. This can be used in all layout modes.

If this layout instance is attached to a grapher or grapher adapter, an IlvDefaultLabelingModel is created internally and attached to the label layout by default. You can use this method to specify a different labeling model.

If you want to attach this layout instance to a graph model that is not based on a grapher, you must set the labeling model before attaching the Recursive Multiple Layout.

The reference labeling model is used to attach the label layout of the top-level graph. Clones of the reference labeling model are used to attach the label layout of subgraphs that are nested inside. The clones are created by calling IlvLabelingModel.createLabelingModel(Object) on the reference labeling model.

Note that all these labeling models are disposed of when the layout is detached and cannot be used afterwards. Therefore you have to call setLabelingModel each time immediately before attaching it.

Parameters:
model - The labeling model.
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel)

getReferenceLabelingModel

public IlvLabelingModel getReferenceLabelingModel()
Returns the reference labeling model used for the label layout. If the reference labeling model is null, an IlvDefaultLabelingModel is used when possible.


getFirstReferenceGraphLayout

public IlvGraphLayout getFirstReferenceGraphLayout()
Returns the first reference graph layout, if the reference layout mode is used. Returns null otherwise.

In reference layout mode, the reference layout is used to lay out the top-level graph. Clones of the reference layout are used to lay out the subgraphs. The entire nested graph is laid out with the global layout parameters of the reference layout. If you change global layout parameters of the reference layout, this will affect the layout of subgraphs as well, because the global layout parameters are copied from the reference layout to the layouts of the subgraphs.

See Also:
IlvRecursiveLayout.getLayoutMode(), IlvRecursiveMultipleLayout(IlvGraphLayout, IlvGraphLayout, IlvLabelLayout)

getSecondReferenceGraphLayout

public IlvGraphLayout getSecondReferenceGraphLayout()
Returns the second reference graph layout, if the reference layout mode is used. Returns null otherwise.

In reference layout mode, the reference layout is used to lay out the top-level graph. Clones of the reference layout are used to lay out the subgraphs. The entire nested graph is laid out with the global layout parameters of the reference layout. If you change global layout parameters of the reference layout, this will affect the layout of subgraphs as well, because the global layout parameters are copied from the reference layout to the layouts of the subgraphs.

See Also:
IlvRecursiveLayout.getLayoutMode(), IlvRecursiveMultipleLayout(IlvGraphLayout, IlvGraphLayout, IlvLabelLayout)

getReferenceLabelLayout

public IlvLabelLayout getReferenceLabelLayout()
Returns the reference label layout, if the reference layout mode is used. Returns null otherwise.

In reference layout mode, the reference layout is used to lay out the top-level graph. Clones of the reference layout are used to lay out the subgraphs. The entire nested graph is laid out with the global layout parameters of the reference layout. If you change global layout parameters of the reference layout, this will affect the layout of subgraphs as well, because the global layout parameters are copied from the reference layout to the layouts of the subgraphs.

See Also:
IlvRecursiveLayout.getLayoutMode(), IlvRecursiveMultipleLayout(IlvLabelLayout), IlvRecursiveMultipleLayout(IlvGraphLayout, IlvGraphLayout, IlvLabelLayout)

setLayout

public void setLayout(Object subgraph,
                      IlvGraphLayout layout)
Sets the layout instance to be used for the input subgraph. The input layout must be an instance of IlvMultipleLayout. If null is passed as the subgraph, the input layout is used for the top-level graph. If null is passed as the layout, no layout will be performed for the corresponding subgraph.

You can use this method only in internal provider mode. You must attach a grapher or graph model first before using this method. Each subgraph must get a different layout instance, that is, the layout instances cannot be shared among different subgraphs. The input layout is automatically attached and detached by the Recursive Multiple Layout as needed.

Overrides:
setLayout in class IlvRecursiveLayout
Parameters:
subgraph - The subgraph or null.
layout - The layout instance used to lay out the subgraph. This can be null, or must be an instance of IlvMultipleLayout.
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), setLayout(Object, IlvGraphLayout, IlvGraphLayout, IlvLabelLayout), IlvRecursiveLayout.getLayoutMode(), IlvRecursiveMultipleLayout(), getLayout(java.lang.Object)

setLayout

public void setLayout(Object subgraph,
                      IlvGraphLayout layout,
                      boolean detachPrevious,
                      boolean traverse)
Sets the layout instance to be used for the input subgraph. The input layout must be an instance of IlvMultipleLayout. If the traverse flag is true, it traverses the nested graph starting from the input graph and sets a clone of the input layout recursively for each subgraphs. Notice that if you insert subgraphs after calling this method, the new subgraphs have no layout yet assigned.

If null is passed as the subgraph, the input layout is used for the top-level graph, and the traversal, if any, starts at the top-level graph. If null is passed as the layout, no layout will be performed for the corresponding subgraphs.

You can use this method only in internal provider mode. Each subgraph must get a different layout instance, that is, the layout instances cannot be shared among different subgraphs. You must attach a grapher or graph model first before using this method. The input layout is automatically attached and detached by the Recursive Multiple Layout as needed.

Overrides:
setLayout in class IlvRecursiveLayout
Parameters:
subgraph - The subgraph or null.
layout - The layout instance used to lay out the subgraph. This must be an instance of IlvMultipleLayout.
detachPrevious - If true, the layout instance previously specified as the preferred layout of the subgraph (if any) is detached.
traverse - If true, clones of the input layout are recursively used for all current subgraphs of the input graph.
See Also:
setLayout(Object, IlvGraphLayout), IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvRecursiveLayout.getLayoutMode(), IlvRecursiveMultipleLayout(), getLayout(java.lang.Object)

setLayout

public void setLayout(Object subgraph,
                      IlvGraphLayout layout1,
                      IlvGraphLayout layout2)
Sets the layout instances to be used for the input subgraph. If null is passed as the subgraph, the input layout is used for the top-level graph. Internally, a Multiple Layout is created that contains the input layouts as sublayouts.

When the Recursive Multiple Layout is performed, layout1 is applied first and layout2 second to the input subgraph.

You can use this method only in internal provider mode. You must attach a grapher or graph model before using this method. Each subgraph must get different layout instances, that is, the layout instances cannot be shared among different subgraphs. The input layouts are automatically attached and detached by the recursive multiple layout as needed.

Parameters:
subgraph - The subgraph or null.
layout1 - The first graph layout used to lay out the subgraph.
layout2 - The second graph layout used to lay out the subgraph.
Since:
JViews 8.1
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvRecursiveLayout.getLayoutMode(), IlvRecursiveMultipleLayout(), getLayout(java.lang.Object), getFirstGraphLayout(java.lang.Object), getSecondGraphLayout(java.lang.Object)

setLayout

public void setLayout(Object subgraph,
                      IlvGraphLayout layout1,
                      IlvGraphLayout layout2,
                      IlvLabelLayout layout3)
Sets the layout instances to be used for the input subgraph. If null is passed as the subgraph, the input layout is used for the top-level graph. Internally, a Multiple Layout is created that contains the input layouts as sublayouts.

When the Recursive Multiple Layout is performed, layout1 is applied first, layout2 second, and layout3 last to the input subgraph.

You can use this method only in internal provider mode. You must attach a grapher or graph model first before using this method. Each subgraph must get different layout instances, that is, the layout instances cannot be shared among different subgraphs. The input layouts are automatically attached and detached by the Recursive Multiple Layout as needed.

Parameters:
subgraph - The subgraph or null.
layout1 - The first graph layout used to lay out the subgraph.
layout2 - The second graph layout used to lay out the subgraph.
layout3 - The label layout used to lay out the subgraph.
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvRecursiveLayout.getLayoutMode(), IlvRecursiveMultipleLayout(), getLayout(java.lang.Object), getFirstGraphLayout(java.lang.Object), getSecondGraphLayout(java.lang.Object), getLabelLayout(java.lang.Object)

getFirstGraphLayout

public IlvGraphLayout getFirstGraphLayout(Object subgraph)
Returns the layout instance to be used for the input subgraph as the first layout. If null is passed as the subgraph, the layout instance of the top-level graph is returned. You can use this method in all layout modes. You must attach a grapher or graph model first before using this method. The method may return null if no layout should be performed for the subgraph.

In reference layout mode, changing global layout parameters of the layout instances of subgraphs is useless, because during layout, the global parameters of the first reference graph layout are used for each subgraph.

Parameters:
subgraph - The subgraph or null.
Returns:
The layout instance used as the first layout for the subgraph.
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvRecursiveLayout.getLayoutMode(), setLayout(Object, IlvGraphLayout, IlvGraphLayout, IlvLabelLayout)

getSecondGraphLayout

public IlvGraphLayout getSecondGraphLayout(Object subgraph)
Returns the layout instance to be used for the input subgraph as the second layout. If null is passed as the subgraph, the layout instance of the top-level graph is returned. You can use this method in all layout modes. You must attach a grapher or graph model first before using this method. The method may return null if no layout should be performed for the subgraph.

In reference layout mode, changing global layout parameters of the layout instances of subgraphs is useless, because during layout, the global parameters of the second reference graph layout are used for each subgraph.

Parameters:
subgraph - The subgraph or null.
Returns:
The layout instance used as the second layout for the subgraph.
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvRecursiveLayout.getLayoutMode(), setLayout(Object, IlvGraphLayout, IlvGraphLayout, IlvLabelLayout)

getLabelLayout

public IlvLabelLayout getLabelLayout(Object subgraph)
Returns the layout instance to be used for the input subgraph as the label layout. If null is passed as the subgraph, the layout instance of the top-level graph is returned. You can use this method in all layout modes. You must attach a grapher or graph model first before using this method. The method may return null if no layout should be performed for the subgraph.

In reference layout mode, changing global layout parameters of the layout instances of subgraphs is useless, because during layout, the global parameters of the reference label layout are used for each subgraph.

Parameters:
subgraph - The subgraph or null.
Returns:
The layout instance used as the label layout for the subgraph.
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvRecursiveLayout.getLayoutMode(), setLayout(Object, IlvGraphLayout, IlvGraphLayout, IlvLabelLayout)

getLayout

public IlvGraphLayout getLayout(Object subgraph)
Returns the layout instance to be used for the input subgraph. Here, it always returns an instance of IlvMultipleLayout. If null is passed as the subgraph, the layout instance of the top-level graph is returned. You can use this method in all layout modes. You must attach a grapher or graph model first before using this method. The method may return null if no layout should be performed for the subgraph.

In reference layout mode, changing global layout parameters of the layout instances of subgraphs is useless, because during layout, the global parameters of the reference layout are used for each subgraph.

Overrides:
getLayout in class IlvRecursiveLayout
Parameters:
subgraph - The subgraph or null.
Returns:
The Multiple Layout instance used to lay out the subgraph.
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvRecursiveLayout.getLayoutMode(), setLayout(java.lang.Object, ilog.views.graphlayout.IlvGraphLayout)

attach

public void attach(IlvGraphModel graphModel)
Allows you to specify the top-level graph model of the nested graph you want to lay out. In addition to the functionality of the base class, the Recursive Multiple Layout prepares and attaches the reference layouts in layout mode IlvRecursiveLayout.REFERENCE_LAYOUT_MODE. If a label layout algorithm is used but no reference labeling model was specified before, it tries to use an IlvDefaultLabelingModel.

Overrides:
attach in class IlvRecursiveLayout
Parameters:
graphModel - The graph model.
See Also:
detach(), setReferenceLabelingModel(ilog.views.graphlayout.labellayout.IlvLabelingModel)

detach

public void detach()
Detaches the graph model from the layout instance. When you attach a new graph model to the layout instance, you do not need to detach the old graph model because this is done automatically when you call IlvGraphLayout.attach(IlvGraphModel). The detach method performs cleaning operations on the graph model. In addition to the cleaning operations in the base class, the Recursive Multiple Layout detaches the sublayouts of subgraphs and disposes of the labeling models including the reference labeling model. In internal provider mode, it also cleans all settings of layout instances for subgraphs.

Note that you must call this method when you no longer need the layout instance. Otherwise, some objects may not be garbage collected.

Overrides:
detach in class IlvRecursiveLayout
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), setLayout(java.lang.Object, ilog.views.graphlayout.IlvGraphLayout)

performSublayout

protected int performSublayout(Object subgraph,
                               IlvGraphLayout layout,
                               boolean force,
                               boolean redraw)
                        throws IlvGraphLayoutException
Starts the input layout algorithm. This method is used when this layout controls the input layout as the sublayout. Layout classes can override this method if changes are needed with respect to the way in which the input layout is started.