public class IlvMultipleLayout extends IlvGraphLayout implements LabelLayoutEventListener, GraphLayoutEventListener
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 to
each subgraph a Tree layout, then a Link layout for the nontree links,
and finally a Label layout for the link labels. 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.
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
long |
getAllowedTime()
Returns the currently allowed time for the layout algorithm in
milliseconds.
|
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.
|
static IlvMultipleLayout |
GetMultipleLayout(IlvGraphLayout layout)
Returns the multiple layout that contains the input graph layout.
|
static IlvMultipleLayout |
GetMultipleLayout(IlvLabelLayout layout)
Returns the multiple layout that contains the input label layout.
|
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 |
isLocalRecursiveLayoutNeeded(IlvLayoutProvider layoutProvider,
IlvGraphLayout recLayout,
IlvGraphModel rootModel,
boolean traverse)
Checks whether layout is needed when layout is performed recursively
on a hierarchy of nested subgraphs.
|
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.
|
protected IlvGraphLayoutReport |
performFirstGraphLayout(boolean redraw)
Called in order to perform the first graph layout.
|
protected IlvLabelLayoutReport |
performLabelLayout(boolean redraw)
Called in order to perform the label layout.
|
protected IlvGraphLayoutReport |
performSecondGraphLayout(boolean redraw)
Called in order to perform the second graph layout.
|
void |
setAllowedTime(long time)
Sets the upper limit for the duration of the layout algorithm.
|
boolean |
setAutoCheckAppropriateLinksEnabled(boolean enable)
Sets whether the layout checks whether links are appropriate.
|
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)
Sets whether the geometry of the graph is up to date.
|
void |
setGraphModel(IlvGraphModel graphModel)
Sets the graph model to be laid out.
|
void |
setInputCheckEnabled(boolean enable)
Sets whether the checks for the nodes, links, and/or labels provided
as arguments for the different methods of this layout algorithm and
its sublayout algorithms are enabled.
|
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 |
setLayoutRunning(boolean running,
boolean fromParents)
Sets whether layout is running.
|
void |
setMinBusyTime(long time)
Sets the minimal time the layout algorithm can be busy between two
calls of
IlvGraphLayout.layoutStepPerformed() when the method IlvGraphLayout.callLayoutStepPerformedIfNeeded() is used. |
void |
setParametersUpToDate(boolean uptodate)
Sets whether the parameters of the layout are up to date.
|
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)
Sets whether the structure of the graph is up to date.
|
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. |
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, afterLayoutOfSubgraph, attach, beforeLayout, beforeLayoutOfSubgraph, callLayoutStepPerformedIfNeeded, checkAppropriateLink, cleanGraphModel, cleanLink, cleanNode, clipAllLinks, clipLink, connectAllLinksToCenter, connectLinkToCenter, contentsChanged, createLayoutLinkProperty, createLayoutNodeProperty, 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, isLayoutRunning, isLayoutTimeElapsed, isMemorySavings, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performAutoLayout, performLayout, performLayout, performLayout, PerformLayout, performSublayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, 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
public IlvMultipleLayout()
attach(IlvGrapher)
. attach(IlvGraphModel)
. performLayout
.
public IlvMultipleLayout(IlvGraphLayout layout1, IlvGraphLayout layout2)
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.
layout1
- The first layout to be performed.layout2
- The second layout to be performed.IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
,
IlvGraphLayout.performLayout(boolean, boolean, boolean)
public IlvMultipleLayout(IlvGraphLayout layout1, IlvGraphLayout layout2, IlvLabelLayout layout3)
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.
layout1
- The first layout to be performed.layout2
- The second layout to be performed.layout3
- The last layout to be performed.IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
,
setLabelingModel(ilog.views.graphlayout.labellayout.IlvLabelingModel)
,
IlvGraphLayout.performLayout(boolean, boolean, boolean)
public IlvMultipleLayout(IlvMultipleLayout source)
copy()
method. Any subclass
should provide a copy constructor.
The parameters of the source
layout are copied using the
method copyParameters(IlvGraphLayout)
.
source
- The layout instance that is copied.copy()
,
copyParameters(IlvGraphLayout)
protected void init()
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.
init
in class IlvGraphLayout
public IlvGraphLayout copy()
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.
copy
in class IlvGraphLayout
IlvMultipleLayout(IlvMultipleLayout)
,
setFirstGraphLayout(IlvGraphLayout)
,
setSecondGraphLayout(IlvGraphLayout)
,
setLabelLayout(IlvLabelLayout)
,
setLabelingModel(IlvLabelingModel)
,
setFirstGraphLayoutPersistent(boolean)
,
setSecondGraphLayoutPersistent(boolean)
,
setLabelLayoutPersistent(boolean)
,
copyParameters(IlvGraphLayout)
public void copyParameters(IlvGraphLayout source)
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.
copyParameters
in class IlvGraphLayout
source
- The layout instance from which the parameters are copied.copy()
,
setFirstGraphLayout(IlvGraphLayout)
,
setSecondGraphLayout(IlvGraphLayout)
,
setLabelLayout(IlvLabelLayout)
,
setLabelingModel(IlvLabelingModel)
,
setFirstGraphLayoutPersistent(boolean)
,
setSecondGraphLayoutPersistent(boolean)
,
setLabelLayoutPersistent(boolean)
public void setFirstGraphLayout(IlvGraphLayout layout)
layout
- The first layout.IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
,
getFirstGraphLayout()
public IlvGraphLayout getFirstGraphLayout()
setFirstGraphLayout(IlvGraphLayout)
public void setFirstGraphLayoutActive(boolean 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.
active
- true
if the first graph layout is active, or
false
otherwise.getFirstGraphLayout()
,
isFirstGraphLayoutActive()
,
IlvGraphLayout.performLayout()
public boolean isFirstGraphLayoutActive()
setFirstGraphLayoutActive(boolean)
public void setFirstGraphLayoutPersistent(boolean 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.
persistent
- true
if the first graph layout is
persistent, or false
otherwise.getFirstGraphLayout()
,
isFirstGraphLayoutPersistent()
,
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout,
boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
public boolean isFirstGraphLayoutPersistent()
setFirstGraphLayoutPersistent(boolean)
public void setSecondGraphLayout(IlvGraphLayout layout)
layout
- The second graph layout.IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
,
getSecondGraphLayout()
public IlvGraphLayout getSecondGraphLayout()
null
if no second layout is necessary.setSecondGraphLayout(IlvGraphLayout)
public void setSecondGraphLayoutActive(boolean 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.
active
- true
if the second graph layout is active, or
false
otherwise.getSecondGraphLayout()
,
isSecondGraphLayoutActive()
,
IlvGraphLayout.performLayout()
public boolean isSecondGraphLayoutActive()
setSecondGraphLayoutActive(boolean)
public void setSecondGraphLayoutPersistent(boolean 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.
persistent
- true
if the second graph layout is
persistent, or false
otherwise.getSecondGraphLayout()
,
isSecondGraphLayoutPersistent()
,
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout,
boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
public boolean isSecondGraphLayoutPersistent()
setSecondGraphLayoutPersistent(boolean)
public void setLabelLayout(IlvLabelLayout layout)
performLayout
.
The label layout is always applied last. You should set the label
layout before attaching the graph model.
layout
- The label layout.IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
public IlvLabelLayout getLabelLayout()
performLayout
. It returns null
if no label
layout is necessary.public void setLabelLayoutActive(boolean active)
IlvGraphLayout.performLayout()
on the Multiple
layout instance.
active
- true
if the label layout is active, or
false
otherwise.getLabelLayout()
,
isLabelLayoutActive()
,
IlvGraphLayout.performLayout()
public boolean isLabelLayoutActive()
setLabelLayoutActive(boolean)
public void setLabelLayoutPersistent(boolean 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.
persistent
- true
if the label layout is persistent,
or false
otherwise.getLabelLayout()
,
isLabelLayoutPersistent()
,
IlvDefaultLabelingModel.saveParametersToNamedProperties(IlvLabelLayout, boolean)
,
IlvDefaultLabelingModel.loadParametersFromNamedProperties(IlvLabelLayout)
public boolean isLabelLayoutPersistent()
setLabelLayoutPersistent(boolean)
public void setLabelingModel(IlvLabelingModel model)
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 (seeIlvRecursiveMultipleLayout
) with a reference labeling model.
If you want to use your own layout provider, you should implement
IlvLayoutProvider.getGraphLayout(IlvGraphModel)
in the
following way:
IlvMultipleLayout
if
necessary.model
- The labeling model.IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
public IlvLabelingModel getLabelingModel()
null
, an IlvDefaultLabelingModel
is
used when possible.public void attach(IlvGraphModel graphModel)
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
.
attach
in class IlvGraphLayout
graphModel
- The graph model.detach()
,
getFirstGraphLayout()
,
getSecondGraphLayout()
,
getLabelLayout()
,
setLabelingModel(IlvLabelingModel)
public void detach()
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.
public void setGraphModel(IlvGraphModel graphModel)
IlvGraphLayout.attach(IlvGrapher)
or attach(IlvGraphModel)
.setGraphModel
in class IlvGraphLayout
graphModel
- The graph model to be laid out.IlvGraphLayout.attach(IlvGrapher)
,
IlvGraphLayout.attach(IlvGraphModel)
public IlvGraphLayoutReport createLayoutReport()
createLayoutReport
in class IlvGraphLayout
IlvMultipleLayoutReport
.IlvGraphLayout.createLayoutReport()
,
IlvMultipleLayoutReport
protected void layout(boolean redraw) throws IlvGraphLayoutException
IlvGraphLayout.performLayout()
.layout
in class IlvGraphLayout
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, double, double, boolean)
and IlvGraphModel.reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean)
.IlvGraphLayoutException
- if the sublayout throws a graph
layout exception.IlvGraphLayout.performLayout()
protected IlvGraphLayoutReport performFirstGraphLayout(boolean redraw) throws IlvGraphLayoutException
IlvGraphLayout.performLayout(boolean, boolean)
on the first graph
layout. This method can be overridden if it is necessary to perform
some additional preparations before applying the first graph layout.redraw
- Whether to redraw the graph during layout.IlvGraphLayoutException
protected IlvGraphLayoutReport performSecondGraphLayout(boolean redraw) throws IlvGraphLayoutException
IlvGraphLayout.performLayout(boolean, boolean)
on the second graph
layout. This method can be overridden if it is necessary to perform
some additional preparations before applying the second graph layout.redraw
- Whether to redraw the graph during layout.IlvGraphLayoutException
protected IlvLabelLayoutReport performLabelLayout(boolean redraw)
IlvLabelLayout.performLayout(boolean, boolean)
on the label layout.
This method can be overridden if it is necessary to perform some
additional preparations before applying the label layout.redraw
- Whether to redraw the graph during layout.public void setCoordinatesMode(int mode)
The default is IlvGraphLayout.INVERSE_VIEW_COORDINATES
.
setCoordinatesMode
in class IlvGraphLayout
mode
- The coordinates mode to set.IlvGraphLayout.getCoordinatesMode()
,
IlvGrapherAdapter.setCoordinatesMode(int)
,
IlvGrapherAdapter.setReferenceTransformer(ilog.views.IlvTransformer)
,
IlvGrapherAdapter.setReferenceView(IlvManagerView)
public void setUseDefaultParameters(boolean option)
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
.
setUseDefaultParameters
in class IlvGraphLayout
IlvGraphLayout.isUseDefaultParameters()
public void setAllowedTime(long time)
The default value for Multiple layout is 1000000000
(1000000 seconds). The allowed time is additionally limited by the
allowed time parameter on the sublayouts.
setAllowedTime
in class IlvGraphLayout
time
- The allowed time in milliseconds.supportsAllowedTime()
,
getAllowedTime()
,
IlvGraphLayout.isLayoutTimeElapsed()
,
IlvGraphLayoutReport.getCode()
public long getAllowedTime()
Note that the method performLayout
does not
automatically stop the layout when the allowed time is exceeded. It
only delegates the stop to the sublayouts, and it is entirely the
responsibility of the implementation of the method layout(boolean)
on the sublayouts to do this.
getAllowedTime
in class IlvGraphLayout
supportsAllowedTime()
,
setAllowedTime(long)
,
IlvGraphLayout.isLayoutTimeElapsed()
public void setMinBusyTime(long time)
IlvGraphLayout.layoutStepPerformed()
when the method IlvGraphLayout.callLayoutStepPerformedIfNeeded()
is used.
The default value is 50
(milliseconds).
setMinBusyTime
in class IlvGraphLayout
IlvGraphLayout.layoutStepPerformed()
,
IlvGraphLayout.callLayoutStepPerformedIfNeeded()
,
IlvGraphLayout.getMinBusyTime()
public void setAutoLayout(boolean enable)
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
.
public void setLayoutRunning(boolean running, boolean fromParents)
setLayoutRunning
in class IlvGraphLayout
running
- Whether layout is running or not.fromParents
- Whether this notification is from a parent layout or
from this layout instance.public void setInputCheckEnabled(boolean enable)
It is enabled by default.
setInputCheckEnabled
in class IlvGraphLayout
IlvGraphLayout.isInputCheckEnabled()
public boolean stopImmediately()
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
.
stopImmediately
in class IlvGraphLayout
true
if the algorithm can be stopped at this time.IlvGraphLayoutReport.getCode()
public void checkAppropriateLinks() throws IlvInappropriateLinkException
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.
checkAppropriateLinks
in class IlvGraphLayout
IlvInappropriateLinkException
IlvGraphModel.setLinkCheckEnabled(boolean)
,
IlvGraphModel.setConnectionPointCheckEnabled(boolean)
,
IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider)
,
IlvInappropriateLinkException
public boolean setAutoCheckAppropriateLinksEnabled(boolean enable)
setAutoCheckAppropriateLinksEnabled
in class IlvGraphLayout
public IlvGraphicVector getMovingNodes()
IlvGrapherAdaper
in order to optimize for speed.getMovingNodes
in class IlvGraphLayout
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.
setParametersUpToDate
in class IlvGraphLayout
isParametersUpToDate()
public boolean isParametersUpToDate()
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.
isParametersUpToDate
in class IlvGraphLayout
setParametersUpToDate(boolean)
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.
setStructureUpToDate
in class IlvGraphLayout
isStructureUpToDate()
public boolean isStructureUpToDate()
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.
isStructureUpToDate
in class IlvGraphLayout
setStructureUpToDate(boolean)
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.
setGeometryUpToDate
in class IlvGraphLayout
isGeometryUpToDate()
public boolean isGeometryUpToDate()
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.
isGeometryUpToDate
in class IlvGraphLayout
setGeometryUpToDate(boolean)
public boolean isLocalRecursiveLayoutNeeded(IlvLayoutProvider layoutProvider, IlvGraphLayout recLayout, IlvGraphModel rootModel, boolean traverse)
isLocalRecursiveLayoutNeeded
in class IlvGraphLayout
layoutProvider
- The object that provides a layout instance to be
used for laying out each subgraph.recLayout
- The recursive layout that started the recursive
application of layouts. This can be null
.rootModel
- The graph model that is the root of the nesting
hierarchy of graph models.traverse
- If false
, this layout is intended to be
only applied to its own graph model. If true
, this
layout is intended to be applied to its graph model and the layout
instances provided by the layoutProvider
are intended
to be applied recursively to all nested subgraph models. The
traverse flag is basically passed through from the call of IlvGraphLayout.performLayout(boolean, boolean, boolean)
.true
if it is necessary to perform the layout,
false
otherwise.IlvGraphLayout.isLayoutNeeded()
,
IlvGraphLayout.performLayout(boolean, boolean, boolean)
,
IlvGraphLayout.PerformLayout(IlvGraphModel, IlvLayoutProvider, boolean, boolean, boolean)
,
IlvRecursiveLayout
public boolean supportsPercentageComplete()
The calculated percentage values are not very precise.
supportsPercentageComplete
in class IlvGraphLayout
true
.IlvGraphLayout.increasePercentageComplete(int)
,
IlvGraphLayoutReport.getPercentageComplete()
,
IlvJGraphLayoutProgressBar
public boolean supportsStopImmediately()
If the first graph layout, the second graph layout, and the label
layout support this feature, then it returns true
.
supportsStopImmediately
in class IlvGraphLayout
true
if the first graph layout , the second graph
layout, and the label layout support this feature.getFirstGraphLayout()
,
getSecondGraphLayout()
,
getLabelLayout()
,
stopImmediately()
,
IlvGraphLayout.isStoppedImmediately()
public boolean supportsAllowedTime()
If the first graph layout, the second graph layout, and the label
layout support this feature, then it returns true
.
supportsAllowedTime
in class IlvGraphLayout
true
if the first graph layout , the second graph
layout and the label layout support this feature.getFirstGraphLayout()
,
getSecondGraphLayout()
,
getLabelLayout()
,
setAllowedTime(long)
,
getAllowedTime()
,
IlvGraphLayout.isLayoutTimeElapsed()
public boolean supportsLayoutOfConnectedComponents()
IlvGraphLayout.getLayoutOfConnectedComponents()
to position the connected
components.
If the first graph layout and the second graph layout support this
feature, then it returns true
.
supportsLayoutOfConnectedComponents
in class IlvGraphLayout
true
if the first graph layout and the second graph
layout support this feature.getFirstGraphLayout()
,
getSecondGraphLayout()
,
IlvGraphLayout.getLayoutOfConnectedComponents()
,
IlvGraphLayout.isLayoutOfConnectedComponentsEnabled()
,
IlvGraphLayout.performLayout()
public boolean supportsSaveParametersToNamedProperties()
.ivl
file. If the
first graph layout, the second graph layout, and the label layout
support this feature, then it returns true
.
supportsSaveParametersToNamedProperties
in class IlvGraphLayout
false
.getFirstGraphLayout()
,
getSecondGraphLayout()
,
getLabelLayout()
,
IlvGrapherAdapter.saveParametersToNamedProperties(ilog.views.graphlayout.IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(ilog.views.graphlayout.IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
protected IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name, boolean withDefaults)
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.
createLayoutGrapherProperty
in class IlvGraphLayout
IlvGraphLayoutGrapherProperty
,
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
public void layoutStepPerformed(GraphLayoutEvent event)
layoutStepPerformed
in interface GraphLayoutEventListener
event
- The layout event that may contain information about the
behavior of the layout algorithmGraphLayoutEvent.getLayoutReport()
public void layoutStepPerformed(LabelLayoutEvent event)
layoutStepPerformed
in interface LabelLayoutEventListener
event
- The layout event that may contain information about the
behavior of the layout algorithmLabelLayoutEvent.getLayoutReport()
public void setSilentAttach(boolean flag)
public boolean useAnimateRedraw()
true
if animation is supported and enabled for
any sublayout of the Multiple Layout. Even though Multiple Layout
itself does not support animation directly, it still supports that
its sublayouts are in animation mode, and it forces the
IlvGrapherAdapter
to use a special redraw mechanism. The
method is part of JViews internals. You should not use it, but use
IlvGraphLayout.isAnimate()
instead.useAnimateRedraw
in class IlvGraphLayout
IlvGraphLayout.isAnimate()
,
IlvGraphLayout.supportsAnimation()
public static IlvMultipleLayout GetMultipleLayout(IlvGraphLayout layout)
getFirstGraphLayout()
or getSecondGraphLayout()
called on the resulting multiple layout returns the input layout.
This method can be called after the multiple layout has been
attached. Returns null
if the input layout does not
belong to any multiple layout.layout
- The graph layout instance.public static IlvMultipleLayout GetMultipleLayout(IlvLabelLayout layout)
getLabelLayout()
called on the resulting multiple layout
returns the input layout. This can be called after the corresponding
multiple layout was attached. Returns null
if the input
layout does not belong to any multiple layout.layout
- The label layout instance.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.