ilog.cpl.equipment.renderer
Class IlpGraphLayoutRenderer

java.lang.Object
  extended by ilog.cpl.graphic.css.renderer.IlpAbstractGraphicViewRenderer
      extended by ilog.cpl.graph.css.renderer.IlpAbstractRepresentationViewRenderer
          extended by ilog.cpl.graph.css.renderer.IlpLayoutRenderer
              extended by ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
                  extended by ilog.cpl.equipment.renderer.IlpGraphLayoutRenderer

public class IlpGraphLayoutRenderer
extends ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer

This class gives control over the node layout of an IlpEquipmentView.

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.grid.IlvGridLayout';
   // 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.

Specifying a Different Layout for Each Subgraph

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.

Per-Object Parameters

ILOG 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 ILOG 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.

Since:
JTGO 4.0
See Also:
IlpEquipmentView

Field Summary
 
Fields inherited from class ilog.cpl.graph.css.renderer.IlpLayoutRenderer
rendererPseudoClass
 
Constructor Summary
IlpGraphLayoutRenderer()
           
 
Method Summary
 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.
 
Methods inherited from class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
apply, applyDeclarations, customizeContainerGraphic, customizeGraphic, getCSSID, reset
 
Methods inherited from class ilog.cpl.graph.css.renderer.IlpLayoutRenderer
attach, detach, getLayoutParameters
 
Methods inherited from class ilog.cpl.graph.css.renderer.IlpAbstractRepresentationViewRenderer
getView, noteContainerAdded, noteContainerUpdated
 
Methods inherited from class ilog.cpl.graphic.css.renderer.IlpAbstractGraphicViewRenderer
getContext, getGraphicView, isRendererEnabled, setRendererEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpGraphLayoutRenderer

public IlpGraphLayoutRenderer()
Method Detail

getLayouts

public IlvGraphLayout[] getLayouts()
Return the list of graph layouts.

Overrides:
getLayouts in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Returns:
Graph layouts
Since:
JViews 7.5

setLayouts

public void setLayouts(IlvGraphLayout[] l)
Set the current graph layouts.

Overrides:
setLayouts in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
l - Graph layouts
Since:
JViews 7.5

getLayouts

public IlvGraphLayout getLayouts(int index)
Return the graph layout at the given index.

Overrides:
getLayouts in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
index - Layout index
Returns:
Graph layout at the given index or null if there is no graph layout defined or if the index is outside the bounds of the graph layout vector.
Since:
JViews 7.5

setLayouts

public void setLayouts(int index,
                       IlvGraphLayout l)
Set the graph layout at the given index.

Overrides:
setLayouts in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
index - Layout index
l - Graph Layout
Since:
JViews 7.5

getAutoLayoutIndex

public int getAutoLayoutIndex()
Return the index of the graph layout that shall be performed automatically.

Default value is 0.

Overrides:
getAutoLayoutIndex in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Returns:
Layout index
Since:
JViews 7.5

setAutoLayoutIndex

public void setAutoLayoutIndex(int index)
Set the index of the graph layout that shall be performed automatically.

Overrides:
setAutoLayoutIndex in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
index - Layout index
Since:
JViews 7.5

getNodeLayout

public IlvGraphLayout getNodeLayout()
Returns the graph layout for nodes.

Overrides:
getNodeLayout in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Returns:
A graph layout or null.

setNodeLayout

public void setNodeLayout(IlvGraphLayout layout)
Changes the node layout.

Overrides:
setNodeLayout in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
layout - A graph layout or null.

getLayouts

public IlvGraphLayout[] getLayouts(IlpRepresentationObject ro)
Return the layout that is associated with the given representation object.

Overrides:
getLayouts in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
ro - Representation object
Returns:
The graph layouts that have been configured for the given representation object.
Since:
JViews 7.5

setLayouts

public void setLayouts(IlpRepresentationObject ro,
                       IlvGraphLayout[] layouts)
Sets the graph layouts that are associated to the given subnetwork representation object.

Overrides:
setLayouts in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
ro - Representation object
layouts - Graph layouts
Since:
JViews 7.5

getLayouts

public IlvGraphLayout getLayouts(int index,
                                 IlpRepresentationObject ro)
Return the layout that is associated with the given representation object and index

Overrides:
getLayouts in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
index - Layout index
ro - Representation object
Returns:
The graph layouts that have been configured for the given representation object.
Since:
JViews 7.5

setLayouts

public void setLayouts(IlpRepresentationObject ro,
                       int index,
                       IlvGraphLayout layout)
Sets the layout that is associated with the given representation object and index.

Overrides:
setLayouts in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
ro - Representation object
index - Layout index
layout - Graph layout
Since:
JViews 7.5

getAutoLayoutIndex

public int getAutoLayoutIndex(IlpRepresentationObject ro)
Returns the index of the graph layout that will be applied automatically for the given representation object.

Overrides:
getAutoLayoutIndex in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
ro - Representation object
Returns:
Index of the graph layout, if there is one configured, or 0.
Since:
JViews 7.5

setAutoLayoutIndex

public void setAutoLayoutIndex(IlpRepresentationObject ro,
                               int index)
Sets the index of the graph layout that will be applied automatically for the given representation object.

Overrides:
setAutoLayoutIndex in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
ro - Representation object
index - Layout index
Since:
JViews 7.5

isUsePerObjectParameters

public boolean isUsePerObjectParameters()
Returns true if per-object layout parameters are enabled (the default), or false otherwise.

Overrides:
isUsePerObjectParameters in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Since:
JViews 7.5
See Also:
setUsePerObjectParameters(boolean)

setUsePerObjectParameters

public void setUsePerObjectParameters(boolean use)
Enables or disables per-object layout parameters.

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.

Overrides:
setUsePerObjectParameters in class ilog.cpl.graph.css.renderer.IlpGraphLayoutRenderer
Parameters:
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.
Since:
JViews 7.5


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.