public abstract class IlvGraphLayout
extends java.lang.Object
JViews provides special support for applications that need to display
graphs (also called networks) of nodes and links. Using the IlvGrapher
class, any graphic object can be defined to behave like a
node and can be connected to other nodes with links, which themselves
can have many different forms. Used in conjunction with layout
algorithms, this feature is often used to create network topologies
for telecommunications networks and system management applications.
The usage of the Graph Layout algorithms is not restricted to
applications using an IlvGrapher
to store and display the
graph. You can use external graph data source structures. This is
achieved through the generic graph model (see IlvGraphModel
).
This abstract class defines the API that is necessary to allow the
graph layout algorithms to work. To use an external graph, all you
need to do is to implement an adapter that connects the graph with the
generic graph model. For details, see the class IlvGraphModel
.
The class IlvGraphLayout
is abstract and cannot be used
directly. You must use one of its concrete subclasses.
You can also create your own subclasses to implement other layout
algorithms. Note that, in order to be applied on any graph, the
layout algorithms must be written using the API of IlvGraphModel
instead of the API of IlvGrapher
.
The class contains layout parameters or options that can be useful for
different layout algorithms. The implementation of the #layout(boolean)
method is solely responsible for whether or not the
current settings of the parameters are taken into account.
Note that all layout parameters that are specific to nodes or links,
such as the "fixed" attribute (see #setFixed(Object, boolean)
,
#isFixed(Object)
), can be accessed only while the graph that
contains the nodes or links is attached to the layout instance. Also,
if the attached graph model is an IlvGrapherAdapter
, layout
parameters that are specific to nodes or links must be set after
specifying filtering rules (see IlvGrapherAdapter.addLayer(ilog.views.IlvManagerLayer)
,
IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)
).
If the documentation does not indicate a different coordinate space,
all dimensional parameters are expressed in the same coordinate space
as the position and dimension of the nodes and the link points. In
particular, when laying out an IlvGrapher
, the dimensional
parameters are expressed by default in the coordinate space of the
manager, not in the coordinate space of the view (IlvManagerView
). However, optionally, the coordinate space of the
view can be used. For details, see #setCoordinatesMode
.
If you want to perform the layout on a subset of the nodes and links
of and IlvGrapher
, you can use a filter (see the class IlvLayoutGraphicFilter
and the method IlvGrapherAdapter.setFilter(ilog.views.graphlayout.IlvLayoutGraphicFilter)
, or the method IlvGrapherAdapter.addLayer(ilog.views.IlvManagerLayer)
). The filter allows the layout algorithm
to determine, for each node and link of a graph, if it must be taken
into account or can be ignored.
If you want to perform the layout recursively over a nested graph
(for instance, an IlvGrapher
contained in another IlvGrapher
), you can use the method #performLayout(boolean,
boolean, boolean)
and pass true
for the
traverse
argument. Alternatively, you can use the method
#PerformLayout(IlvGraphModel, IlvLayoutProvider, boolean,
boolean, boolean)
.
To learn more about the layout algorithms and the corresponding
IlvGraphLayout
subclasses, read the sections of the
Reference Manual describing those classes and the JViews Graph Layout
User's Manual.
Note that when implementing a subclass of IlvGraphLayout
,
the initialization of all instance variables of the subclass needs to
be done in the overridden implementation of the method #init()
. This is to prevent execution of methods of the subclasses
before the initialization of the instance variables of the subclasses.
Note also that you must call the method #detach()
when you no
longer need the layout instance, otherwise some objects may not be
garbage collected. This is necessary only if the layout instance is
directly created by your code. Calling #detach()
is not
necessary if the layout instance is created internally by the JViews
Graph Layout library, when using an IlvDefaultLayoutProvider
for recursive layout.
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.