public class IlpGraphLayoutRenderer
extends ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
IlpNetworkView
.
This class is a CSS stylable Bean. It can be configured in two ways in a CSS file.
The first option is to create a simple configuration using a single node layout:
GraphLayout { class: 'ilog.views.graphlayout.uniformlengthedges.IlvUniformLengthEdgesLayout'; // Any properties configurable for given class. }
The value of the class
property should be the name of a
subclass of IlvGraphLayout
that has a public
no-argument constructor.
The allowed properties and their values depend on the class.
The second option allows you to specify multiple node layouts that
will be attached to the view. One of these layouts can be configured to
run automatically when the contents of the view changes. This configuration
is achieved using setLayouts(int, IlvGraphLayout)
and setAutoLayoutIndex(int)
or in CSS as illustrated below:
GraphLayout { layouts[0]: @+treeLayout; layouts[1]: @+hierarchicalLayout; autoLayoutIndex: 0; } Subobject#treeLayout { class: 'ilog.views.graphlayout.tree.IlvTreeLayout'; // Any properties configurable for given class. } Subobject#hierarchicalLayout { class: 'ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout'; // Any properties configurable for given class. }
The value of the class
property should be the name of a
subclass of IlvGraphLayout
that has a public
no-argument constructor.
The allowed properties and their values depend on the class.
The properties layouts
and autoLayoutIndex
can be set on a subgraph node.
This lets you use a different layout algorithm for each subgraph.
For example, the following rule says that subgraph identified as
SubNetwork1
must be laid out using an
IlvGridLayout
algorithm:
#SubNetwork1:graphLayoutRenderer { autoLayoutIndex: 0; layouts[0]: @+gridLayout; } Subobject#gridLayout { class: 'ilog.views.graphlayout.grid.IlvGridLayout'; // Any properties configurable for given class. }
When specifying the layouts for a given subnetwork, use the pseudoclass graphLayoutRenderer indicating that the properties refers to the graph layout renderer.
Rogue Wave JViews layout algorithms (that is, subclasses of
IlvGraphLayout
) provide many parameters
that control how a specific layout will be applied to a particular node
or link. Starting with JTGO 7.5, the graph layout renderer lets you
set these per-object parameters from the style sheet as in the following
examples:
object."ilog.tgo.model.IltObject":graphLayoutRenderer:tree { alignment : EAST; } #Node1:graphLayoutRenderer:tree { root: true; }
The first rule will cause the method
IlvTreeLayout.setAlignment(java.lang.Object, int)
to be called for all the nodes that match the rule.
The second rule will cause the method
IlvTreeLayout.setRoot(java.lang.Object)
to be called for object identified as Node1.
Per-object parameters can be configured for all graph layouts specified
for the Network view. The CSS selector used to configure these parameters
shall specify the pseudoclass graphLayoutRenderer and a pseudoclass
which identifies the graph layout class to which the parameters refer to,
for instance: bus, tree, hierarchical, topologicalmesh and so on.
Note: Starting with JTGO 7.5, if you are not using any node
or link parameters, you can disable this mechanism using
setUsePerObjectParameters(false)
.
This will remove the overhead of testing the parameters, which can speed up
the rendering process significantly.
Constructor and Description |
---|
IlpGraphLayoutRenderer() |
Modifier and Type | Method and Description |
---|---|
int |
getAutoLayoutIndex()
Return the index of the graph layout that shall be performed
automatically.
|
int |
getAutoLayoutIndex(IlpRepresentationObject ro)
Returns the index of the graph layout that will be applied
automatically for the given representation object.
|
IlvGraphLayout[] |
getLayouts()
Return the list of graph layouts.
|
IlvGraphLayout[] |
getLayouts(IlpRepresentationObject ro)
Return the layout that is associated with the given representation
object.
|
IlvGraphLayout |
getLayouts(int index)
Return the graph layout at the given index.
|
IlvGraphLayout |
getLayouts(int index,
IlpRepresentationObject ro)
Return the layout that is associated with the given representation
object and index
|
IlvGraphLayout |
getNodeLayout()
Returns the graph layout for nodes.
|
boolean |
isUsePerObjectParameters()
Returns
true if per-object layout parameters
are enabled (the default), or false otherwise. |
void |
setAutoLayoutIndex(IlpRepresentationObject ro,
int index)
Sets the index of the graph layout that will be applied
automatically for the given representation object.
|
void |
setAutoLayoutIndex(int index)
Set the index of the graph layout that shall be performed
automatically.
|
void |
setLayouts(IlpRepresentationObject ro,
IlvGraphLayout[] layouts)
Sets the graph layouts that are associated to the given
subnetwork representation object.
|
void |
setLayouts(IlpRepresentationObject ro,
int index,
IlvGraphLayout layout)
Sets the layout that is associated with the given representation
object and index.
|
void |
setLayouts(IlvGraphLayout[] l)
Set the current graph layouts.
|
void |
setLayouts(int index,
IlvGraphLayout l)
Set the graph layout at the given index.
|
void |
setNodeLayout(IlvGraphLayout layout)
Changes the node layout.
|
void |
setUsePerObjectParameters(boolean use)
Enables or disables per-object layout parameters.
|
apply, applyDeclarations, customizeContainerGraphic, customizeGraphic, getCSSID, reset
attach, detach, getLayoutParameters
getView, noteContainerAdded, noteContainerUpdated
public IlvGraphLayout[] getLayouts()
getLayouts
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
public void setLayouts(IlvGraphLayout[] l)
setLayouts
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
l
- Graph layoutspublic IlvGraphLayout getLayouts(int index)
getLayouts
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
index
- Layout indexnull
if there is no graph layout defined or if the index
is outside the bounds of the graph layout vector.public void setLayouts(int index, IlvGraphLayout l)
setLayouts
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
index
- Layout indexl
- Graph Layoutpublic int getAutoLayoutIndex()
Default value is 0.
getAutoLayoutIndex
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
public void setAutoLayoutIndex(int index)
setAutoLayoutIndex
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
index
- Layout indexpublic IlvGraphLayout getNodeLayout()
getNodeLayout
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
null
if none has been specified.public void setNodeLayout(IlvGraphLayout layout)
setNodeLayout
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
layout
- A graph layout or null
.public IlvGraphLayout[] getLayouts(IlpRepresentationObject ro)
getLayouts
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
ro
- Representation objectpublic void setLayouts(IlpRepresentationObject ro, IlvGraphLayout[] layouts)
setLayouts
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
ro
- Representation objectlayouts
- Graph layoutspublic IlvGraphLayout getLayouts(int index, IlpRepresentationObject ro)
getLayouts
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
index
- Layout indexro
- Representation objectpublic void setLayouts(IlpRepresentationObject ro, int index, IlvGraphLayout layout)
setLayouts
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
ro
- Representation objectindex
- Layout indexlayout
- Graph layoutpublic int getAutoLayoutIndex(IlpRepresentationObject ro)
getAutoLayoutIndex
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
ro
- Representation objectpublic void setAutoLayoutIndex(IlpRepresentationObject ro, int index)
setAutoLayoutIndex
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
ro
- Representation objectindex
- Layout indexpublic boolean isUsePerObjectParameters()
true
if per-object layout parameters
are enabled (the default), or false
otherwise.isUsePerObjectParameters
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
setUsePerObjectParameters(boolean)
public void setUsePerObjectParameters(boolean use)
This method can be used to disable or re-enable the mechanism that sets per-node or per-link parameters, as explained in the class description.
By default, per-object parameters are enabled. You can disable them if you are sure that your style sheet does not use any per-object layout parameters. Disabling per-object parameters speeds up the rendering process.
setUsePerObjectParameters
in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
use
- If this parameter is true
, per-object
layout parameters can be set in the style sheet, as explained
in the class description. If this parameter is false
,
per-object layout parameters are ignored.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.