ilog.views.graphlayout.multiple
Class IlvMultipleLayout

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

public class IlvMultipleLayout
extends IlvGraphLayout
implements LabelLayoutEventListener, GraphLayoutEventListener

The main class for the Multiple Layout algorithm.

This is not a layout algorithm but rather a facility to compose multiple layout algorithms and treat them as one algorithm object. This is more convenient if a sequence of layout algorithms must be applied to subgraphs. 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 sample shows how to achieve this by using the Multiple Layout class:

 IlvGraphLayout layout = new IlvMultipleLayout(
                               new IlvTreeLayout(),
                               new IlvLinkLayout(),
                               new IlvAnnealingLabelLayout());
 layout.attach(grapher);
 layout.performLayout(true, true, true);
 
If more than two graph layouts and one label layout are necessary, you can construct an IlvMultipleLayout from another IlvMultipleLayout, as follows:
 IlvGraphLayout layout = new IlvMultipleLayout(
                               new IlvMultipleLayout(layout1, layout2, null),
                               new IlvMultipleLayout(layout3, layout4, null),
                               labelLayout);
 
The multiple layout offers only a few layout parameters that are global to all three sublayouts (such as the allowed time), but you can specify the other layout parameters individually for each sublayout by accessing getFirstGraphLayout(), getSecondGraphLayout(), and getLabelLayout() directly.

If complex combinations of graph layouts and label layouts are needed in a nested graph, you should use the Recursive Multiple Layout (see IlvRecursiveMultipleLayout) that utilizes the Multiple Layout inside a Recursive Layout.

Since:
JViews 5.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ilog.views.graphlayout.IlvGraphLayout
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
 
Constructor Summary
IlvMultipleLayout()
          Creates a new instance of the Multiple Layout algorithm.
IlvMultipleLayout(IlvGraphLayout layout1, IlvGraphLayout layout2)
          Creates a new instance of the Multiple Layout algorithm that composes the input layouts.
IlvMultipleLayout(IlvGraphLayout layout1, IlvGraphLayout layout2, IlvLabelLayout layout3)
          Creates a new instance of the Multiple Layout algorithm that composes the input layouts.
IlvMultipleLayout(IlvMultipleLayout source)
          Creates a new layout instance by copying an existing one.
 
Method Summary
 void attach(IlvGraphModel graphModel)
          Allows you to specify the graph model you want to lay out.
 void checkAppropriateLinks()
          Throws an exception if the links are not appropriate for the layout.
 IlvGraphLayout copy()
          Copies the layout instance.
 void copyParameters(IlvGraphLayout source)
          Copies the parameters from a given layout instance.
protected  IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name, boolean withDefaults)
          Returns a new instance of IlvMultipleLayoutGrapherProperty that stores the parameter settings of this layout class.
 IlvGraphLayoutReport createLayoutReport()
          Returns a new instance of the layout report.
 void detach()
          Detaches the graph model from the layout instance.
 IlvGraphLayout getFirstGraphLayout()
          Returns the layout that is applied first.
 IlvLabelingModel getLabelingModel()
          Returns the labeling model used for the label layout.
 IlvLabelLayout getLabelLayout()
          Returns the label layout that is applied inside performLayout.
 IlvGraphicVector getMovingNodes()
          Returns the vector of nodes being moved by the graph layout algorithm.
 IlvGraphLayout getSecondGraphLayout()
          Returns the layout that is applied second.
protected  void init()
          Initializes instance variables.
 boolean isFirstGraphLayoutActive()
          Returns whether the first graph layout is active.
 boolean isFirstGraphLayoutPersistent()
          Returns whether the first graph layout is persistent.
 boolean isGeometryUpToDate()
          Returns false if at least one node, link, label, or obstacle was moved or reshaped since the last time the layout was successfully performed on the same graph or if the layout has never been performed successfully on the same graph.
 boolean isLabelLayoutActive()
          Returns whether the label layout is active.
 boolean isLabelLayoutPersistent()
          Returns whether the label layout is persistent.
 boolean isParametersUpToDate()
          Returns false if at least one parameter was modified since the last time the layout was successfully performed on the same graph or if the layout has never been performed successfully on the same graph.
 boolean isSecondGraphLayoutActive()
          Returns whether the second graph layout is active.
 boolean isSecondGraphLayoutPersistent()
          Returns whether the second graph layout is persistent.
 boolean isStructureUpToDate()
          Returns false if at least one modification occurred in the structure of the graph since the last time the layout was successfully performed on the same graph or if the layout has never been performed successfully on the same graph.
protected  void layout(boolean redraw)
          Computes the layout using the Multiple Layout algorithm.
 void layoutStepPerformed(GraphLayoutEvent event)
          This method is called by the first graph layout and the second graph layout.
 void layoutStepPerformed(LabelLayoutEvent event)
          This method is called by the label layout.
 void setAutoLayout(boolean enable)
          Enables the auto layout mode.
 void setCoordinatesMode(int mode)
          Sets the coordinates mode.
 void setFirstGraphLayout(IlvGraphLayout layout)
          Sets the first layout to be applied.
 void setFirstGraphLayoutActive(boolean active)
          Sets whether the first graph layout is active.
 void setFirstGraphLayoutPersistent(boolean persistent)
          Sets whether the first graph layout is persistent.
 void setGeometryUpToDate(boolean uptodate)
          Normally called with a false argument if the geometry of the graph changed.
 void setGraphModel(IlvGraphModel graphModel)
          Sets the graph model to be laid out.
 void setInputCheckEnabled(boolean enable)
          Enables the checks for the nodes, links, and/or labels provided as arguments for the different methods of this layout algorithm and its sublayout algorithms.
 void setLabelingModel(IlvLabelingModel model)
          Sets the labeling model to be used for the label layout.
 void setLabelLayout(IlvLabelLayout layout)
          Sets the label layout to be applied inside performLayout.
 void setLabelLayoutActive(boolean active)
          Sets whether the label layout is active.
 void setLabelLayoutPersistent(boolean persistent)
          Sets whether the label layout is persistent.
 void setMinBusyTime(long time)
          Sets the minimal time the layout algorithm can be busy between two calls of layoutStepPerformed when the method IlvGraphLayout.callLayoutStepPerformedIfNeeded() is used.
 void setParametersUpToDate(boolean uptodate)
          Automatically called with a false argument each time the value of a parameter is changed.
 void setSecondGraphLayout(IlvGraphLayout layout)
          Sets the second layout to be applied.
 void setSecondGraphLayoutActive(boolean active)
          Sets whether the second graph layout is active.
 void setSecondGraphLayoutPersistent(boolean persistent)
          Sets whether the second graph layout is persistent.
 void setSilentAttach(boolean flag)
          This method is used internally.
 void setStructureUpToDate(boolean uptodate)
          Normally called with a false argument if the structure of the graph changed.
 void setUseDefaultParameters(boolean option)
          Specifies whether default parameters are to be used in the layout.
 boolean stopImmediately()
          Stops the running layout algorithm as soon as possible.
 boolean supportsAllowedTime()
          Indicates whether the layout class can stop the layout computation when a user-defined allowed time is exceeded.
 boolean supportsLayoutOfConnectedComponents()
          Indicates whether the layout class can cut the attached graph into connected components, apply itself on each connected component separately, and then use the layout instance returned by the method IlvGraphLayout.getLayoutOfConnectedComponents() to position the connected components.
 boolean supportsPercentageComplete()
          Indicates whether the layout class can estimate the percentage of completion during the run of the layout.
 boolean supportsSaveParametersToNamedProperties()
          Indicates whether the layout class can transfer the layout parameters to named properties.
 boolean supportsStopImmediately()
          Indicates whether the layout class can immediately interrupt the current run of the layout in a controlled way.
 boolean useAnimateRedraw()
          Returns true if animation is supported and enabled for any sublayout of the Multiple Layout.
 
Methods inherited from class ilog.views.graphlayout.IlvGraphLayout
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, afterLayoutOfSubgraph, attach, beforeLayout, beforeLayoutOfSubgraph, callLayoutStepPerformedIfNeeded, checkAppropriateLink, cleanGraphModel, cleanLink, cleanNode, clipAllLinks, clipLink, contentsChanged, createLayoutLinkProperty, createLayoutNodeProperty, getAllowedTime, getAutoLayoutHandler, getBalanceSplineCurveThreshold, getCalcLayoutRegion, getCoordinatesMode, getGrapher, getGraphModel, getInstanceId, getLayout, getLayoutOfConnectedComponents, getLayoutOfConnectedComponentsReport, getLayoutRegion, getLayoutReport, getLayouts, getLinkClipInterface, getLinkConnectionBoxInterface, getMaxSplineCurveSize, getMinBusyTime, getMinSplineCurveSize, 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, performLayout, PerformLayout, performSublayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, setAllowedTime, setAnimate, setAutoLayoutHandler, setBalanceSplineCurveThreshold, setFixed, setGrapher, setLayoutOfConnectedComponents, setLayoutOfConnectedComponentsEnabled, setLayoutRegion, setLayoutRegion, setLayoutRegion, setLayoutReport, setLinkClipInterface, setLinkConnectionBoxInterface, setMaxSplineCurveSize, setMemorySavings, setMinSplineCurveSize, setParentLayout, setPreserveFixedLinks, setPreserveFixedNodes, setProperty, setProperty, setSeedValueForRandomGenerator, setSplineLinkFilter, setSplineRoutingEnabled, setUseSeedValueForRandomGenerator, supportsAnimation, 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
 

Constructor Detail

IlvMultipleLayout

public IlvMultipleLayout()
Creates a new instance of the Multiple Layout algorithm.
To indicate the grapher you want to lay out, use the method attach(IlvGrapher).
To indicate the graph model you want to lay out, use the method attach(IlvGraphModel).
To perform the layout, use the method performLayout.

See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), attach(ilog.views.graphlayout.IlvGraphModel), setLabelingModel(ilog.views.graphlayout.labellayout.IlvLabelingModel), IlvGraphLayout.performLayout(boolean, boolean, boolean)

IlvMultipleLayout

public IlvMultipleLayout(IlvGraphLayout layout1,
                         IlvGraphLayout layout2)
Creates a new instance of the Multiple Layout algorithm that composes the input layouts. If performLayout is called on this instance layout1 is performed first and layout2 is performed second. If a Recursive Layout is called for a nested graph on this instance, all two layouts are applied to each subgraph.

Note: layout1 and layout2 are finished for a subgraph before the layout1 of the parent graph is started.

Parameters:
layout1 - The first layout to be performed.
layout2 - The second layout to be performed.
Since:
JViews 8.1
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), attach(ilog.views.graphlayout.IlvGraphModel), IlvGraphLayout.performLayout(boolean, boolean, boolean)

IlvMultipleLayout

public IlvMultipleLayout(IlvGraphLayout layout1,
                         IlvGraphLayout layout2,
                         IlvLabelLayout layout3)
Creates a new instance of the Multiple Layout algorithm that composes the input layouts. If performLayout is called on this instance, then layout1 is performed first, layout2 is performed second, and layout3 is performed last. If a recursive layout is called for a nested graph on this instance, all three layouts are applied to each subgraph. However, notice that layout1, layout2, and layout3 are finished for a subgraph before the layout1 of the parent graph is started.

Parameters:
layout1 - The first layout to be performed.
layout2 - The second layout to be performed.
layout3 - The last layout to be performed.
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), attach(ilog.views.graphlayout.IlvGraphModel), setLabelingModel(ilog.views.graphlayout.labellayout.IlvLabelingModel), IlvGraphLayout.performLayout(boolean, boolean, boolean)

IlvMultipleLayout

public IlvMultipleLayout(IlvMultipleLayout 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(ilog.views.graphlayout.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 IlvGraphLayout

copy

public IlvGraphLayout copy()
Copies the layout instance.

This method copies the layout instance by calling the copy constructor.

When performing a recursive layout on a nested graph, this method is used by IlvLayoutProvider to "clone" the layout instance of a parent graph. Note that the parameters which are specific to a node or a link are not copied. The persistence flags are copied. The sublayout instances and their global layout parameters are copied. The labeling model is not copied.

Specified by:
copy in class IlvGraphLayout
Returns:
A copy of the layout instance.
See Also:
IlvMultipleLayout(IlvMultipleLayout), setFirstGraphLayout(ilog.views.graphlayout.IlvGraphLayout), setSecondGraphLayout(ilog.views.graphlayout.IlvGraphLayout), setLabelLayout(ilog.views.graphlayout.labellayout.IlvLabelLayout), setLabelingModel(ilog.views.graphlayout.labellayout.IlvLabelingModel), setFirstGraphLayoutPersistent(boolean), setSecondGraphLayoutPersistent(boolean), setLabelLayoutPersistent(boolean), copyParameters(ilog.views.graphlayout.IlvGraphLayout)

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 activation and persistence flags are copied. The sublayout instances and their global layout parameters are copied. The labeling model is not copied.

Overrides:
copyParameters in class IlvGraphLayout
Parameters:
source - The layout instance from which the parameters are copied.
See Also:
copy(), setFirstGraphLayout(ilog.views.graphlayout.IlvGraphLayout), setSecondGraphLayout(ilog.views.graphlayout.IlvGraphLayout), setLabelLayout(ilog.views.graphlayout.labellayout.IlvLabelLayout), setLabelingModel(ilog.views.graphlayout.labellayout.IlvLabelingModel), setFirstGraphLayoutPersistent(boolean), setSecondGraphLayoutPersistent(boolean), setLabelLayoutPersistent(boolean)

setFirstGraphLayout

public void setFirstGraphLayout(IlvGraphLayout layout)
Sets the first layout to be applied. You should set the layout before attaching the graph model.

Parameters:
layout - The first layout.
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), attach(ilog.views.graphlayout.IlvGraphModel), getFirstGraphLayout()

getFirstGraphLayout

public IlvGraphLayout getFirstGraphLayout()
Returns the layout that is applied first.

See Also:
setFirstGraphLayout(ilog.views.graphlayout.IlvGraphLayout)

setFirstGraphLayoutActive

public void setFirstGraphLayoutActive(boolean active)
Sets whether the first graph layout is active. This allows you to temporarily disable the first graph layout. The first graph layout is active by default. However, if you want to perform a layout using only the second graph layout or the label layout, you can set the first layout inactive. The first layout remains attached when inactive, but it is not performed when calling IlvGraphLayout.performLayout() on the Multiple layout instance.

Parameters:
active - true if the first graph layout is active, or false otherwise.
Since:
JViews 5.5
See Also:
getFirstGraphLayout(), isFirstGraphLayoutActive(), IlvGraphLayout.performLayout()

isFirstGraphLayoutActive

public boolean isFirstGraphLayoutActive()
Returns whether the first graph layout is active.

Since:
JViews 5.5
See Also:
setFirstGraphLayoutActive(boolean)

setFirstGraphLayoutPersistent

public void setFirstGraphLayoutPersistent(boolean persistent)
Sets whether the first graph layout is persistent.

If the first graph layout is persistent, it is automatically saved to named properties whenever the parameters of this Multiple Layout are saved to named properties. A new instance is allocated and automatically loaded from named properties whenever the parameters of this Multiple Layout are loaded from named properties. This is the default.

If the first graph layout is not persistent, it is not automatically saved or loaded through the named properties. However, you can save or load it by explicitly calling the corresponding methods.

Parameters:
persistent - true if the first graph layout is persistent, or false otherwise.
See Also:
getFirstGraphLayout(), isFirstGraphLayoutPersistent(), IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean), IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)

isFirstGraphLayoutPersistent

public boolean isFirstGraphLayoutPersistent()
Returns whether the first graph layout is persistent.

See Also:
setFirstGraphLayoutPersistent(boolean)

setSecondGraphLayout

public void setSecondGraphLayout(IlvGraphLayout layout)
Sets the second layout to be applied. You should set the layout before attaching the graph model.

Parameters:
layout - The second graph layout.

See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), attach(ilog.views.graphlayout.IlvGraphModel), getSecondGraphLayout()

getSecondGraphLayout

public IlvGraphLayout getSecondGraphLayout()
Returns the layout that is applied second. It returns null if no second layout is necessary.

See Also:
setSecondGraphLayout(ilog.views.graphlayout.IlvGraphLayout)

setSecondGraphLayoutActive

public void setSecondGraphLayoutActive(boolean active)
Sets whether the second graph layout is active. This allows you to temporarily disable the second graph layout. The second graph layout is active by default. However, if you want to perform a layout using only the first graph layout or the label layout, you can set the second layout inactive. The second layout remains attached when inactive, but it is not performed when calling IlvGraphLayout.performLayout() on the Multiple layout instance.

Parameters:
active - true if the second graph layout is active, or false otherwise.
Since:
JViews 5.5
See Also:
getSecondGraphLayout(), isSecondGraphLayoutActive(), IlvGraphLayout.performLayout()

isSecondGraphLayoutActive

public boolean isSecondGraphLayoutActive()
Returns whether the second graph layout is active.

Since:
JViews 5.5
See Also:
setSecondGraphLayoutActive(boolean)

setSecondGraphLayoutPersistent

public void setSecondGraphLayoutPersistent(boolean persistent)
Sets whether the second graph layout is persistent.

If the second graph layout is persistent, it is automatically saved to named properties whenever the parameters of this Multiple Layout are saved to named properties. A new instance is allocated and automatically loaded from named properties whenever the parameters of this Multiple Layout are loaded from named properties. This is the default.

If the second graph layout is not persistent, it is not automatically saved or loaded through the named properties. However, you can save or load it by explicitly calling the corresponding methods.

Parameters:
persistent - true if the second graph layout is persistent, or false otherwise.
See Also:
getSecondGraphLayout(), isSecondGraphLayoutPersistent(), IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean), IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)

isSecondGraphLayoutPersistent

public boolean isSecondGraphLayoutPersistent()
Returns whether the second graph layout is persistent.

See Also:
setSecondGraphLayoutPersistent(boolean)

setLabelLayout

public void setLabelLayout(IlvLabelLayout layout)
Sets the label layout to be applied inside performLayout. The label layout is always applied last. You should set the label layout before attaching the graph model.

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

getLabelLayout

public IlvLabelLayout getLabelLayout()
Returns the label layout that is applied inside performLayout. It returns null if no label layout is necessary.


setLabelLayoutActive

public void setLabelLayoutActive(boolean active)
Sets whether the label layout is active. This allows you to temporarily disable the label layout. The label layout is active by default. However, if you want to perform a layout using only the first or second graph layout, you can set the label inactive. The label layout remains attached when inactive, but it is not performed when calling IlvGraphLayout.performLayout() on the Multiple layout instance.

Parameters:
active - true if the label layout is active, or false otherwise.
Since:
JViews 5.5
See Also:
getLabelLayout(), isLabelLayoutActive(), IlvGraphLayout.performLayout()

isLabelLayoutActive

public boolean isLabelLayoutActive()
Returns whether the label layout is active.

Since:
JViews 5.5
See Also:
setLabelLayoutActive(boolean)

setLabelLayoutPersistent

public void setLabelLayoutPersistent(boolean persistent)
Sets whether the label layout is persistent.

If the label layout is persistent, it is automatically saved to named properties whenever the parameters of this Multiple Layout are saved to named properties. A new instance is allocated and automatically loaded from named properties whenever the parameters of this Multiple Layout are loaded from named properties. This is the default.

If the label layout is not persistent, it is not automatically saved or loaded through the named properties. However, you can save or load it by explicitly calling the corresponding methods.

Parameters:
persistent - true if the label layout is persistent, or false otherwise.
See Also:
getLabelLayout(), isLabelLayoutPersistent(), IlvDefaultLabelingModel.saveParametersToNamedProperties(IlvLabelLayout, boolean), IlvDefaultLabelingModel.loadParametersFromNamedProperties(IlvLabelLayout)

isLabelLayoutPersistent

public boolean isLabelLayoutPersistent()
Returns whether the label layout is persistent.

See Also:
setLabelLayoutPersistent(boolean)

setLabelingModel

public void setLabelingModel(IlvLabelingModel model)
Sets the labeling model to be used for the label layout.

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 graph model.

Note that this labeling model is disposed of when the layout is detached and cannot be used afterwards. Therefore you have to call setLabelingModel each time immediately before attaching.

If you use the Multiple Layout in a nested graph, note the following: The IlvDefaultLayoutProvider always uses the IlvDefaultLabelingModel. If a specific labeling model should be used in the multiple layout during the layout of a nested graph, the most convenient way is to use the Recursive Multiple Layout (see IlvRecursiveMultipleLayout) with a reference labeling model.

If you want to use your own layout provider, you should implement IlvLayoutProvider.getGraphLayout(ilog.views.graphlayout.IlvGraphModel) in the following way:

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

getLabelingModel

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


attach

public void attach(IlvGraphModel graphModel)
Allows you to specify the graph model you want to lay out. In addition to the functionality in the base class, the Multiple Layout attaches its sublayouts. If a label layout algorithm is used but no specific labeling model was specified before, it tries to use an IlvDefaultLabelingModel.

Overrides:
attach in class IlvGraphLayout
Parameters:
graphModel - The graph model.
See Also:
detach(), getFirstGraphLayout(), getSecondGraphLayout(), getLabelLayout(), setLabelingModel(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 attach(IlvGraphModel). The detach method performs cleaning operations on the graph model. In addition to the cleaning operations in the base class, the Multiple Layout detaches its sublayouts.

Note that you must call this method when you no longer need the layout instance. Otherwise, some objects may not be garbage collected. If you explicitly set a labeling model, this labeling model will be disposed inside detach.

Overrides:
detach in class IlvGraphLayout
See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), attach(ilog.views.graphlayout.IlvGraphModel), getFirstGraphLayout(), getSecondGraphLayout(), getLabelLayout(), setLabelingModel(ilog.views.graphlayout.labellayout.IlvLabelingModel)

setGraphModel

public void setGraphModel(IlvGraphModel graphModel)
Sets the graph model to be laid out. You should not call this method. You should use the methods IlvGraphLayout.attach(IlvGrapher) or attach(IlvGraphModel).

Overrides:
setGraphModel in class IlvGraphLayout

createLayoutReport

public IlvGraphLayoutReport createLayoutReport()
Returns a new instance of the layout report. The current implementation creates an instance of IlvMultipleLayoutReport.

Overrides:
createLayoutReport in class IlvGraphLayout
See Also:
createLayoutReport(), IlvMultipleLayoutReport

layout

protected void layout(boolean redraw)
               throws IlvGraphLayoutException
Computes the layout using the Multiple Layout algorithm. To start the layout, call the method IlvGraphLayout.performLayout().

Specified by:
layout in class IlvGraphLayout
Parameters:
redraw - If true, the attached graph model will be asked to redraw the graph after layout. When the layout algorithm moves the nodes and reshapes the links, it is required to pass the value of the redraw argument to the methods IlvGraphModel.moveNode(java.lang.Object, float, float, boolean) and IlvGraphModel.reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean).
Throws:
IlvGraphLayoutException - if the sublayout throws a graph layout exception.
See Also:
IlvGraphLayout.performLayout()

setCoordinatesMode

public void setCoordinatesMode(int mode)
Sets the coordinates mode.

The default is IlvGraphLayout.INVERSE_VIEW_COORDINATES.

Overrides:
setCoordinatesMode in class IlvGraphLayout
Parameters:
mode - The coordinates mode to set.

See Also:
IlvGraphLayout.getCoordinatesMode(), IlvGrapherAdapter.setCoordinatesMode(int), IlvGrapherAdapter.setReferenceTransformer(ilog.views.IlvTransformer), IlvGrapherAdapter.setReferenceView(ilog.views.IlvManagerView)

setUseDefaultParameters

public void setUseDefaultParameters(boolean option)
Specifies whether default parameters are to be used in the layout. If the argument is true, the layout uses the default values of all the parameters; that is, the "get..." and "is..." methods return the default values.

The default value of this parameter is false.

Overrides:
setUseDefaultParameters in class IlvGraphLayout
See Also:
IlvGraphLayout.isUseDefaultParameters()

setMinBusyTime

public void setMinBusyTime(long time)
Sets the minimal time the layout algorithm can be busy between two calls of layoutStepPerformed when the method IlvGraphLayout.callLayoutStepPerformedIfNeeded() is used.

The default value is 50 (milliseconds).

Overrides:
setMinBusyTime in class IlvGraphLayout
See Also:
IlvGraphLayout.layoutStepPerformed(), IlvGraphLayout.callLayoutStepPerformedIfNeeded(), IlvGraphLayout.getMinBusyTime()

setAutoLayout

public void setAutoLayout(boolean enable)
Enables the auto layout mode. If the argument is true, the layout is automatically performed each time the layout instance is notified that the geometry or the structure of the graph has changed.

The default value is false.

Overrides:
setAutoLayout in class IlvGraphLayout
See Also:
IlvGraphLayout.isAutoLayout(), IlvGraphLayout.contentsChanged(ilog.views.graphlayout.GraphModelEvent), IlvGraphLayout.performAutoLayout(), IlvGraphLayout.setAutoLayoutHandler(ilog.views.graphlayout.IlvAutoLayoutHandler)

setInputCheckEnabled

public void setInputCheckEnabled(boolean enable)
Enables the checks for the nodes, links, and/or labels provided as arguments for the different methods of this layout algorithm and its sublayout algorithms.

It is enabled by default.

Overrides:
setInputCheckEnabled in class IlvGraphLayout
See Also:
IlvGraphLayout.isInputCheckEnabled()

stopImmediately

public boolean stopImmediately()
Stops the running layout algorithm as soon as possible.

This method can be used if multiple threads are used for layout and GUI control. The GUI control thread calls this method to notify the layout thread that the layout run must be stopped. The layout algorithm will perform some final cleanup operations before terminating. Therefore, the layout thread will continue until the cleanup operations are finished. The GUI thread, however, returns immediately from this method.

If the layout algorithm is stopped before completion, the result code of the layout report is IlvGraphLayoutReport.STOPPED_AND_INVALID.

Overrides:
stopImmediately in class IlvGraphLayout
Returns:
true if the algorithm can be stopped at this time.
See Also:
IlvGraphLayoutReport.getCode()

checkAppropriateLinks

public void checkAppropriateLinks()
                           throws IlvInappropriateLinkException
Throws an exception if the links are not appropriate for the layout.

Performing a layout may throw an IlvInappropriateLinkException if the layout cannot deal with the links of the graph. With an IlvGrapher, it is recommended using links of type IlvPolylineLinkImage and link connectors of type IlvFreeLinkConnector to avoid the exception (see the documentation of IlvInappropriateLinkException for details).

Sometimes it is useful to check in advance whether layout would throw an IlvInappropriateLinkException, without performing a time-consuming layout. You can call the method checkAppropriateLinks() for this purpose. If it does not throw an IlvInappropriateLinkException, then performing layout will also not throw an IlvInappropriateLinkException. (Notice that performing layout may still throw other exceptions.) You can control which checks are done with IlvGraphModel.setLinkCheckEnabled(boolean) and IlvGraphModel.setConnectionPointCheckEnabled(boolean).

The typical usage is to call checkAppropriateLinks to catch the exception and to call IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider) in order to replace the inappropriate links and/or link connectors with new links.

Overrides:
checkAppropriateLinks in class IlvGraphLayout
Throws:
IlvInappropriateLinkException
See Also:
IlvGraphModel.setLinkCheckEnabled(boolean), IlvGraphModel.setConnectionPointCheckEnabled(boolean), IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider), IlvInappropriateLinkException

getMovingNodes

public IlvGraphicVector getMovingNodes()
Returns the vector of nodes being moved by the graph layout algorithm. You should not call this method. It is used only when the graph model is an IlvGrapherAdaper in order to optimize for speed.

Overrides:
getMovingNodes in class IlvGraphLayout
Since:
JViews 5.5

setParametersUpToDate

public void setParametersUpToDate(boolean uptodate)
Automatically called with a false argument each time the value of a parameter is changed.

This method is automatically called with a true argument each time the layout is successfully performed. In this case, it calls setParametersUpToDate with a true argument for the sublayouts as well.

Overrides:
setParametersUpToDate in class IlvGraphLayout
See Also:
isParametersUpToDate()

isParametersUpToDate

public boolean isParametersUpToDate()
Returns false if at least one parameter was modified since the last time the layout was successfully performed on the same graph or if the layout has never been performed successfully on the same graph. Returns true if no changes occurred.

The method returns false if the parameters of one of the sublayouts is out-of-date.

Overrides:
isParametersUpToDate in class IlvGraphLayout
See Also:
setParametersUpToDate(boolean)

setStructureUpToDate

public void setStructureUpToDate(boolean uptodate)
Normally called with a false argument if the structure of the graph changed.

It is automatically called with a true argument each time the layout is successfully performed. In this case, it calls setStructureUpToDate with a true argument for the sublayouts as well.

Overrides:
setStructureUpToDate in class IlvGraphLayout
See Also:
isStructureUpToDate()

isStructureUpToDate

public boolean isStructureUpToDate()
Returns false if at least one modification occurred in the structure of the graph since the last time the layout was successfully performed on the same graph or if the layout has never been performed successfully on the same graph. Returns true if no changes occurred.

The method returns false if the structure of one of the sublayouts is out-of-date.

Overrides:
isStructureUpToDate in class IlvGraphLayout
See Also:
setStructureUpToDate(boolean)

setGeometryUpToDate

public void setGeometryUpToDate(boolean uptodate)
Normally called with a false argument if the geometry of the graph changed.

This method is automatically called with a true argument each time the layout is successfully performed. In this case, it calls setGeometryUpToDate with a true argument for the sublayouts as well.

Overrides:
setGeometryUpToDate in class IlvGraphLayout
See Also:
isGeometryUpToDate()

isGeometryUpToDate

public boolean isGeometryUpToDate()
Returns false if at least one node, link, label, or obstacle was moved or reshaped since the last time the layout was successfully performed on the same graph or if the layout has never been performed successfully on the same graph. Returns true if no changes occurred.

The method returns false if the geometry of one of the sublayouts is out-of-date.

Overrides:
isGeometryUpToDate in class IlvGraphLayout
See Also:
setGeometryUpToDate(boolean)

supportsPercentageComplete

public boolean supportsPercentageComplete()
Indicates whether the layout class can estimate the percentage of completion during the run of the layout. If the sublayouts support this feature, the percentage value is calculated from the sublayouts. If the sublayouts do not support this feature, the Multiple Layout algorithm can indicate by discrete percentage values (typically 33% and 66% and 100%) whether the first graph layout, the second graph layout, or the label layout are already finished.

The calculated percentage values are not very precise.

Overrides:
supportsPercentageComplete in class IlvGraphLayout
Returns:
Always true.
See Also:
IlvGraphLayout.increasePercentageComplete(int), IlvGraphLayoutReport.getPercentageComplete(), IlvJGraphLayoutProgressBar

supportsStopImmediately

public boolean supportsStopImmediately()
Indicates whether the layout class can immediately interrupt the current run of the layout in a controlled way. If the first graph layout, the second graph layout, and the label layout support this feature, then it returns true.

Overrides:
supportsStopImmediately in class IlvGraphLayout
Returns:
Always false.
See Also:
getFirstGraphLayout(), getSecondGraphLayout(), getLabelLayout(), stopImmediately(), IlvGraphLayout.isStoppedImmediately()

supportsAllowedTime

public boolean supportsAllowedTime()
Indicates whether the layout class can stop the layout computation when a user-defined allowed time is exceeded. If the first graph layout, the second graph layout, and the label layout support this feature, then it returns true.

Overrides:
supportsAllowedTime in class IlvGraphLayout
Returns:
Always false.
See Also:
getFirstGraphLayout(), getSecondGraphLayout(), getLabelLayout(), IlvGraphLayout.setAllowedTime(long), IlvGraphLayout.getAllowedTime(), IlvGraphLayout.isLayoutTimeElapsed()

supportsLayoutOfConnectedComponents

public boolean supportsLayoutOfConnectedComponents()
Indicates whether the layout class can cut the attached graph into connected components, apply itself on each connected component separately, and then use the layout instance returned by the method IlvGraphLayout.getLayoutOfConnectedComponents() to position the connected components. If the first graph layout and the second graph layout support this feature, then it returns true.

Overrides:
supportsLayoutOfConnectedComponents in class IlvGraphLayout
Returns:
Always false.
See Also:
getFirstGraphLayout(), getSecondGraphLayout(), IlvGraphLayout.getLayoutOfConnectedComponents(), IlvGraphLayout.isLayoutOfConnectedComponentsEnabled(), IlvGraphLayout.performLayout()

supportsSaveParametersToNamedProperties

public boolean supportsSaveParametersToNamedProperties()
Indicates whether the layout class can transfer the layout parameters to named properties. This mechanism can be used if layout parameters must be stored persistently in an .ivl file. If the first graph layout, the second graph layout, and the label layout support this feature, then it returns true.

Overrides:
supportsSaveParametersToNamedProperties in class IlvGraphLayout
Returns:
Always false.
See Also:
getFirstGraphLayout(), getSecondGraphLayout(), getLabelLayout(), IlvGrapherAdapter.saveParametersToNamedProperties(ilog.views.graphlayout.IlvGraphLayout, boolean), IlvGrapherAdapter.loadParametersFromNamedProperties(ilog.views.graphlayout.IlvGraphLayout), IlvGrapherAdapter.removeParametersFromNamedProperties()

createLayoutGrapherProperty

protected IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name,
                                                                    boolean withDefaults)
Returns a new instance of IlvMultipleLayoutGrapherProperty that stores the parameter settings of this layout class.

The method is used by IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean) to create a named property that contains parameter settings of this layout instance.

Overrides:
createLayoutGrapherProperty in class IlvGraphLayout
See