Use this mode if you want to perform graph
layout on a nested graph and either you need individual global
layout parameters for specific subgraphs or you want to lay out
different subgraphs with different styles. In this case, there is
no reference layout. You allocate the Recursive Layout by calling
the constructor with no arguments:
IlvRecursiveLayout()
Before you can perform a layout, you need to
specify which layout is used for which subgraph. First, you should
attach the Recursive Layout to a graph. Then, to specify the layout
of the top-level graph, call:
recursiveLayout.setLayout(null, sublayout);
To specify the layout of a specific
subgraph, call
recursiveLayout.setLayout(subgraph, sublayout);
It is important that you assign a different layout instance for
each subgraph. You cannot share the same layout instance among
different subgraphs. You should allocate a new, fresh layout
instance for each subgraph. If you pass
null
as sublayout, then no layout is performed for this particular
subgraph.
To set the layout for a subgraph and
recursively for all its subgraphs, you can use:
setLayout(Object subgraph, IlvGraphLayout layout, boolean traverse)
and pass the
true
argument for the
traverse
flag. This sets the layouts to a clone of the input layout for each
subgraph starting at the input subgraph.
Internally, the Recursive Layout uses a layout provider of type
IlvRecursiveLayoutProvider
. You can access the current layout provider by:
IlvLayoutProvider getLayoutProvider()
In internal provider mode, it is mostly not
necessary to manipulate the layout provider directly.
Because there is no reference layout, global
layout parameters are independent for each subgraph. Global and
local layout parameters can be set by accessing the particular
layout instance that is assigned to a specific subgraph.
After you attach the Recursive Layout to
the top-level grapher or graph model, you can retrieve the layout
instance of a specific subgraph by:
IlvGraphLayout getLayout(Object subgraph)
If you pass
null
as subgraph, you get the layout instance of the top-level graph.
The layout instances of the subgraphs used
during recursive layout remain attached to the subgraphs (or the
graph models of the subgraphs, respectively) as long as the
Recursive Layout itself is attached. When you detach the Recursive
Layout, all layouts of subgraphs are automatically detached as
well.