The IlvGrapherAdapter class is a concrete
subclass of
IlvGraphModel
that allows an
IlvGrapher
to be laid out using the layout algorithms provided in Rogue Wave®
JViews Diagrammer. It
provides an implementation for all the abstract methods of IlvGraphModel. It also provides an overridden
implementation of some nonabstract methods of
IlvGraphModel
to improve efficiency by taking advantage of the characteristics of
the IlvGrapher.
If an application uses the
IlvGrapher
class, the grapher can be attached directly to the layout instance
without explicitly using the adapter, see the method attach. In this case, an
IlvGrapherAdapter
is created internally by the layout class. The adapter can be
retrieved using the method getGraphModel, which will return an instance
of
IlvGrapherAdapter
.
Notice that such an internally created adapter is not allowed to be
attached to any other layout instance, nor to be used in any way
once the method detach
IlvGraphLayout.detach()
has been called on the layout instance.
In case you need to be able to do any of the above operations,
directly create the instance of
IlvGrapherAdapter
and attach it using attach).
To know whether a specific
IlvGraphModel
instance has been created using attach), you can use the method getOriginatingLayout. This method returns a
non-
null
object if the model has not been created using
IlvGraphLayout.attach(IlvGrapher)
.
Additionally, the
IlvGrapherAdapter
class provides a way to filter the
IlvGrapher
. By using the filtering mechanism, you specify a particular set of
nodes and links that have to be taken into account by the layout
algorithm, see Using filtering to lay out a part of an
IlvGrapher.
The
IlvGrapherAdapter
class allows you to specify the order of nodes returned by the
methods getNodes
IlvGrapherAdapter.getNodes()
and getNodesAndLinks. For this purpose you can
provide your own implementation of a
java.util.Comparator
that defines the order of the nodes. Then specify this comparator
by using the method setNodeComparator.
The
IlvGrapherAdapter
class also allows you to specify the IlvTransformer that has to be used for
computing the geometry of the graph, see Choosing the layout coordinate space.
Note
For details on how to write your own adapter, see Laying out a non-JViews grapher.