public class IlvRecursiveLayout extends IlvGraphLayout implements GraphLayoutEventListener
This is not a layout algorithm but rather a facility to perform
layouts recursively in a nested graph. 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. The Recursive Layout is different: it
traverses the nesting structure starting from the attached graph and
applies a layout recursively on all subgraphs. It can be tailored for
which sublayout has to be applied to which subgraph.
There are basically two scenarios:
The following example shows the first scenario:
IlvGraphLayout layout = new IlvRecursiveLayout(new IlvTreeLayout()); layout.attach(topLevelGrapher); IlvLayoutReport report = layout.performLayout(true, true);In this case, a tree layout is performed recursively to the top-level graph and to each subgraph. All layouts are performed with the same global layout parameters as for the layout instance passed as an argument to the constructor of
IlvRecursiveLayout
,
which is called its reference layout. You can access the
reference layout instance to change the global layout parameters:
IlvTreeLayout treeLayout = (IlvTreeLayout)layout.getReferenceLayout(); treeLayout.setFlowDirection(IlvDirection.Left);Internally, a clone of the reference instance is created for each subgraph. This clone remains attached as long as the Recursive 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 and links, you have to access the layout instance of the subgraph that owns the node or link:
IlvTreeLayout treeLayout = (IlvTreeLayout)layout.getLayout(subgraph); treeLayout.setAlignment(node, IlvTreeLayout.TIP_OVER);
In the typical case, when you use instances of IlvGraphic
as nodes and instances of IlvGrapher
as subgraphs, it is:
IlvTreeLayout treeLayout = (IlvTreeLayout)layout.getLayout(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, we need a layout provider (see IlvLayoutProvider
) that specifies which layout
instance is used for which subgraph.
IlvGraphLayout layout = new IlvRecursiveLayout(layoutProvider); layout.attach(topLevelGrapher); IlvLayoutReport report = layout.performLayout(true, true);The layout provider returns a different layout instance for each subgraph. For example, it may return a grid layout for the top-level graph, but a tree layout for one subgraph and a bus layout for another subgraph of the top-level graph. Furthermore, each layout can have different global layout parameters. You can implement your own application-specific layout provider, or you can use the predefined
IlvDefaultLayoutProvider
or IlvRecursiveLayoutProvider
that allows you to specify the preferred
layout of each subgraph. If neither a reference layout nor a layout
provider is given to the Recursive Layout, an internal default layout
provider of class IlvRecursiveLayoutProvider
is used.
This allows you to specify the layouts of subgraphs in a very
convenient way:
IlvRecursiveLayout layout = new IlvRecursiveLayout(); layout.attach(topLevelGrapher); // specify the layout of the top-level graph layout.setLayout(null, new IlvGridLayout()); // specify the layout of subgraphs layout.setLayout(subgraph1, new IlvTreeLayout()); layout.setLayout(subgraph2, new IlvBusLayout()); // perform the layout IlvLayoutReport report = layout.performLayout(true, true);In this scenario, there is no reference layout. All layout parameters of different subgraphs are independent. You access the layout instance of each individual subgraph in order to change global layout parameters for this subgraph as well as parameters of nodes and links of the subgraph. For instance, if the attached top-level graph contains two subgraphs, and node1 belongs to subgraph1 and node2 belongs to subgraph2, you can set individual global and local layout parameters in this way:
// access the layout of the top-level graph IlvGridLayout gridLayout = (IlvGridLayout)layout.getLayout(null); gridLayout.setLayoutMode(IlvGridLayout.TILE_TO_COLUMNS); // access the layouts of the subgraph IlvTreeLayout treeLayout = (IlvTreeLayout)layout.getLayout(subgraph1); treeLayout.setFlowDirection(IlvDirection.Left); treeLayout.setAlignment(node1, IlvTreeLayout.TIP_OVER); IlvBusLayout busLayout = (IlvBusLayout)layout.getLayout(subgraph2); busLayout.setOrdering(IlvBusLayout.ORDER_BY_HEIGHT); busLayout.setBus(node2);
Notes:
IlvHierarchicalLayout
, IlvTreeLayout
, IlvMultipleLayout
, and so forth work
only on a flat graph, but for convenience, you can apply IlvGraphLayout.performLayout(boolean, boolean, boolean)
with the
traverse
flag set to true
. This does not
mean that the normal layout instance works on the entire nested graph
including the subgraphs in this case. In fact, internally it uses a
Recursive Layout in reference layout mode, that is, a clone of the
top-level graph layout instance is created for each subgraph, and
these clones are applied recursively to the nested graph. Each clone
still treats only a flat graph.layout = new IlvRecursiveLayout(new IlvRecursiveLayout());This calls the copy constructor of the Recursive Layout, but does not create a Recursive Layout in reference layout mode. A Recursive Layout inside another Recursive Layout would traverse the nested graph and perform the Recursive Layout for each subgraph, which, however, itself would recursively traverse the nested graph again. This would just be waste of run time.
IlvMultipleLayout
and
IlvRecursiveLayout
, you should use IlvRecursiveMultipleLayout
, in particular when you use explicitly
specified labeling models. The Recursive Layout that has a Multiple
Layout as the reference layout works as long as default labeling
models (instances of IlvDefaultLabelingModel
) are used. The Recursive Multiple Layout is
more flexible; it is in principle a Recursive Layout that has
instances of Multiple Layout as sublayouts for the subgraphs.
Additionally, the Recursive Multiple Layout ensures that the correct
labeling models (clones of the specified labeling model) are created
in the nested graph. Modifier and Type | Field and Description |
---|---|
static int |
INTERNAL_PROVIDER_MODE
Layout mode with internal layout provider.
|
static int |
PROPAGATE_CLASS_MISMATCH
Bitmask for the return code of the parameter propagation methods.
|
static int |
PROPAGATE_EXCEPTION
Bitmask for the return code of the parameter propagation methods.
|
static int |
PROPAGATE_PARAMETER_AMBIGUOUS
Bitmask for the return code of the parameter propagation methods.
|
static int |
PROPAGATE_PARAMETER_MISMATCH
Bitmask for the return code of the parameter propagation methods.
|
static int |
PROPAGATE_PARAMETER_SET
Bitmask for the return code of the parameter propagation methods.
|
static int |
REFERENCE_LAYOUT_MODE
Layout mode with reference layout.
|
static int |
SPECIFIED_PROVIDER_MODE
Layout mode with explicitly specified provider.
|
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
Constructor and Description |
---|
IlvRecursiveLayout()
Creates a new instance of the Recursive Layout algorithm that allows
you to apply layouts to the entire nested graph.
|
IlvRecursiveLayout(IlvGraphLayout referenceLayout)
Creates a new instance of the Recursive Layout algorithm that allows
you to apply the reference layout to the entire nested graph.
|
IlvRecursiveLayout(IlvLayoutProvider layoutProvider)
Creates a new instance of the Recursive Layout algorithm that allows
you to apply layouts to the entire nested graph.
|
IlvRecursiveLayout(IlvRecursiveLayout source)
Creates a new layout instance by copying an existing one.
|
Modifier and Type | Method and Description |
---|---|
void |
addGraphLayoutEventListener(GraphLayoutEventListener listener,
boolean includeSelf,
boolean traverse)
Adds a listener for the layout events delivered during the layout.
|
void |
addGraphLayoutParameterEventListener(GraphLayoutParameterEventListener listener,
boolean includeSelf,
boolean traverse)
Adds a listener for the layout parameter events delivered when layout
parameters change.
|
void |
addSubLayoutEventListener(GraphLayoutEventListener listener)
Adds a listener for the layout events delivered during the 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.
|
void |
checkAppropriateLinks()
Throws an exception if the links are not appropriate for the layout.
|
void |
contentsChanged(GraphModelEvent event)
Called when the structure or the geometry of the graph changes.
|
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
IlvRecursiveLayoutGrapherProperty
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 |
getLayout(Object subgraph)
Returns the layout instance to be used for the input subgraph.
|
int |
getLayoutMode()
Returns the layout mode of the Recursive Layout.
|
IlvLayoutProvider |
getLayoutProvider()
Returns the layout provider.
|
IlvGraphLayoutReport |
getLayoutReport(Object subgraph)
Returns the report of the graph layout of the input subgraph.
|
Enumeration |
getLayouts(boolean preOrder)
Returns the instances of
IlvGraphLayout for the nested
graph encapsulated by the graph model of this layout instance. |
IlvGraphLayout |
getReferenceLayout()
Returns the reference layout if the reference layout mode is used;
returns
null otherwise. |
IlvSubgraphCorrectionInterface |
getSubgraphCorrectionInterface()
Returns the subgraph correction interface that is applied after the
nodes and links of the subgraph were laid out.
|
protected void |
init()
Initializes instance variables.
|
boolean |
isGeometryUpToDate()
Returns
false if at least one node or link 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 |
isLoadLayoutModeFromNamesProperties()
Returns
true if loading the parameters of this layout by
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
modifies the layout mode of this instance. |
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 |
isSavePreferredLayoutsToNamedProperties()
Returns
true if saving the parameters of this layout by
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout,
boolean) sets the preferred layout flags in the created named
properties. |
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 Recursive Layout algorithm.
|
void |
layoutStepPerformed(GraphLayoutEvent event)
This method is called by the graph layouts of subgraphs.
|
IlvGraphLayoutReport |
performLayout(boolean force,
boolean redraw)
Starts the layout algorithm.
|
int |
performLayout(boolean force,
boolean redraw,
boolean traverse)
Starts the layout algorithm.
|
IlvGraphLayoutReport |
performLayout(Object subgraph,
boolean force,
boolean redraw,
boolean traverse)
Starts the layout algorithm with a subgraph.
|
protected int |
performSublayout(Object subgraph,
IlvGraphLayout layout,
boolean force,
boolean redraw)
Starts the input layout algorithm.
|
int |
propagateAndApply(String methodName,
Class layoutClass,
Object nodeOrLink,
Object[] args)
Propagates the application of a method (specified by the method name
and the arguments) to all layouts of subgraphs in the attached nested
graph.
|
void |
propagateLayoutOfConnectedComponents(IlvGraphLayout layout)
Sets the layout instance to lay out the connected components of all
subgraphs having a main layout that supports the connected component
layout mechanism.
|
void |
propagateLayoutOfConnectedComponentsEnabled(boolean enable)
Enables the connected component layout mechanism for all layouts of
subgraphs that support this feature.
|
int |
propagateLayoutParameter(String parameterName,
Class layoutClass,
boolean value)
Propagates a layout parameter to all layouts of subgraphs that support
the parameter.
|
int |
propagateLayoutParameter(String parameterName,
Class layoutClass,
float value)
Propagates a layout parameter to all layouts of subgraphs that support
the parameter.
|
int |
propagateLayoutParameter(String parameterName,
Class layoutClass,
int value)
Propagates a layout parameter to all layouts of subgraphs that support
the parameter.
|
int |
propagateLayoutParameter(String parameterName,
Class layoutClass,
Object value)
Propagates a layout parameter to all layouts of subgraphs that support
the parameter.
|
int |
propagateLayoutParameter(String parameterName,
Class layoutClass,
Object nodeOrLink,
boolean value)
Propagates a node or link layout parameter to all layouts of subgraphs
that support the parameter and contain the node or link.
|
int |
propagateLayoutParameter(String parameterName,
Class layoutClass,
Object nodeOrLink,
int value)
Propagates a node or link layout parameter to all layouts of subgraphs
that support the parameter and contain the node or link.
|
int |
propagateLayoutParameter(String parameterName,
Class layoutClass,
Object nodeOrLink,
Object value)
Propagates a node or link layout parameter to all layouts of subgraphs
that support the parameter and contain the node or link.
|
void |
propagateLinkClipInterface(IlvLinkClipInterface linkClipInterface)
Sets the clip interface for the connection points of links at all
layouts of subgraphs that support this feature.
|
void |
propagateLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface linkConnectionBoxInterface)
Sets the link connection box interface for the connection points of
links on all layouts of subgraphs that support this feature.
|
void |
removeGraphLayoutEventListener(GraphLayoutEventListener listener,
boolean includeSelf,
boolean traverse)
Removes a listener for the layout events delivered during the layout.
|
void |
removeGraphLayoutParameterEventListener(GraphLayoutParameterEventListener listener,
boolean includeSelf,
boolean traverse)
Removes a listener for the layout parameter events delivered when
layout parameters change.
|
void |
removeSubLayoutEventListener(GraphLayoutEventListener listener)
Removes a listener for the layout events delivered during the layout
of subgraphs.
|
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 |
setConnectionPointCheckEnabled(boolean enable)
Enables or disables the checks of the connection points of the links
on the origin or destination node in the attached graph model and
recursively in all graph models of subgraphs of the attached nested
graph.
|
void |
setCoordinatesMode(int mode)
Sets the coordinates mode.
|
void |
setInputCheckEnabled(boolean enable)
Sets whether checks are enabled for the nodes, links, and/or labels
provided as arguments for the different methods of this layout
algorithm and its sublayout algorithms.
|
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 |
setLayoutRunning(boolean running,
boolean fromParents)
Sets whether layout is running.
|
void |
setLinkCheckEnabled(boolean enable)
Enables or disables the checks of the links in the attached graph
model and recursively in all graph models of subgraphs of the
attached nested graph.
|
void |
setLoadLayoutModeFromNamesProperties(boolean flag)
Sets whether loading the parameters of this layout by
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
modifies the layout mode of this instance. |
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 |
setSavePreferredLayoutsToNamedProperties(boolean flag)
Sets whether saving the parameters of this layout by
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout,
boolean) sets the preferred layouts in the created named properties. |
void |
setSubgraphCorrectionInterface(IlvSubgraphCorrectionInterface ifc)
Sets the correction strategy for subgraphs.
|
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 |
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 Recursive Layout. |
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, afterLayoutOfSubgraph, attach, beforeLayout, beforeLayoutOfSubgraph, callLayoutStepPerformedIfNeeded, checkAppropriateLink, cleanGraphModel, cleanLink, cleanNode, clipAllLinks, clipLink, connectAllLinksToCenter, connectLinkToCenter, createLayoutLinkProperty, createLayoutNodeProperty, 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, isLayoutRunning, isLayoutTimeElapsed, isLocalRecursiveLayoutNeeded, isMemorySavings, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performAutoLayout, performLayout, PerformLayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, 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
public static final int REFERENCE_LAYOUT_MODE
public static final int INTERNAL_PROVIDER_MODE
IlvRecursiveLayout()
,
getLayoutMode()
,
Constant Field Valuespublic static final int SPECIFIED_PROVIDER_MODE
public static final int PROPAGATE_PARAMETER_SET
propagateLayoutParameter(java.lang.String, java.lang.Class, int)
,
Constant Field Valuespublic static final int PROPAGATE_PARAMETER_AMBIGUOUS
propagateLayoutParameter(String, Class, Object)
,
Constant Field Valuespublic static final int PROPAGATE_CLASS_MISMATCH
propagateLayoutParameter(String, Class, Object)
,
Constant Field Valuespublic static final int PROPAGATE_PARAMETER_MISMATCH
propagateLayoutParameter(String, Class, Object)
,
Constant Field Valuespublic static final int PROPAGATE_EXCEPTION
propagateLayoutParameter(String, Class, Object)
,
Constant Field Valuespublic IlvRecursiveLayout(IlvGraphLayout referenceLayout)
REFERENCE_LAYOUT_MODE
.
The reference layout 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)
.
public IlvRecursiveLayout()
setLayout(Object, IlvGraphLayout)
. The layout mode of this
Recursive Layout is 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)
.
public IlvRecursiveLayout(IlvLayoutProvider layoutProvider)
SPECIFIED_PROVIDER_MODE
.
In this mode, loading and saving parameters to named properties works
only if the Recursive Layout that loads the parameters uses a layout
provider that is compatible with the layout provider of the Recursive
Layout that was saved (that is, both layout providers should deliver
instances of the same layout class for the same subgraph). If the
layout provider implements the IlvPersistentObject
interface, the Recursive Layout
tries to save the layout provider to named properties so that it can
be loaded again, but otherwise it is the responsibility of the user
to make sure that the layout providers during loading and saving are
compatible.
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)
.
public IlvRecursiveLayout(IlvRecursiveLayout 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(ilog.views.graphlayout.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. Note that the parameters which are specific to a node or a link are not copied. It depends on the layout mode what is copied.
REFERENCE_LAYOUT_MODE
- The reference layout is copied
deeply.INTERNAL_PROVIDER_MODE
- The information on which
subgraph uses which sublayout is not copied.SPECIFIED_PROVIDER_MODE
- The specified layout provider
is copied, but not deeply.copy
in class IlvGraphLayout
IlvRecursiveLayout(IlvRecursiveLayout)
,
copyParameters(IlvGraphLayout)
,
getLayoutMode()
public void copyParameters(IlvGraphLayout source)
REFERENCE_LAYOUT_MODE
- The reference layout is copied
deeply.INTERNAL_PROVIDER_MODE
- The information on which
subgraph uses which sublayout is not copied.SPECIFIED_PROVIDER_MODE
- The specified layout provider
is copied, but not deeply.copyParameters
in class IlvGraphLayout
source
- The layout instance from which the parameters are copied.copy()
,
getLayoutMode()
public int getLayoutMode()
REFERENCE_LAYOUT_MODE
- The same layout style with the
same global layout parameters is applied to all subgraphs of the
nested graph.INTERNAL_PROVIDER_MODE
- The layout is applied using an
internal recursive layout provider. The layout styles of individual
subgraphs can be specified by setLayout(Object,
IlvGraphLayout)
.SPECIFIED_PROVIDER_MODE
- The layout is applied using
an explicitly specified layout provider.IlvRecursiveLayout()
,
IlvRecursiveLayout(IlvGraphLayout)
,
IlvRecursiveLayout(IlvLayoutProvider)
,
setLoadLayoutModeFromNamesProperties(boolean)
public IlvLayoutProvider getLayoutProvider()
If the reference layout mode is used, this method returns an
internally created instance of IlvDefaultLayoutProvider
.
If the internal provider mode is used, this method returns an
internally created instance of IlvRecursiveLayoutProvider
.
In both reference layout and internal provider modes, you should not manipulate the internally created layout provider directly.
If the specified provider mode is used, it returns the specified layout provider.
getLayoutMode()
public IlvGraphLayout getReferenceLayout()
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.
getLayoutMode()
,
IlvRecursiveLayout(IlvGraphLayout)
public void setLayout(Object subgraph, IlvGraphLayout layout)
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 Layout as needed.
subgraph
- The subgraph or null
.layout
- The layout instance used to lay out the subgraph. This
should be a new layout instance that is not used anywhere else.IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
,
getLayoutMode()
,
IlvRecursiveLayout()
,
getLayout(java.lang.Object)
public void setLayout(Object subgraph, IlvGraphLayout layout, boolean detachPrevious, boolean traverse)
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 subgraph. 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 Layout as needed.
subgraph
- The subgraph or null
.layout
- The layout instance used to lay out the subgraph. This
should be a new layout instance that is not used anywhere else.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.setLayout(Object, IlvGraphLayout)
,
IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
,
getLayoutMode()
,
IlvRecursiveLayout()
,
getLayout(Object)
public IlvGraphLayout getLayout(Object subgraph)
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.
getLayout
in class IlvGraphLayout
subgraph
- The subgraph or null
.IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
,
getLayoutMode()
,
setLayout(Object,IlvGraphLayout)
public Enumeration getLayouts(boolean preOrder)
IlvGraphLayout
for the nested
graph encapsulated by the graph model of this layout instance. You
can use this method in all layout modes. You must attach a grapher or
graph model before using this method.
This method returns the layout instance for the top-level graph and recursively for all subgraphs. The order of the enumeration can be preorder (that is, the layout of the parent graph comes before the layout of the subgraphs) or postorder (that is, the layout of the subgraphs comes before the layout of the parent graph).
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.
getLayouts
in class IlvGraphLayout
preOrder
- If true
, the layout instances are returned
in preorder, otherwise in postorder.IlvGraphLayout
for the nested
graph encapsulated by the graph model of this layout instance.IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
,
getLayoutMode()
,
getLayout(Object)
public void attach(IlvGraphModel graphModel)
In addition to the functionality of the base class, the Recursive
Layout prepares and attaches the reference layout in layout mode
REFERENCE_LAYOUT_MODE
.
attach
in class IlvGraphLayout
graphModel
- The graph model.detach()
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 Recursive Layout detaches
the sublayouts of subgraphs. 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.
public IlvGraphLayoutReport createLayoutReport()
The current implementation creates an instance of IlvRecursiveLayoutReport
.
createLayoutReport
in class IlvGraphLayout
createLayoutReport()
,
IlvRecursiveLayoutReport
public IlvGraphLayoutReport getLayoutReport(Object subgraph)
You should call this method only after layout, while the Recursive
Layout is still attached to a grapher or graph model. If
null
is passed as the subgraph, the layout report of the
top-level graph is returned. It returns null
if no
layout instance is available for the subgraph, or if no layout was
ever performed for the subgraph. You can use this method in all
layout modes.
subgraph
- The subgraph or null
.IlvGraphLayout.attach(ilog.views.IlvGrapher)
,
attach(ilog.views.graphlayout.IlvGraphModel)
,
getLayoutMode()
public int performLayout(boolean force, boolean redraw, boolean traverse) throws IlvGraphLayoutException
traverse
flag because the layout is always done
recursively.
performLayout
in class IlvGraphLayout
force
- If true
, the method IlvGraphLayout.isLayoutNeeded()
is not called. No check is made to determine if it is necessary to
perform the layout.redraw
- If true
, the attached graph model will be
asked to redraw the graph after layout. To move the nodes and
reshape the links, the implementation of this method passes 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)
.traverse
- If true
, the layout is applied to the
attached graph model and recursively to all subgraph models of the
attached graph model. Otherwise, it is only applied on the attached
graph model.IlvGraphLayoutReport.getCode()
).IlvGraphLayoutException
- A new instance of
IlvGraphLayoutException
is thrown if one of the
following occurs:
null
.IlvGraphLayout.createLayoutReport()
is null
.
The method also throws any IlvGraphLayoutException
thrown by the method IlvGraphLayout.layout(boolean)
. In particular, the following
subclasses of IlvGraphLayoutException
can be thrown:
IlvGraphLayout.performLayout()
,
IlvGraphLayout.performLayout(boolean, boolean)
,
IlvGraphLayout.PerformLayout(IlvGraphModel, IlvLayoutProvider, boolean, boolean, boolean)
,
IlvGraphModel.performLayout(IlvLayoutProvider, boolean, boolean, boolean)
,
IlvGraphLayout.layout(boolean)
,
IlvGraphLayout.isLayoutNeeded()
,
IlvGraphLayout.isStructureUpToDate()
,
IlvGraphLayout.isGeometryUpToDate()
,
IlvGraphLayout.isParametersUpToDate()
,
IlvRecursiveLayout
,
IlvGrapherAdapter.addLayer(ilog.views.IlvManagerLayer)
,
IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)
public IlvGraphLayoutReport performLayout(boolean force, boolean redraw) throws IlvGraphLayoutException
performLayout
in class IlvGraphLayout
force
- If true
, the method IlvGraphLayout.isLayoutNeeded()
is not called. No check is made to determine if it is necessary to
perform the layout.redraw
- If true
, the attached graph model will be
asked to redraw the graph after layout. To move the nodes and to
reshape the links, the implementation of this method passes 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
- A new instance of
IlvGraphLayoutException
is thrown if one of the
following occurs:
null
.IlvGraphLayout.createLayoutReport()
is null
.
The method also throws any IlvGraphLayoutException
thrown by the method IlvGraphLayout.layout(boolean)
. In particular, the following
subclasses of IlvGraphLayoutException
can be thrown:
IlvGraphLayout.performLayout()
,
IlvGraphLayout.performLayout(boolean, boolean, boolean)
,
IlvGraphLayout.PerformLayout(IlvGraphModel, IlvLayoutProvider, boolean, boolean, boolean)
,
IlvGraphModel.performLayout(ilog.views.graphlayout.IlvLayoutProvider, boolean, boolean, boolean)
,
IlvGraphLayout.layout(boolean)
,
IlvGraphLayout.isLayoutNeeded()
,
IlvGraphLayout.isStructureUpToDate()
,
IlvGraphLayout.isGeometryUpToDate()
,
IlvGraphLayout.isParametersUpToDate()
,
IlvGrapherAdapter.addLayer(ilog.views.IlvManagerLayer)
,
IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)
public IlvGraphLayoutReport performLayout(Object subgraph, boolean force, boolean redraw, boolean traverse) throws IlvGraphLayoutException
subgraph
and, the traverse
flag is set to
true
recursively for all subgraphs contained in this
subgraph
. If the subgraph
is set to
null
, the layout is started at the top level graph
subgraph
- The subgraph to start the layout.force
- If true
, the method IlvGraphLayout.isLayoutNeeded()
is
not called. No check is made to determine if it is necessary to
perform the layout.redraw
- If true
, the attached graph model will be
asked to redraw the graph after layout.traverse
- If true
, the layout is applied recursively
to all subgraphs contained in the subgraph. Otherwise, it is only
applied on the input subgraph.IlvGraphLayoutException
protected void layout(boolean redraw) throws IlvGraphLayoutException
To start the layout, call the method 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 int performSublayout(Object subgraph, IlvGraphLayout layout, boolean force, boolean redraw) throws IlvGraphLayoutException
In addition to the functionality of the base class, the Recursive Layout prepares the sublayouts according to the layout mode.
performSublayout
in class IlvGraphLayout
subgraph
- The subgraph if used during nested layout, or
null
.layout
- The sublayout to be performed.force
- If true
, no check is made to determine if it
is necessary to perform the layout.redraw
- If true
, the attached graph model will be
asked to redraw the graph after layout.IlvGraphLayoutReport.getCode()
.IlvGraphLayoutException
public void setSubgraphCorrectionInterface(IlvSubgraphCorrectionInterface ifc)
IlvSubgraphCorrectionInterface.correct(Object, IlvGraphLayout,
IlvRect, boolean)
of the subgraph correction interface is called
immediately after the layout of the subgraph has finished. This
allows you, for instance, to correct the position of the subgraph
after its contents have been laid out.
If all subgraphs are laid out completely, and the layout mode of all layouts in the nested graph is not incremental, then you do not need to install any subgraph correction interface. However, in the following situations, it is useful to install a subgraph correction interface:
IlvGraphLayout.isFixed(Object)
).IlvTreeLayout.setIncrementalMode(boolean)
or
IlvHierarchicalLayout.setIncrementalMode(boolean)
).
IlvGrapher
are used, the layout of the
subgraph affects the bounding box of the subgraph. The subgraph may
appear at a completely different position after layout, even though
no layout of the parent graph was performed that contains the
subgraph as a node, and even though IlvManager.moveObject(IlvGraphic, double, double, boolean)
was never
called for the subgraph. The reason for this effect is simply the
internal bounding box mechanism of IlvGrapher
. This effect is
very unfortunate in the situations that were described above. There
are two predefined subgraph correction strategies that help to
eliminate this effect: IlvSubgraphCorrectionBarycenterFixed
and IlvSubgraphCorrectionBoundsFixed
.getSubgraphCorrectionInterface()
public IlvSubgraphCorrectionInterface getSubgraphCorrectionInterface()
It returns null
if none is specified.
public int propagateLayoutParameter(String parameterName, Class layoutClass, int value)
This method works in all layout modes, although in reference layout mode, it is often more convenient to set the layout parameters at the reference layout directly rather than using this propagate method. If the layout mode is the internal or specified provider mode, this propagate method is convenient to use if it is necessary to set a particular layout parameter to the same value in the layouts of all subgraphs.
As an example, a nested graph has various subgraphs: for some subgraphs, the Hierarchical layout is used; for others, the Tree layout is used; and for others the Grid layout is used. The call
recursiveLayout.propagateLayoutParameter("flowDirection", IlvHierarchicalLayout.class, IlvDirection.Bottom);traverses all subgraphs that use an instance of Hierarchical layout and sets the flow direction to bottom. It does not affect the Tree layout instances and Grid layout instances in the nesting hierarchy.
The layout class can be null
. For example, the call
recursiveLayout.propagateLayoutParameter("flowDirection", null, IlvDirection.Bottom);traverses all subgraphs that use an instance of Hierarchical layout and Tree layout and sets the flow direction to bottom. It does not affect the Grid layout instances in the nesting hierarchy because the Grid layout has no parameter "flowDirection".
As further examples, the call:
recursiveLayout.propagateLayoutParameter("globalLinkStyle", null, IlvHierarchicalLayout.ORTHOGONAL_STYLE);propagates the global link style to all instances of Hierarchical layout and to all instances of Tree layout, since the value
IlvHierarchicalLayout.ORTHOGONAL_STYLE
happens to be the
same as IlvTreeLayout.ORTHOGONAL_STYLE
. However, the
call:
recursiveLayout.propagateLayoutParameter("globalLinkStyle", null, IlvHierarchicalLayout.POLYLINE_STYLE);propagates the global link style only to all instances of Hierarchical layout but not to any instance of Tree layout, because the Tree layout does not support the polyline style, that is, the method
IlvTreeLayout.setGlobalLinkStyle(int)
does
not accept the value
IlvHierarchicalLayout.POLYLINE_STYLE
.
Notice that the call
recursiveLayout.propagateLayoutParameter(pname, lclass, value);is equivalent to the call
recursiveLayout.propagateLayoutParameter(pname, lclass, new Integer(value));See
propagateLayoutParameter(String, Class, Object)
for
details of how propagation through reflection works, and for details
of the return code. In internal or specified provider mode, this
method throws a runtime exception when no graph model has been
attached.
This method changes the parameters of layouts of subgraphs that support the parameter, but does not change any parameter of the Recursive layout instance itself.
parameterName
- The name of the parameter to be set.layoutClass
- The class of the layout instances to be modified. If
null
, propagation tries to modify all layout instances
of all classes.value
- The value of the parameter to be set.propagateLayoutParameter(String, Class, Object)
,
propagateAndApply(String, Class, Object, Object[])
public int propagateLayoutParameter(String parameterName, Class layoutClass, float value)
This method works in all layout modes, although in reference layout mode, it is often more convenient to set the layout parameters on the reference layout directly rather than using this propagate method. If the layout mode is the internal or specified provider mode, this propagate method is convenient if it is necessary to set a particular layout parameter to the same value in the layouts of all subgraphs.
As an example, a nested graph has various subgraphs: for some subgraphs, the Hierarchical layout is used; for some other subgraphs, the Long Link layout is used; and for others the Grid layout is used. The call:
recursiveLayout.propagateLayoutParameter("minEndSegmentLength", IlvHierarchicalLayout.class, 3f);traverses all subgraphs that use an instance of Hierarchical layout and sets the minimum end-segment length to 3. It does not affect the Long Link layout instances and Grid layout instances in the nesting hierarchy.
The layout class can be null
. For example, the call:
recursiveLayout.propagateLayoutParameter("minEndSegmentLength", null, 3f);traverses all subgraphs that use an instance of Hierarchical layout and Long Link layout and sets the minimum end-segment length to 3. The exact meaning of the parameter "minEndSegmentLength" may be different in the Hierarchical layout and the Long Link layout, that is, propagation sets the parameter based only on the specified name independently of its meaning. This call does not affect the Grid layout instances in the nesting hierarchy because the Grid layout has no parameter "minEndSegmentLength".
Notice that the call:
recursiveLayout.propagateLayoutParameter(pname, lclass, value);is equivalent to the call
recursiveLayout.propagateLayoutParameter(pname, lclass, new Float(value));See
propagateLayoutParameter(String, Class, Object)
for
details of how propagation through reflection works, and for details
of the return code. In internal or specified provider mode, this
method throws a runtime exception when no graph model has been
attached.
This method changes the parameters of layouts of subgraphs that support the parameter, but does not change any parameter of the Recursive layout instance itself.
parameterName
- The name of the parameter to be set.layoutClass
- The class of the layout instances to be modified. If
null
, propagation tries to modify all layout instances
of all classes.value
- The value of the parameter to be set.propagateLayoutParameter(String, Class, Object)
,
propagateAndApply(String, Class, Object, Object[])
public int propagateLayoutParameter(String parameterName, Class layoutClass, boolean value)
This method works in all layout modes, although in reference layout mode, it is often more convenient to set the layout parameters at the reference layout directly rather than using this propagate method. If the layout mode is the internal or specified provider mode, this propagate method is convenient if it is necessary to set a particular layout parameter to the same value in the layouts of all subgraphs.
As an example, a nested graph has various subgraphs: for some subgraphs, the Hierarchical layout is used; for some other subgraphs, the Tree layout is used; and for others the Random layout is used. The call
recursiveLayout.propagateLayoutParameter("incrementalMode", IlvHierarchicalLayout.class, true);traverses all subgraphs that use an instance of Hierarchical layout and enables the incremental mode. It does not affect the Tree layout instances and Random layout instances in the nesting hierarchy.
The layout class can be null
. The call:
recursiveLayout.propagateLayoutParameter("incrementalMode", null, true);traverses all subgraphs that use an instance of Hierarchical layout and Tree layout and enables the incremental mode. The exact meaning of the parameter "incrementalMode" may be different in the Hierarchical layout and the Tree layout, that is, propagation sets the parameter based only on the specified name independently of its meaning. This call does not affect the Random layout instances in the nesting hierarchy because the Random layout has no parameter "incrementalMode".
Notice that the call
recursiveLayout.propagateLayoutParameter(pname, lclass, value);is equivalent to the call
recursiveLayout.propagateLayoutParameter(pname, lclass, new Boolean(value));See
propagateLayoutParameter(String, Class, Object)
for
details of how propagation through reflection works, and for details
of the return code. In internal or specified provider mode, this
method throws a runtime exception when no graph model has been
attached.
This method changes the parameters of layouts of subgraphs that support the parameter, but does not change any parameter of the Recursive layout instance itself.
parameterName
- The name of the parameter to be set.layoutClass
- The class of the layout instances to be modified. If
null
, propagation tries to modify all layout instances
of all classes.value
- The value of the parameter to be set.propagateLayoutParameter(String, Class, Object)
,
propagateAndApply(String, Class, Object, Object[])
public int propagateLayoutParameter(String parameterName, Class layoutClass, Object value)
This method works in all layout modes, although in reference layout mode, it is often more convenient to set the layout parameters at the reference layout directly rather than using this propagate method. If the layout mode is the internal or specified provider mode, this propagate method is convenient if it is necessary to set a particular layout parameter to the same value in the layouts of all subgraphs.
As an example, a nested graph has various subgraphs: for some subgraphs, the Grid layout is used; for some other subgraphs, the Short Link layout is used; and for others the Long Link layout is used. The call:
recursiveLayout.propagateLayoutParameter("nodeSideFilter", IlvShortLinkLayout.class, myFilter);traverses all subgraphs that use an instance of Short Link layout and sets the node-side filter to
myFilter
. It does not
affect the Grid layout instances and Long Link layout instances in
the nesting hierarchy.
The layout class can be null
. For example, the call:
recursiveLayout.propagateLayoutParameter("nodeSideFilter", null, myFilter);traverses all subgraphs that use an instance of Long Link layout and Short Link layout and sets the node-side filter. It does not affect the Grid layout instances in the nesting hierarchy because the Grid layout has no parameter "nodeSideFilter".
Propagation is performed in the following way: in reference layout
mode, it first checks whether the reference layout has the specified
layout class and then through reflection whether the reference layout
has a public, nonstatic set method that matches the parameter name
and value type. If the value is a Number
and the set
method expects a number of a different type, then the value is
converted if possible. Then propagation calls the set method and
catches the exception, if any. If there was no exception, setting is
considered successful. In reference layout mode, it is sufficient to
modify the reference layout because all other layout instances of the
nested graph use the same parameters as the reference layout.
If a graph is attached and the layout mode is the internal or
specified provider mode, propagation traverses the entire nesting
hierarchy. For each layout instance of a subgraph, it first checks
whether the layout instance has the specified layout class and then
through reflection whether the layout instance has a public,
nonstatic set method that matches the parameter name and value type.
If the value is a Number
and the set method expects a
number of a different type, then the value is converted if possible.
Then propagation calls the set method and catches the exception, if
any. If there was no exception, setting is considered successful. If
you insert subgraphs after calling this propagate method, or if you
change the layout instances of subgraphs either in your specified
provider or through setLayout(Object, IlvGraphLayout)
in the
internal provider after calling this method, the new layouts of these
subgraphs may have a different setting.
In internal or specified provider mode, this method throws a runtime exception when no graph model has been attached.
The return value of this method is a bitwise-Or combination of the following bit masks:
PROPAGATE_PARAMETER_SET
- the layout parameter was
successfully set for some layout instance of a subgraph. PROPAGATE_PARAMETER_AMBIGUOUS
- the method to use to set
the layout parameter could not be uniquely determined for some layout
instance, because there were many methods with the same name,
constituting an unsolvable ambiguity. In this case, an arbitrary
method is chosen from the methods with the same name to set the
parameter, because propagation assumes that with a proper design of
the graph layout class, the overloaded methods are closely related.
PROPAGATE_CLASS_MISMATCH
- the layout parameter was not
set for some layout instance of a subgraph because the layout
instance did not match the specified layout class. PROPAGATE_PARAMETER_MISMATCH
- the layout parameter was
not set for some layout instance of a subgraph either because no
matching set method with appropriate argument type was found through
reflection, or because the security manager of the Java VM did not
allow reflection. PROPAGATE_EXCEPTION
- the layout parameter was not set
for some layout instance of a subgraph because calling the matching
set method raised an exception. parameterName
- The name of the parameter to be set.layoutClass
- The class of the layout instances to be modified. If
null
, propagation tries to modify all layout instances
of all classes.value
- The value of the parameter to be set.propagateAndApply(String, Class, Object, Object[])
public int propagateLayoutParameter(String parameterName, Class layoutClass, Object nodeOrLink, int value)
IlvGrapherAdapter
), each
node or link belongs to exactly one subgraph, hence this method
simply sets the layout parameter for the layout instance of the
subgraph that contains the node or link. The layout parameter is
specified by a parameter name as a string and a parameter type as a
class. The parameter name follows the JavaBeans property naming
convention, that is, if a layout parameter of a subgraph can be set
by a public method "setMyName", the parameter name "myName" must be
used when propagating a value for this parameter.
This method works in all layout modes. It can be called after the graph model is attached, otherwise it throws a runtime exception.
As an example, a nested graph has various subgraphs: for some subgraphs, the Hierarchical layout is used; for some other subgraphs, the Tree layout is used; and for others the Grid layout is used. The call:
recursiveLayout.propagateLayoutParameter("linkStyle", IlvHierarchicalLayout.class, link, IlvHierarchicalLayout.ORTHOGONAL_STYLE);sets the link style of the link to orthogonal style, if the link belongs to a subgraph that uses an instance of Hierarchical layout. If the link belongs to a subgraph that uses Grid layout or Tree layout instances, then the call has no effect.
The layout class can be null
. For example, the call:
recursiveLayout.propagateLayoutParameter("linkStyle", null, link, IlvHierarchicalLayout.ORTHOGONAL_STYLE);sets the link style of the link to orthogonal style, if the link belongs to a subgraph that uses an instance of Hierarchical layout or Tree layout. This call does not affect the Grid layout instances because they have no link style parameter. If the link belongs to a subgraph with Tree layout, the call is successful because the value
IlvHierarchicalLayout.ORTHOGONAL_STYLE
happens to be the
same as IlvTreeLayout.ORTHOGONAL_STYLE
. However, the
call:
recursiveLayout.propagateLayoutParameter("linkStyle", null, link, IlvHierarchicalLayout.POLYLINE_STYLE);would not work if the link belongs to a subgraph with Tree layout, because even though the Tree layout has a link style parameter, the method
IlvTreeLayout.setLinkStyle(Object, int)
does not accept the value
IlvHierarchicalLayout.POLYLINE_STYLE
.
Notice that the call:
recursiveLayout.propagateLayoutParameter(pname, lclass, nodeOrLink, value);is equivalent to the call
recursiveLayout.propagateLayoutParameter(pname, lclass, nodeOrLink, new Integer(value));See
propagateLayoutParameter(String, Class, Object, Object)
for details of how propagation through reflection works, and for
details of the return code.
parameterName
- The name of the parameter to be set.layoutClass
- The class of the layout instances to be modified. If
null
, propagation tries to modify all layout instances
of all classes.nodeOrLink
- The node or link on which the parameter is to be set.value
- The value of the parameter to be set.propagateLayoutParameter(String, Class, Object, Object)
,
propagateAndApply(String, Class, Object, Object[])
public int propagateLayoutParameter(String parameterName, Class layoutClass, Object nodeOrLink, boolean value)
IlvGrapherAdapter
), each
node or link belongs to exactly one subgraph, hence it simply sets
the layout parameter for the layout instance of the subgraph that
contains the node or link. The layout parameter is specified by a
parameter name as a string and a parameter type as a class. The
parameter name follows the JavaBeans property naming convention, that
is, if a layout parameter of a subgraph can be set by a public method
"setMyName", the parameter name "myName" must be used when
propagating a value for this parameter.
This method works in all layout modes. It can be called after the graph model is attached, otherwise it throws a runtime exception.
As an example, the call:
recursiveLayout.propagateLayoutParameter("fixed", IlvTreeLayout.class, node, true);sets the node to be fixed if it belongs to a subgraph of the attached nested graph, and if the subgraph uses a Tree layout instance. The specified layout class can be null. For example, the call:
recursiveLayout.propagateLayoutParameter("fixed", null, node, true);sets the node to be fixed if it belongs to a subgraph of the attached nested graph, independently of the layout class that is used for this subgraph. Setting the node to be fixed has an effect only if the layout supports the preserving of fixed nodes (see
IlvGraphLayout.setPreserveFixedNodes(boolean)
).
Notice that the call
recursiveLayout.propagateLayoutParameter(pname, lclass, nodeOrLink, value);is equivalent to the call
recursiveLayout.propagateLayoutParameter(pname, lclass, nodeOrLink, new Boolean(value));See
propagateLayoutParameter(String, Class, Object, Object)
for details of how propagation through reflection works, and for
details of the return code.
parameterName
- The name of the parameter to be set.layoutClass
- The class of the layout instances to be modified. If
null
, propagation tries to modify all layout instances
of all classes.nodeOrLink
- The node or link on which the parameter is to be set.value
- The value of the parameter to be set.propagateLayoutParameter(String, Class, Object, Object)
,
propagateAndApply(String, Class, Object, Object[])
public int propagateLayoutParameter(String parameterName, Class layoutClass, Object nodeOrLink, Object value)
IlvGrapherAdapter
), each
node or link belongs to exactly one subgraph, hence this method
simply sets the layout parameter for the layout instance of the
subgraph that contains the node or link. The layout parameter is
specified by a parameter name as a string and a parameter type as a
class. The parameter name follows the JavaBeans property naming
convention, that is, if a layout parameter of a subgraph can be set
by a public method "setMyName", the parameter name "myName" must be
used when propagating a value for this parameter.
This method works in all layout modes. It can be called after the graph model is attached, otherwise it throws a runtime exception.
As an example, a nested graph has some subgraphs that use a Circular layout. The call:
recursiveLayout.propagateLayoutParameter("clusterId", IlvCircularLayout.class, node, myClusterId);sets the cluster identifier of the node to
myClusterId
if the node belongs to a subgraph of the attached nested graph. The
layout class indicates which layout instances should be tried when
setting the layout parameter. For example, the call:
recursiveLayout.propagateLayoutParameter("clusterId", IlvRandomLayout.class, node, myClusterId);has no effect, because the random layout has no parameter called
clusterId
. The layout class can be null
.
The call:
recursiveLayout.propagateLayoutParameter("clusterId", null, node, myClusterId);sets the cluster identifier of the node to
myClusterId
if the node belongs to a subgraph of the attached nested graph. It is
a little bit slower than the first call which provided the Circular
Layout class as argument.
Propagation is performed in the following way: if a graph is
attached, propagation traverses the entire nesting hierarchy. For
each layout instance of a subgraph, it first checks whether the
layout instance has the specified layout class and whether it
contains the input node or link, then through reflection whether the
layout instance has a public, nonstatic set method that matches the
parameter name and value type. If the value is a Number
and the set method expects a number of a different type, then the
value is converted if possible. Then propagation calls the set method
and catches the exception, if any. If there was no exception, setting
is considered successful.
The return value of this method is a bitwise-Or combination of the following bit masks:
PROPAGATE_PARAMETER_SET
- the layout parameter was
successfully set at some layout instance of a subgraph. PROPAGATE_PARAMETER_AMBIGUOUS
- the method to set the
layout parameter could not be uniquely determined at some layout
instance, because there were many methods with the same name,
consituting an unsolvable ambiguity. In this case, an arbitrary
method from the methods with the same name is chosen to set the
parameter, because propagation assumes that with a proper design of
the graph layout class, the overloaded methods are closely related.
PROPAGATE_CLASS_MISMATCH
- the layout parameter was not
set at some layout instance of a subgraph because the layout instance
did not match the specified layout class. PROPAGATE_PARAMETER_MISMATCH
- the layout parameter was
not set at some layout instance of a subgraph either because no
matching set method with appropriate argument type was found through
reflection, or because the security manager of the Java VM did not
allow reflection. PROPAGATE_EXCEPTION
- the layout parameter was not set
at some layout instance of a subgraph because calling the set method
raised an exception. parameterName
- The name of the parameter to be set.layoutClass
- The class of the layout instances to be modified. If
null
, propagation tries to modify all layout instances
of all classes.nodeOrLink
- The node or link on which the parameter is to be set.value
- The value of the parameter to be set.propagateAndApply(String, Class, Object, Object[])
public int propagateAndApply(String methodName, Class layoutClass, Object nodeOrLink, Object[] args)
null
is
passed as layout class, the method is applied to all layout instances
of any class.null
is passed as node or link, the method is applied to
all layout instances of any subgraph.
The nodeOrLink
parameter is only a way to specify which
layout instance of subgraphs is affected. Unlike the behavior of
propagateLayoutParameter(String, Class, Object, Object)
, the
node or link passed is not used as an argument of the method. Only
the args
parameter is used as an argument of the method.
This is the low-level mechanism that propagateLayoutParameter
is based on.
Propagation is performed in the following way: if a graph is
attached, it traverses the entire nesting hierarchy. For each layout
instance of a subgraph, it first checks whether the layout instance
has the specified layout class. If a node or link is specified,
propagation checks through IlvGraphModel.isNode(Object)
and
IlvGraphModel.isLink(Object)
whether the subgraph model
contains the node or link. It then checks through reflection whether
the layout instance has a public, nonstatic method of the specified
name that matches the argument types. In order to detect the correct
method, an argument type conversion may be applied (for example,
Integer is converted to Float if necessary). If a layout instance has
many overloaded methods that match the argument types, propagation
applies an overload resolution algorithm as the Java compiler would.
It then calls this method and catches the exception, if any. If there
was no exception, the call is considered successful.
The return value of this method is a bitwise-Or combination of the following bit masks:
PROPAGATE_PARAMETER_SET
- the method was successfully
applied to some layout instance of a subgraph. PROPAGATE_PARAMETER_AMBIGUOUS
- the method could not be
uniquely determined for some layout instance, because there were many
methods with the same name, constituting an unsolvable ambiguity. In
this case, an arbitrary method is chosen from the methods with the
same name. PROPAGATE_CLASS_MISMATCH
- the method was not applied to
some layout instance of a subgraph because the layout instance did
not match the specified layout class. PROPAGATE_PARAMETER_MISMATCH
- the method was not
applied to some layout instance of a subgraph either because no
matching method with appropriate argument types was found through
reflection, or because the security manager of the Java VM did not
allow reflection. PROPAGATE_EXCEPTION
- the method was applied but threw
an exception at some layout instance of a subgraph. A runtime exception is thrown when no graph model has been attached.
The overload resolution mechanism is similar to the Java compiler
overload resolution. Primitive number types are widened as necessary,
for example, an int
argument can be used for a
float
parameter but not the converse. There are a few
situations, like the following, where propagation detects an
ambiguity but the compiler would not complain:
public void myName(int x) { ... } public void myName(Integer x) { ... }The compiler can easily distinguish between
obj.myName(1)
and obj.myName(new
Integer(1))
without ambiguity, while
propagateAndApply("nyName", null, null, args)
cannot,
since the array args
must contain an
Integer
object for both cases.
Another situation where an ambiguity is reported that the compiler
would not report occurs when a final method of the same name is
declared in the superclass and in the subclass. The compiler chooses
the method in the subclass, but propagateAndApply
chooses either arbitrarily.
In a good class design, these situations should not usually occur.
methodName
- The name of the method to be applied.layoutClass
- The class of the layout instances where the method is
to be applied. If null
, propagation tries to apply the
method to all layout instances of all classes.nodeOrLink
- If a node or link is passed, the method is only
called on those layout instanced of subgraphs that contain the node
or link. If null
is passed, propagation tries to apply
the method to all layout instances.args
- The arguments of the method.propagateLayoutParameter(String, Class, Object)
public void setCoordinatesMode(int mode)
setLayout(Object,
IlvGraphLayout)
in the internal provider after calling this method,
the new layouts of these subgraphs may have a different coordinates
mode.
Warning: In internal or specified provider mode, this method does not throw an exception when no graph model is yet attached. However, if no graph model is yet attached, the method cannot traverse any nesting hierarchy.
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. In reference layout mode, it also calls
setUseDefaultParameters
at the reference layout, hence
all layouts of subgraphs will use this parameter setting. If a graph
is attached and the layout mode is the internal or specified provider
mode, it traverses the nesting hierarchy and calls
setUseDefaultParameters
for all layout instances of
subgraphs. However, if you insert subgraphs after calling this
method, or if you change the layout instances of subgraphs in your
specified provider or via setLayout(Object, IlvGraphLayout)
in the internal provider after calling this method, the new layouts
of these subgraphs may have a different setting.
Warning: In internal or specified provider mode, this method does not throw an exception when no graph model is yet attached. However, if no graph model is yet attached, the method cannot traverse any nesting hierarchy.
The default value of this parameter is false
.
setUseDefaultParameters
in class IlvGraphLayout
IlvGraphLayout.isUseDefaultParameters()
public void setAllowedTime(long time)
The default value for Recursive 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. In reference layout
mode, it also calls setMinBusyTime
at the reference
layout, hence all layouts of subgraphs will use this parameter
setting. If a graph is attached and the layout mode is the internal
or specified provider mode, it traverses the nesting hierarchy and
calls setMinBusyTime
for all layout instances of
subgraphs. However, if you insert subgraphs after calling this
method, or if you change the layout instances of subgraphs in your
specified provider or via setLayout(Object, IlvGraphLayout)
in the internal provider after calling this method, the new layouts
of these subgraphs may have a different setting.
Warning: In internal or specified provider mode, this method does not throw an exception when no graph model is yet attached. However, if no graph model is yet attached, the method cannot traverse any nesting hierarchy.
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.
This disables autolayout on all sublayouts.
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 contentsChanged(GraphModelEvent event)
GraphModelListener
interface.contentsChanged
in interface GraphModelListener
contentsChanged
in class IlvGraphLayout
event
- The event which describes the change that has occurred in
the graph model.IlvGraphLayout.isAutoLayout()
,
IlvGraphLayout.performAutoLayout()
public void setInputCheckEnabled(boolean enable)
In reference layout mode, it also calls
setInputCheckEnabled
at the reference layout, hence all
layouts of subgraphs will use this parameter setting. If a graph is
attached and the layout mode is the internal or specified provider
mode, it traverses the nesting hierarchy and calls
setInputCheckEnabled
for all layout instances of
subgraphs. However, if you insert subgraphs after calling this
method, or if you change the layout instances of subgraphs in your
specified provider or via setLayout(Object, IlvGraphLayout)
in the internal provider after calling this method, the new layouts
of these subgraphs may have a different setting.
Warning: In internal or specified provider mode, this method does not throw an exception when no graph model is yet attached. However, if no graph model is yet attached, the method cannot traverse any nesting hierarchy.
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 propagateLayoutOfConnectedComponentsEnabled(boolean enable)
In reference layout mode, this method calls IlvGraphLayout.setLayoutOfConnectedComponentsEnabled(boolean)
on the
reference layout, if the reference layout supports this feature. If a
graph is attached and the layout mode is the internal or specified
provider mode, this method traverses the nesting hierarchy and calls
IlvGraphLayout.setLayoutOfConnectedComponentsEnabled(boolean)
for all layout instances of subgraphs that support this feature. If
you insert subgraphs after calling this method, or if you change the
layout instances of subgraphs either in your specified provider or
through setLayout(Object, IlvGraphLayout)
in the internal
provider after calling this method, the new layouts of these
subgraphs may have a different setting.
In internal or specified provider mode, this method throws a runtime exception when no graph model has been attached.
enable
- If true
, enables the connected component
layout mechanism for all layouts of subgraphs that support this
feature.IlvGraphLayout.setLayoutOfConnectedComponentsEnabled(boolean)
,
IlvGraphLayout.supportsLayoutOfConnectedComponents()
public void propagateLayoutOfConnectedComponents(IlvGraphLayout layout)
In reference layout mode, this method calls IlvGraphLayout.setLayoutOfConnectedComponents(IlvGraphLayout)
on the
reference layout, if the reference layout supports this feature. If a
graph is attached and the layout mode is the internal or specified
provider mode, this method traverses the nesting hierarchy and calls
IlvGraphLayout.setLayoutOfConnectedComponents(IlvGraphLayout)
for all layout instances of subgraphs that support this feature. If
you insert subgraphs after calling this method, or if you change the
layout instances of subgraphs either in your specified provider or
through setLayout(Object, IlvGraphLayout)
in the internal
provider after calling this method, the new layouts of these
subgraphs may have a different setting.
In internal or specified provider mode, this method throws a runtime exception when no graph model has been attached.
layout
- The layout instance that lays out the connected components
of all subgraphs having a main layout that supports the connected
component layout mechanism.IlvGraphLayout.setLayoutOfConnectedComponents(IlvGraphLayout)
,
IlvGraphLayout.supportsLayoutOfConnectedComponents()
public void propagateLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface linkConnectionBoxInterface)
In reference layout mode, this method calls IlvGraphLayout.setLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface)
on the reference layout, if the reference layout supports this
feature. If a graph is attached and the layout mode is the internal
or specified provider mode, this method traverses the nesting
hierarchy and calls IlvGraphLayout.setLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface)
for all layout instances of subgraphs that support this feature. If
you insert subgraphs after calling this method, or if you change the
layout instances of subgraphs either in your specified provider or
through setLayout(Object, IlvGraphLayout)
in the internal
provider after calling this method, the new layouts of these
subgraphs may have a different setting.
In internal or specified provider mode, this method throws a runtime exception when no graph model has been attached.
linkConnectionBoxInterface
- The link connection box interface for
the connection points of links for all layouts of subgraphs that
support this feature.IlvGraphLayout.setLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface)
,
IlvGraphLayout.supportsLinkConnectionBox()
public void propagateLinkClipInterface(IlvLinkClipInterface linkClipInterface)
In reference layout mode, it calls IlvGraphLayout.setLinkClipInterface(IlvLinkClipInterface)
at the
reference layout, if the reference layout supports this feature. If a
graph is attached and the layout mode is the internal or specified
provider mode, it traverses the nesting hierarchy and calls IlvGraphLayout.setLinkClipInterface(IlvLinkClipInterface)
for all
layout instances of subgraphs that support this feature. However, if
you insert subgraphs after calling this method, or if you change the
layout instances of subgraphs in your specified provider or via
setLayout(Object, IlvGraphLayout)
in the internal provider
after calling this method, the new layouts of these subgraphs may
have a different setting.
In internal or specified provider mode, this method throws a runtime exception when no graph model is yet attached.
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 a 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 a
layout also will not throw an IlvInappropriateLinkException
.
(Notice that performing a layout may still throw other exceptions.)
You can control which checks are done for all graph models in the
nested graph by setLinkCheckEnabled(boolean)
and setConnectionPointCheckEnabled(boolean)
. You can also control at the graph
model of individual subgraphs which checks are done by IlvGraphModel.setLinkCheckEnabled(boolean)
and IlvGraphModel.setConnectionPointCheckEnabled(boolean)
.
This implementation traverses the nesting hierarchy and checks the
sublayouts of all subgraphs. The typical usage is to call
checkAppropriateLinks
to catch the exception and to call
IlvGraphLayoutUtil.EnsureAppropriateLinks(IlvInappropriateLinkException)
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 void setLinkCheckEnabled(boolean enable)
IlvGraphModel.setLinkCheckEnabled(boolean)
for details.
setConnectionPointCheckEnabled(boolean)
public void setConnectionPointCheckEnabled(boolean enable)
IlvGraphModel.setConnectionPointCheckEnabled(boolean)
for
details.
setLinkCheckEnabled(boolean)
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. It 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
IlvGraphLayout.setParametersUpToDate(boolean)
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
IlvGraphLayout.setStructureUpToDate(boolean)
public boolean isGeometryUpToDate()
false
if at least one node or link 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. It 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
IlvGraphLayout.setGeometryUpToDate(boolean)
public boolean useAnimateRedraw()
true
if animation is supported and enabled for
any sublayout of the Recursive Layout. Even though Recursive Layout
itself does not support animation directly, it still supports that
the sublayouts of subgraphs 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 void addSubLayoutEventListener(GraphLayoutEventListener listener)
This listener does not receive the layout events from the Recursive
Layout, but rather the events for the layouts of the subgraphs (that
is, event.getSource()
returns the sublayout, not the
Recursive Layout, and event.getGraphLayoutReport()
returns the report of the sublayout, not the report of the Recursive
Layout). If you want to receive events from the Recursive Layout
itself, please use IlvGraphLayout.addGraphLayoutEventListener(GraphLayoutEventListener)
on the
Recursive Layout instance instead.
Unlike addGraphLayoutEventListener(GraphLayoutEventListener,
boolean, boolean)
, you do not need to worry about updating these
layout event listeners yourself when you insert or remove subgraphs
after calling this method, or when you change the layout instances of
subgraphs in the layout provider, because the sublayout listener is
not directly installed at the layouts of the subgraphs.
listener
- The listener.removeSubLayoutEventListener(ilog.views.graphlayout.GraphLayoutEventListener)
,
layoutStepPerformed(ilog.views.graphlayout.GraphLayoutEvent)
public void removeSubLayoutEventListener(GraphLayoutEventListener listener)
listener
- The listener.addSubLayoutEventListener(ilog.views.graphlayout.GraphLayoutEventListener)
public void addGraphLayoutEventListener(GraphLayoutEventListener listener, boolean includeSelf, boolean traverse)
traverse
flag is true
and a graph is
attached, it traverses the nesting hierarchy to also add the listener
to the layouts of subgraphs that are currently in the hierarchy. If
you insert or remove subgraphs after calling this method, or if you
change the layout instances of subgraphs in your specified provider
or via setLayout(Object, IlvGraphLayout)
in the internal
provider after calling this method, you are responsible yourself for
updating the layout event listeners.
It is in most cases more efficient and more convenient to install a
listener via addSubLayoutEventListener(GraphLayoutEventListener)
at the
Recursive Layout rather than traversing the subgraphs and installing
a listener on all sublayouts. Only if the order of how different
listeners receive the same event is critical does it make sense to
use this method.
If the traverse flag is true
in internal or specified
provider mode and no graph model is yet attached, this method throws
a runtime exception.
listener
- The listener.includeSelf
- If true
, it adds the listener to this
Recursive Layout instance.traverse
- If true
, it adds the listener to all
layouts of subgraphs.IlvGraphLayout.addGraphLayoutEventListener(ilog.views.graphlayout.GraphLayoutEventListener)
public void removeGraphLayoutEventListener(GraphLayoutEventListener listener, boolean includeSelf, boolean traverse)
traverse
flag is true
and a graph is
attached, it traverses the nesting hierarchy to also remove the
listener from the layouts of subgraphs that are currently in the
hierarchy.
If the traverse flag is true
in internal or specified
provider mode and no graph model is yet attached, this method throws
a runtime exception.
listener
- The listener.includeSelf
- If true
, it removes the listener from
this Recursive Layout instance.traverse
- If true
, it removes the listener from
all layouts of subgraphs.IlvGraphLayout.removeGraphLayoutEventListener(ilog.views.graphlayout.GraphLayoutEventListener)
public void addGraphLayoutParameterEventListener(GraphLayoutParameterEventListener listener, boolean includeSelf, boolean traverse)
traverse
flag is
true
and a graph is attached, it traverses the nesting
hierarchy to also add the listener to the layouts of subgraphs that
are currently in the hierarchy. If you insert or remove subgraphs
after calling this method, or if you change the layout instances of
subgraphs in your specified provider or via setLayout(Object,
IlvGraphLayout)
in the internal provider after calling this method,
you are responsible yourself for updating the layout parameter event
listeners.
If the traverse flag is true
in internal or specified
provider mode and no graph model is yet attached, this method throws
a runtime exception.
listener
- The listener.includeSelf
- If true
, it adds the listener to this
Recursive Layout instance.traverse
- If true
, it adds the listener to all
layouts of subgraphs.IlvGraphLayout.addGraphLayoutParameterEventListener(ilog.views.graphlayout.GraphLayoutParameterEventListener)
public void removeGraphLayoutParameterEventListener(GraphLayoutParameterEventListener listener, boolean includeSelf, boolean traverse)
traverse
flag is
true
and a graph is attached, it traverses the nesting
hierarchy to also remove the listener from the layouts of subgraphs
that are currently in the hierarchy.
If the traverse flag is true
in internal or specified
provider mode and no graph model is yet attached, this method throws
a runtime exception.
listener
- The listener.includeSelf
- If true
, it removes the listener from
this Recursive Layout instance.traverse
- If true
, it removes the listener from
all layouts of subgraphs.IlvGraphLayout.removeGraphLayoutParameterEventListener(ilog.views.graphlayout.GraphLayoutParameterEventListener)
public boolean supportsPercentageComplete()
If some sublayouts do not support this feature, the Recursive Layout algorithm can indicate by discrete percentage values how many layouts of subgraphs are already finished. For instance, if the nesting hierarchy contains five graphs, the percentage will increase in fixed steps by 20%.
The calculated percentage values are not very precise.
supportsPercentageComplete
in class IlvGraphLayout
true
.IlvGraphLayout.increasePercentageComplete(int)
,
IlvGraphLayoutReport.getPercentageComplete()
,
IlvJGraphLayoutProgressBar
public boolean supportsStopImmediately()
In principle, the Recursive Layout supports this feature. If, however, the sublayout of a subgraph is running and does not support this feature, then the sublayout runs to completion first before the entire nested layout is stopped.
If the layout algorithm is stopped before completion, the result code
of the layout report is IlvGraphLayoutReport.STOPPED_AND_INVALID
.
supportsStopImmediately
in class IlvGraphLayout
true
.stopImmediately()
,
IlvGraphLayout.isStoppedImmediately()
public boolean supportsAllowedTime()
In principle, the Recursive Layout supports this feature. If, however, the sublayout of a subgraph is running and does not support this feature, then the sublayout runs to completion first before the entire nested layout is stopped when the allowed time has elapsed.
If the layout algorithm is stopped before completion, the result code
of the layout report is IlvGraphLayoutReport.STOPPED_AND_INVALID
.
supportsAllowedTime
in class IlvGraphLayout
true
.setAllowedTime(long)
,
getAllowedTime()
,
IlvGraphLayout.isLayoutTimeElapsed()
public boolean supportsSaveParametersToNamedProperties()
.ivl
file. It returns
true
if no graph or graph model is attached, or if all
layouts of subgraphs of the attached graph model support this
feature.
In reference layout mode and internal provider mode, saving all
layout parameters of all subgraphs is possible. In specified provider
mode, loading and saving parameters to named properties works only if
the Recursive Layout that loads the parameters uses a layout provider
that is compatible with the layout provider of the Recursive Layout
that was saved (that is, both layout providers should deliver
instances of the same layout class for the same subgraph). If the
layout provider implements the IlvPersistentObject
interface, the Recursive Layout
tries to save the layout provider to named properties so that it can
be loaded again, but otherwise it is in the responsibility of the
user to make sure that the layout providers during loading and saving
are compatible.
supportsSaveParametersToNamedProperties
in class IlvGraphLayout
false
.IlvGrapherAdapter.saveParametersToNamedProperties(ilog.views.graphlayout.IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(ilog.views.graphlayout.IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
,
setSavePreferredLayoutsToNamedProperties(boolean)
,
setLoadLayoutModeFromNamesProperties(boolean)
protected IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name, boolean withDefaults)
IlvRecursiveLayoutGrapherProperty
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 setSavePreferredLayoutsToNamedProperties(boolean flag)
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout,
boolean)
sets the preferred layouts in the created named properties.
This is an expert option. It is disabled by default, to avoid side
effects when multiple instances of IlvRecursiveLayout
and IlvDefaultLayoutProvider
are used at the same time.
Normally, when you load and save layout parameters of the Recursive
Layout, you do not need to change this option. The loading of
parameters of the Recursive Layout works independently from this
option, because the loading mechanism does not utilize the method
IlvGrapherAdapter.loadPreferredLayoutsFromNamedProperties(IlvDefaultLayoutProvider,
boolean, boolean)
.
Disabling the saving of preferred layouts means that
loadPreferredLayoutsFromNamedProperties
is not able to
load the preferred layouts that are internally used by the Recursive
Layout. In most situations, this is also not necessary.
The only situation where you want to enable this option is if you
want to save the layout parameters of a Recursive Layout, but you
later do not want to load the parameters into another Recursive
Layout, but rather transfer the parameter into a separate IlvDefaultLayoutProvider
via IlvGrapherAdapter.loadPreferredLayoutsFromNamedProperties(IlvDefaultLayoutProvider,
boolean, boolean)
.
Notice that you should not enable this option and use IlvGrapherAdapter.savePreferredLayoutsToNamedProperties(IlvDefaultLayoutProvider,
boolean, boolean, boolean)
on the nested graph at the same time,
because the one mechanism will influence the other mechanism by side
effects.
public boolean isSavePreferredLayoutsToNamedProperties()
true
if saving the parameters of this layout by
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout,
boolean)
sets the preferred layout flags in the created named
properties.
public void setLoadLayoutModeFromNamesProperties(boolean flag)
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
modifies the layout mode of this instance. This is an expert option.
It is enabled by default.
If the option is enabled, this instance of the Recursive Layout gets
the same layout mode as the instance of the Recursive Layout whose
parameters were saved in the named properties. In reference layout
mode or internal provider mode, the saved and the loaded instances
will be automatically compatible. In specified provider mode, the
saved and the loaded instances will be compatible if the specified
layout provider implements the IlvPersistentObject
interface and was successfully
loaded into the property.
If the option is disabled, it is your own responsibility to make sure that this instance of Recursive Layout is compatible with the saved instance. In internal provider mode, it can load all parameters independently from the layout mode that was used when saving. In reference layout mode, you must make sure that the same reference layout class is used during saving and loading. In specified provider mode, you must make sure that the layout provider used during loading is compatible with the layout parameters that were saved (for instance, by using the same layout provider during saving and loading).
public boolean isLoadLayoutModeFromNamesProperties()
true
if loading the parameters of this layout by
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
modifies the layout mode of this instance.
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()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.