Graphic Components > Equipment Component > Configuring the Equipment Component > Configuring an Equipment Component through CSS

You can customize the following features in a CSS file:

How to Load a CSS File in an Equipment Component

The equipment configuration can be split across several CSS files. The method IlpEquipment.setStyleSheets accepts several CSS filenames.

There are three ways to apply a CSS configuration to an equipment component, depending on whether you have one or several configuration files:

equipmentComponent = new IlpEquipment(myConfigurationFile);
If no CSS file is specified, the equipment component uses the default configuration, that is, ilog.cpl.equipment.defaultConfiguration.css from the jviews-tgo-all.jar file.
<?xml version="1.0"?>
<tgo xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "ilog/cpl/schema/project.xsd" style="configurationFile1.css,configurationFile2.css">
  <datasource javaClass="ilog.tgo.datasource.IltDefaultDataSource" fileName="equipment.xml"/>
</tgo>
If the settings in two of the CSS files disagree, the effect depends on the order of the filenames in the list: the last file mentioned takes precedence over the first file.
equipmentComponent = new IlpEquipment();
equipmentComponent.setStyleSheets(
  new String[] { myConfigurationFile1, myConfigurationFile2 });
or, if you want to inherit and extend the settings from the default configuration file, use setStyleSheets as follows:
equipmentComponent = new IlpEquipment();
equipmentComponent.setStyleSheets(
  new String[] {
    IlpEquipment.DefaultConfigurationFileName,
    myExtraConfigurationFile
  });
If the settings in two of the CSS files disagree, the effect depends on the order of the filenames in the list: the last file mentioned takes precedence over the first file.
How to Configure an Equipment Component in a CSS File

The following code represents an example of configuring an equipment component in CSS. It is based on the CSS files located in

<installdir>/samples/equipment/styling

where <installdir> is the directory where you have installed JViews TGO.

The configuration in CSS is organized as a set of rules that define properties.

Equipment {
  toolbar: true;
  overview: true;
  interactor: true;
  zooming: true;
  graphLayout: true;
  backgrounds: true;
  positioning: true;
}
 
ToolBar {
  enabled: true;
  button[0]: @+SelectButton;
  button[1]: @+ZoomResetButton;
}
 
Subobject#SelectButton {
  actionType: "Select";
  usingObjectInteractor: true;
  opaqueMove: true;
}
 
Subobject#ZoomResetButton {
  actionType: "ZoomReset";
}
 
Overview {
  enabled: true;
}
 
Interactor {
  name: "Select";
}
 
Zooming {
  type: "Mixed";
  zoomThreshold: 2.0;
}
 
GraphLayout {
  class: "ilog.views.graphlayout.grid.IlvGridLayout";
}
 
Backgrounds {
  background[0]: "data/images/europe.jpg";
}
 
Positioning {
  positionClass: "ilog.cpl.graphic.IlpPosition";
  converterClass: "ilog.cpl.network.IlpDefaultPositionConverter";
}

The Equipment Rule

This rule specifies Boolean flags that indicate whether each customizable property is present. For example, customization of the property GraphLayout is not taken into account unless graphlayout: true; is declared in the Equipment rule.

This feature provides powerful cascading possibilities of CSS files. Thus, you can define GraphLayout customizations in a default CSS file and then turn them on or off in another CSS file.

The following properties are supported in the Equipment rule. You will find detailed documentation for each of these properties in the ILOG JViews TGO Java API Reference Documentation, package ilog.cpl.equipment.renderer.

Table 3.1 CSS Properties of the Equipment View
Property 
Rule Type 
adapter 
Adapter 
toolbar 
ToolBar 
view 
View 
overview 
Overview 
interactor 
Interactor 
zooming 
Zooming 
graphLayout 
GraphLayout 
labelLayout 
LabelLayout 
backgrounds 
Backgrounds 
positioning 
Positioning 

The ToolBar Rule

This rule controls the toolbar.

The property enabled is a Boolean property, with default value true. It controls whether the toolbar is visible or not.

The property external is a Boolean property, with default value false. It specifies whether the placement and visibility of the toolbar are managed by user code instead of internally by the equipment component.

Buttons can be added through the syntax button[i]: @+ButtonId; followed by the customization setting of the button with the given ButtonId.

A button has a mandatory property, actionType. This property specifies the action triggered by the button or a separator that is added to the toolbar. The value can be:

How to Add a Toolbar Separator for the Equipment Component

You can add toolbar separators in specified positions of the equipment component toolbar. When configuring the equipment component toolbar, you can specify the position where a separator should be placed by using the predefined button action called Separator. This button action supports an optional property, dimension, which allows you to specify the dimensions of the separator in the toolbar.

The following example shows how to achieve this result:

ToolBar {
  enabled: true;
  button[0]: @+SelectButton;
  button[1]: @+Separator;
  button[2]: @+PanButton;
}
Subobject#Separator {
  actionType: "Separator";
  dimension: "20,10";
}

The predefined values for the actionType property are the following:

Table 3.2 Predefined Values of the actionType Property 
actionType Values 
Bean Class 
Description 
ZoomIn 
Allows you to zoom in the view 
ZoomOut 
Allows you to zoom out of the view 
ZoomBack 
Allows you to go back to the previous zoom level 
ZoomReset 
Allows you to reset the zoom level to the original level 
ZoomView 
Allows you to specify a rectangular area on which to zoom 
FitToContents 
Allows you to fit the contents of the view to the size of the view 
ScrollToContents 
Allows you to recenter the view 
Pan 
Allows you to pan the view 
Select 
Allows you to select and move objects 
MakeLink 
Allows you to create links 
MakeLinearGroup 
Allows you to create linear groups 
MakePolyGroup 
Allows you to create polygonal groups 
MakeRectGroup 
Allows you to create rectangular groups 
EditGroup 
Allows you to edit the shape of groups 
EditLabel 
Allows you to edit labels 
EditObject 
Allows you to edit equipment objects 
LabelLayout 
Allows you to trigger the label layout 

A button can have a property permanent. This is a Boolean property, with default value true. For interactor buttons, this property denotes whether the interactor remains attached after it has performed its action.

A button can have a property name. This property specifies the name by which other elements in the file refer to the button. The default name is the short name used as actionType.

A button can have additional properties, corresponding to Bean properties of the Java class. For example, the Select button has the properties multipleSelectionMode, moveAllowed, dragAllowed, editingAllowed, moveThreshold, opaqueMove, showingMovingObject, opaqueDragSelection, opaqueResize, opaquePolyPointsEdition, multipleSelectionModifier, selectionModifier, which are documented in the class ilog.cpl.equipment.action.toolbar.IlpEquipmentSelectButton.

An interactor button can have key or gesture actions attached to it. These actions are triggered by specific keystrokes or gestures while the interactor is active. These actions are added through the syntax action[i]: @+ActionId; followed by a customization setting for the action.

An action customization has the mandatory property class which specifies the Java class name of the javax.swing.Action object. Bean properties of this class are also customizable. Furthermore, the properties key and gesture can be set to specify when the action is to be executed. Please note that these two properties are not used in combination. For example, if you specify:

key: "control A";
gesture: "BUTTON1_CLICKED";

the action will be executed either when the key sequence `control-A' is typed, or when the mouse BUTTON1 is clicked. To define the property "gesture", specify one of the predefined user gestures defined in class IlpGesture. To define the property "key", specify a string that will be converted to a keystroke by the type converter (IlpTypeConverter).

Please note that the following predefined actions are available:

An interactor can have a pop-up menu factory associated with it. This factory can be specified using the Bean property popupMenuFactory. Its value should be an indirect reference (through @+ or @#) to a property class or to other Bean properties. For example,

Subobject#SelectButton {
    actionType: "Select";
    popupMenuFactory: @+popupMenuFactory;
  }
 
Subobject#popupMenuFactory {
    class: 'CustomPopupMenuFactory';
  }

In this example, the value of the property "popupMenuFactory" is a bean that is defined by the class CustomPopupMenuFactory. This class should implement the interface IlpPopupMenuFactory.

Please refer to the class IlpToolBarRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring the toolbar in an equipment view.

How to Add a Predefined Toolbar Button to the Equipment Component

JViews TGO provides a list of predefined toolbar buttons usable in the equipment component (see Table 3.2, Predefined Values of the actionType Property).

The following example shows how to add a predefined button that enables the select interactor. When this interactor is enabled, you can customize actions, pop-up menus and interactor properties as illustrated here:

ToolBar {
  enabled: true;
  button[0]: @+SelectButton;
}
 
Subobject#SelectButton {
  actionType: "Select";
  usingObjectInteractor: true;
  opaqueMove: true;
  action[0]: @+action0;
  popupMenuFactory: @+popupMenuFactory;
}
 
Subobject#popupMenuFactory {
  class: 'CustomPopupMenuFactory';
}
 
Subobject#action0 {
  key: "control A";
  class: 'ilog.cpl.graph.action.IlpSelectAllObjectsAction';
}
How to Add a Custom Toolbar Button to the Equipment Component

To add your own toolbar button, you need to create a new action class that inherits from IlpEquipmentInteractorAction and contains a constructor that takes an IlpViewsView as parameter.

public class CustomButtonAction extends IlpEquipmentInteractorAction {
 
  public CustomButtonAction(IlpViewsView view) {
     super(view);
     // Do any needed initialization
     // Define your own view interactor that will be active when the button is selected
     // in the toolbar
     IlpViewsViewInteractor interactor =  new IlpViewsViewInteractor();
     // Register the interactor in this action
     setIlpInteractor(interactor);
  }
}

Then, you need to register this new button in your component configuration, as follows:

ToolBar {
  enabled: true;
  button[0]: @+MyButton;
}
 
Subobject#MyButton {
  actionType: 'CustomButtonAction';
  toolTipText: "Custom";
  icon: @+customIcon;
}
Subobject#customIcon {
  class: 'javax.swing.ImageIcon';
  image: '@|image("custom.png")';
}

The custom action will be encapsulated in an IlpEquipmentInteractorButton, and you will be able to customize the properties of this button as with the predefined buttons. For example, you can customize the following:

The View Rule

This rule controls the view.

You can customize the following properties of the view:

Table 3.3 View Properties
Property Name 
Type 
Default Value 
Description 
horizontalScrollBarPolicy 
int  
IlvJScrollManagerView.HORIZONTAL_SCROLLBAR_AS_NEEDED  
Defines the policy for the visibility of the horizontal scrollbar 
verticalScrollBarPolicy 
int 
IlvJScrollManagerView.VERTICAL_SCROLLBAR_AS_NEEDED  
Defines the policy for the visibility of the vertical scrollbar  
keepingAspectRatio 
boolean 
false  
Defines whether the view keeps the aspect ratio when zooming  
minZoomXFactor 
double  
0  
Specifies the minimum zoom factor allowed on the X (horizontal) axis of the view 
maxZoomXFactor 
double 
Double.MAX_VALUE 
Specifies the maximum zoom factor allowed on the X (horizontal) axis of the view 
minZoomYFactor 
double 
0  
Specifies the minimum zoom factor allowed on the Y (vertical) axis of the view  
maxZoomYFactor 
double 
Double.MAX_VALUE 
Specifies the maximum zoom factor allowed on the Y (vertical) axis of the view 
wheelZoomingEnabled 
boolean 
true 
Defines whether the view zooms in response to moving the mouse wheel while pressing the Control key 
wheelScrollingEnabled 
boolean 
true 
Defines whether the view scrolls in response to moving the mouse wheel 

The following CSS sample shows how to customize the view:

View {
  horizontalScrollBarPolicy: AsNeeded;
  verticalScrollBarPolicy: Never;
  keepingAspectRatio: true;
}

Please refer to the class IlpViewRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring an equipment view.

The Overview Rule

This rule controls the overview window.

The property overviewVisible controls the visibility of the overview window. The default value is false.

The following CSS sample shows how to customize the overview:

Overview {
  overviewVisible: true;
}

Please refer to the class IlpOverviewRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring the overview window in an equipment view.

The Interactor Rule

This rule controls the interactor associated with the view.

You can customize the following properties of the interactor:

Table 3.4 Interactor Properties
Property Name 
Type 
Default Value 
Description 
name 
String  
none 
Specifies the name of a toolbar button that activates an interactor. This button is activated at startup. Its interactor becomes the initial view interactor, as well as the default view interactor when another interactor stops its interaction. This property is only considered when the view has a toolbar configured and enabled. 
viewInteractor 
IlpViewsViewInteractor 
none 
Specifies the interactor instance that becomes the initial view interactor, and the default view interactor when another interactor stops its interaction. 

How to Configure an Equipment Interactor in a CSS File

Prior to configuring the equipment view interactor, you need to configure the equipment component so that the interactor configuration is enabled:

Equipment {
  interactor: true;
}

After that, you can customize the interactor property in the Interactor rule as illustrated by the next code extract. Refer to The CSS Specification in the Styling documentation for details about the CSS syntax.

How to Set the Default View Interactor from the Toolbar of the Equipment Component

You can customize the default view interactor to be one of the interactors present in the toolbar configured for the equipment component. In this case, the toolbar button is identified when the equipment component is configured, and it is activated at startup. This interactor becomes the initial view interactor, and the default view interactor when another interactor stops its interaction. This configuration is achieved through the property name, whose value must be the name of one of the configured toolbar buttons.

The following CSS extract configures the equipment view to use the Select toolbar button as the default view interactor:

Interactor {
  name: "Select";
}
How to Set the Default View Interactor when the Toolbar is Disabled in the Equipment View

When the toolbar is disabled, you can no longer specify the default view interactor by using a toolbar button name, as in the example above. However, you can specify the view interactor directly in CSS, as follows:

Interactor {
  viewInteractor: @+viewInt;
}
 
Subobject#viewInt {
  class: 'ilog.cpl.graphic.views.IlpViewsViewInteractor';
}

The behavior of the view interactor is determined by the actions that are associated with user gestures and keystrokes. This behavior can also be customized through CSS. You can also configure a pop-up menu to be displayed in the equipment view. Please refer to Interacting with the Equipment View and Interacting with the Equipment Objects for more information about interactor customization.

When the interactor renderer is enabled, you can also customize interactors for objects displayed in the equipment component. The property in the object selector will only be considered if the interactor renderer is enabled.

Please refer to the class IlpInteractorRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring the default view interactor in an equipment view.

The Zooming Rule

This rule controls the zoom policy.

The mandatory property type specifies the type of zoom. The possible values are Logical, Physical, or Mixed. Each zoom policy may have additional properties that you can also set using CSS:

How to Customize the Zoom Policy in an Equipment Component

The following CSS sample shows how to customize the zoom policy in an equipment view:

Zooming {
  type: "Mixed";
  zoomThreshold: 1.0;
  subNetworkZoomFactor: 1.0;
}

Please refer to the class IlpZoomingRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring the zoom behavior in an equipment view.

How to Configure the Visibility of Decorations for a Specific Equipment Component

JViews TGO provides three predefined zoom policies that you can use directly in the equipment component (see Zooming for more information). When using the physical or the mixed zoom policy, decorations may become invisible as the user zooms out in the view. By default, this configuration is global in the application and can be customized using visibility thresholds. However, you may need to specify the visibility threshold for a specific view. This feature is supported by properties decorationNames and visibilityThresholds. Property decorationNames specifies each decoration that is configured for the view (see ilog.tgo.graphic.IltGraphicElementName for the list of decoration names that can be customized). Property visibilityThresholds specifies, for each decoration name, the visibility threshold below which the decoration becomes invisible. This configuration is illustrated by the following example:

Zooming {
  type: "Mixed";
  decorationNames[0]: Name;
  decorationNames[1]: AlarmBalloon;
  decorationNames[2]: AlarmCount;
  decorationNames[3]: Plinth;
  visibilityThresholds[0]: 0.5;
  visibilityThresholds[1]: 0.8;
  visibilityThresholds[2]: 0.5;
  visibilityThresholds[3]: 0.5;
}

The GraphLayout Rule

This rule allows you to control the automatic node layout in the view and to configure nonautomatic node layouts. Nonautomatic node layouts can only be executed through the API (see Layout for more details).

How to Control the Automatic Node Layout in the Equipment View

Automatic node layout is configured through the property class. This property specifies the graph layout class, a subclass of IlvGraphLayout. Additional Bean properties can be specified, depending on the class.

The following CSS sample shows how to customize the graph layout:

GraphLayout {
    class:      'ilog.views.graphlayout.uniformlengthedges.IlvUniformLengthEdgesLayout';
    respectNodeSizes: true;
    preferredLinksLength: 200;
    forceFitToLayoutRegion: true;
    layoutRegion: "50, 50, 700, 450";
}

The graph layout is always a subclass of IlvGraphLayout which supports the "preserveFixedNodes" property. This property allows you to switch the support of fixed nodes on or off. You can set a node as fixed in the business object customization.

Note
If a graph layout is set and supports fixed nodes, a link layout is required when links are connected to the fixed nodes.

The properties of each layout algorithm are fully explained in the ILOG JViews Diagrammer Using Graph Layout Algorithms documentation.

The properties of the IlvGraphLayout subclasses conform to the following JavaBeans convention: if a class has a pair of methods called setMyProp (with a single parameter) and getMyProp (without parameters), then you can set the property myProp in the style sheet.

Note
If the value of the property is an enumeration of integer values defined by static member variables of the class, then you can use the name of the variable alone, or the variable name prefixed by the class name alone, or the variable name prefixed by the fully qualified class name. For example, the following declarations are all valid:

globalLinkStyle: "ORTHOGONAL_LINKS";

globalLinkStyle: "IlvHierarchicalLayout.ORTHOGONAL_LINKS";

globalLinkStyle: "ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout.ORTHOGONAL_LINKS";

How to Configure Multiple Node Layouts in an Equipment View

The Graph Layout rule allows you to configure multiple node layouts, and to define the node layout to be used automatically in the view. Multiple node layout configuration is achieved through the properties layouts and autoLayoutIndex, as illustrated below:

GraphLayout { 
  layouts[0]: @+treeLayout;
  layouts[1]: @+hierarchicalLayout;
  layouts[2]: @+springEmbedderLayout;
  autoLayoutIndex: 1;
}
 
Subobject#treeLayout {
  class: 'ilog.views.graphlayout.tree.IlvTreeLayout';
  flowDirection: Bottom;
}
 
Subobject#hierarchicalLayout {
  class: 'ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout';
  flowDirection: Bottom;
}
 
Subobject#springEmbedderLayout {
  class: 'ilog.views.graphlayout.springembedder.IlvSpringEmbedderLayout';
  respectNodeSizes: true;
  preferredLinksLength: 200;
  forceFitToLayoutRegion: true;
  layoutRegion: "50, 50, 700, 450";
}

In this use case, three node layouts are configured for the view: IlvTreeLayout, IlvHierarchicalLayout and IlvSpringEmbedderLayout. The hierarchical layout is configured to be performed automatically when the contents of the view changes. This configuration is achieved by specifying the value of property autoLayoutIndex as the index of the hierarchical layout defined through the layouts property. The other node layouts can be performed on demand using the API (see IlpGraphView.performAttachedLayout).

How to Configure Nonautomatic Node Layouts in the Equipment Component

If you are not interested in automatic node layout, you can still configure multiple node layouts in CSS. To have only nonautomatic node layouts, set property autoLayoutIndex to -1, as illustrated below:

GraphLayout { 
  layouts[0]: @+treeLayout;
  layouts[1]: @+hierarchicalLayout;
  layouts[2]: @+springEmbedderLayout;
  autoLayoutIndex: -1;
}
 
Subobject#treeLayout {
  class: 'ilog.views.graphlayout.tree.IlvTreeLayout';
  flowDirection: Bottom;
}
 
Subobject#hierarchicalLayout {
  class: 'ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout';
  flowDirection: Bottom;
}
 
Subobject#springEmbedderLayout {
  class: 'ilog.views.graphlayout.springembedder.IlvSpringEmbedderLayout';
  respectNodeSizes: true;
  preferredLinksLength: 200;
  forceFitToLayoutRegion: true;
  layoutRegion: "50, 50, 700, 450";
}
How to Set Node or Link Parameters on Graph Layout Objects in the Equipment Component

You can set parameters for a graph layout algorithm that applies to a particular node or link, in the style sheet. Such parameters are defined by a method of the form:

setMyParam(Object node,  value);

or

setMyParam(Object link,  value); 

Node parameters are set in the style sheet as follows:

object."ilog.tgo.model.IltObject":graphLayoutRenderer {
  myParam: "value";
}

The name of the property is the name of the method, without the prefix set. The pseudoclass graphLayoutRenderer indicates that the declarations apply to the node layouts that are configured in the graph layout rule.

For example, the graph layout defines a setFixed method that lets you specify whether a node or link is fixed. Fixed nodes or links are not moved when the layout is applied. The signature of the method is:

setFixed(Object nodeOrLink, boolean fixed);

In the style sheet, you can set this parameter as follows:

object."ilog.tgo.model.IltObject":graphLayoutRenderer {
  fixed: true;
}

The value of the property can be any basic type (integer, String, float), or it can be the name of a public constant defined by the graph layout class, for example, WEST , which is defined in the class IlvHierarchicalLayout.

When the graph layout rule contains multiple node layouts, you can still specify node and link layout parameters by using pseudoclasses that identify the graph layout to which the declarations apply.

GraphLayout {
  layouts[0]: @+treeLayout;
  layouts[1]: @+hierarchical;
  autoLayoutIndex: 0;
}
 
Subobject#treeLayout {
  class: 'ilog.views.graphlayout.tree.IlvTreeLayout';
  flowDirection: Bottom;
}
 
Subobject#hierarchicalLayout {
  class: 'ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout';
  flowDirection: Top;
}
 
#NE1:graphLayoutRenderer:tree {
  root: true;
}
 
#NE1:graphLayoutRenderer:hierarchical {
  specNodeLevelIndex: 0;
}
 
#NE2:graphLayoutRenderer:hierarchical {
  specNodeLevelIndex: 1;
}

In the example above, NE1 is configured as the root object for the Tree Layout algorithm. This is achieved by declaring the property root in a selector that contains the pseudoclasses graphLayoutRenderer (indicates that this is a graph layout renderer per-object property) and tree (indicates that this is a property specific to the IlvTreeLayout algorithm).

At the same time, NE1 is configured to be placed at level 0 in case of a hierarchical layout. This is achieved using pseudoclasses graphLayoutRenderer and hierarchical (indicates that this is a graph layout per-object property specific to the IlvHierarchicalLayout algorithm).

Each layout algorithm supports a set of per-object parameters. Please refer to package ilog.cpl.graph.css.renderer.graphlayout for more information on the parameters supported by each layout algorithm.

In addition to the properties that are specific to the layout algorithms, the graph layout renderer also supports the following properties:

GraphLayout {
  layouts[0]: @+hierarchicalLayout;
}
 
Subobject#hierarchicalLayout {
  class: 'ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout';
  incrementalMode: true;
}
 
#NE1:graphLayoutRenderer:hierarchical {
  markedForIncremental : "true";
}

Important
Starting with JViews TGO 7.5, if you are not using any node or link parameters, you can disable this mechanism by specifying IlpGraphLayoutRenderer.setUsePerObjectParameters(false). This will remove the overhead of testing the parameters and speed up the rendering process significantly.

How to Disable the Per-Object Layout Parameters for Node Configuration in the Equipment View

You can also disable the per-object layout parameters configuration through CSS as follows:

GraphLayout {
  layouts[0]: @+hierarchicalLayout;
  usePerObjectParameters: false;
}

Please refer to the class IlpGraphLayoutRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring the node layout in an equipment view.

The LinkLayout Rule

This rule controls the automatic link layout in the view.

The mandatory property class specifies the link layout class, a subclass of IlvGraphLayout. Additional Bean properties can be specified, depending on the class.

How to Control the Automatic Link Layout in the Equipment View

The following CSS sample shows how to customize the link layout:

LinkLayout {
    class: "ilog.tgo.graphic.graphlayout.IltShortLinkLayout";
    globalLinkStyle: MIXED_STYLE;
}

The link layout is always a subclass of IlvGraphLayout which supports the "preserveFixedLinks" property. This property allows you to switch the support of fixed links on or off.

Like the graph layout renderer, the link layout renderer supports setting per-object link layout parameters through CSS. See How to Set Node or Link Parameters on Graph Layout Objects in the Equipment Component.

How to Specify Per-Object Parameters for Link Layouts in the Equipment View

Link parameters are set in the style sheet as follows:

object."ilog.tgo.model.IltAbstractLink":linkLayoutRenderer {
  linkStyle: ORTHOGONAL_STYLE;
}
 
#Link1:linkLayoutRenderer {
  linkStyle: DIRECT_STYLE;
}

Important
Starting with JViews TGO 7.5, if you are not using any node or link parameters, you can disable this mechanism by specifying IlpLinkLayoutRenderer.setUsePerObjectParameters(false). This will remove the overhead of testing the parameters and speed up the rendering process significantly.

How to Disable Per-Object Layout Parameters for Link Configuration in the Equipment View

You can also disable the per-object layout parameters configuration through CSS as follows:

LinkLayout {
  class: 'ilog.views.graphlayout.link.IlvLinkLayout';
  usePerObjectParameters: false;
}

Please refer to the class IlpLinkLayoutRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring the link layout in an equipment view.

The LabelLayout Rule

This rule controls the automatic label layout in the view.

The mandatory property class specifies the label layout class, a subclass of IlvLabelLayout. Additional Bean properties can be specified, depending on the class. The usual setting is ilog.tgo.graphic.graphlayout.labellayout.IltAnnealingLabelLayout.

The following CSS sample shows how to customize the label layout:

LabelLayout {
    class: 'ilog.tgo.graphic.graphlayout.labellayout.IltAnnealingLabelLayout';
    obstacleOffset: 10;
    labelOffset: 15;
}

Note that some properties can be set within the IltAnnealingLabelLayout and some within the IlvAnnealingLabelLayout. Please refer to the ILOG JViews TGO Java API Reference Documentation for more details.

Please refer to the class IlpLabelLayoutRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring the label layout in an equipment view.

The Backgrounds Rule

This rule allows you to configure two kinds of background that affect the equipment component representation:

Equipment Backgrounds

This refers to background files such as maps or background images. You can specify an equipment background through:

  1. A URL
  2. The background file is specified directly by its URL:
Backgrounds {
  background[i]: "URL"; 
}
For example:
Backgrounds {
  background[0]: "backgrounds/sf-bayarea.png"; 
}
  1. A CSS bean
  2. The background URL and its properties are specified through a CSS bean:
Backgrounds {
  background[i]: @+background0;
}
 
Subobject#background0 {
  class: "ilog.cpl.graph.background.css.IlpBackgroundCSSConfiguration";
 
  PROPERTY :  PROPERTY_VALUE;
  ...  
}
The bean IlpBackgroundCSSConfiguration encapsulates all the properties supported by the predefined background types. You should use it if want to use one of the predefined types.
For example:
Backgrounds {
  background[0]: @+background0;
}
 
Subobject#background0 {
  class: "ilog.cpl.graph.background.css.IlpBackgroundCSSConfiguration";
 
  //////////////////////
  //Background properties 
  //////////////////////
  url : "backgrounds/sf-bayarea.png";
  loadOnDemand : "true";
  threaded : "false";
}
If you intend to use a custom background type that has additional properties, you can either subclass the default IlpBackgroundCSSConfiguration and use it with the additional bean properties. Or you can provide a bean that contains all the required properties to configure the IlpBackground implementation. All bean properties are automatically communicated and stored in the IlpBackground implementation through its IlpBackground.setProperty interface method.
For details on the properties available and supported for each IlpBackground implementation, see Background Support.

You can mix and match options 1 and 2 by specifying some backgrounds as beans and some as straight URL strings.

In the case of the Image Tile background type (IlpImageTileBackground), only the url property can be configured through CSS. For the other properties, use the XML configuration. See Background Support.

Manager View Background

This refers to the representation of the view as a background for your equipment backgrounds (the area that the equipment backgrounds do not cover).

You can configure the manager view background as follows:

Backgrounds {
  PROPERTY : PROPERTY_VALUE; 
}

For example:

Backgrounds {
  backgroundColor : "white"; 
}

The following table lists the properties that allow you to customize the manager view background:

Table 3.8 Properties of the View Background
Property Name 
Type 
Default 
Sample 
Description 
backgroundColor 
Color 
null 
backgroundColor:"black"; 
Specifies the color to be used to fill the background of the view. 
backgroundPattern 
String 
null 
backgroundPattern:"pattern.png"; 
Specifies the location of the pattern image to be used to fill the background of the view. 

Please refer to the class ilog.cpl.equipment.renderer.IlpBackgroundsRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring the background in an equipment view.

The Positioning Rule

This rule controls the type and converter of the user-defined IlpPosition.

The property positionClass denotes the Java class name of the class or interface that implements IlpPosition.

The property converterClass denotes a Java class name or CSS bean that implements the ilog.cpl.graphic.IlpPositionConverter interface and determines the conversion between business data coordinates and (x,y) coordinates in the view.

The following CSS sample shows how to customize the positioning:

Positioning {
  positionClass: 'my.package.MyPosition';
  converterClass: 'my.package.MyPositionConverter';
}

Please refer to the class IlpPositioningRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring the positioning in an equipment view.

The Adapter Rule

This rule controls the configuration of the equipment adapter. The equipment adapter is responsible for converting the business objects in the data source to representation objects (equipment nodes) in the equipment component. It provides the following features:

These equipment adapter features can be customized through CSS using the following properties:

Table 3.9 CSS Properties of the Equipment Adapter 
Property Name 
Property Type 
filter 
ilog.cpl.util.IlpFilter 
origins 
list of object identifiers 
nodeFactory 
ilog.cpl.equipment.IlpEquipmentNodeFactory 
linkFactory 
ilog.cpl.equipment.IlpEquipmentLinkFactory 
expansionStrategyFactory 
ilog.cpl.util.IlpExpansionStrategyFactory 
acceptedClasses 
excludedClasses 

How to Configure an Equipment Adapter in a CSS File

Prior to configuring the adapter, you need to configure the equipment component so that the adapter configuration is enabled:

Equipment {
  adapter: true;
}

After that, you can customize each adapter property in the Adapter rule as illustrated by the following code extract. Refer The CSS Specification in the Styling documentation for details about the CSS syntax.

Adapter {
  filter: @+Filter;
}
 
Subobject#Filter {
  class: 'CustomFilter';
  rejectObject[0]: "NE1";
  rejectObject[1]: "Link5";
}
How to Programmatically Configure an Equipment Adapter using CSS

You can programmatically modify the CSS configuration of the default equipment adapter ( ilog.cpl.equipment.IlpEquipmentAdapter) by using mutable style sheets through the ilog.cpl.css.IlpMutableStyleSheet API.

Important
The mutable style sheet is set to the adapter as a regular style sheet and is cascaded in the order in which it has been declared.

To use mutable style sheets:

  1. Get the mutable style sheet.
  2. You access the mutable style sheet through the getMutableStyleSheet() method in the equipment adapter API:
IlpMutableStyleSheet mutable = adapter.getMutableStyleSheet();
This method automatically registers the mutable style sheet into the adapter. You can manually instantiate an object of the class ilog.cpl.css.IlpMutableStyleSheet and register it yourself through the setStyleSheet() API:
IlpMutableStyleSheet mutable = new IlpMutableStyleSheet(adapter);
try {
  adapter.setStyleSheets(new String[] { mutable.toString() });
} catch (Exception x) {
  x.printStackTrace();
}
  1. Set the CSS declarations.
  2. Once you have the mutable style sheet, you can set the declarations you want:
mutable.setDeclaration("#myObjectId", "expansion", "NO_EXPANSION");
This creates the following CSS declaration into the mutable style sheet:
#myObjectId {
  expansion: NO_EXPANSION;
}
  1. Register the mutable style sheet.
  2. The mutable style sheet should be set to the adapter as a regular style sheet using the setStyleSheet() method:
try {
  adapter.setStyleSheets(new String[] { mutable.toString() });
} catch (Exception x) {
  x.printStackTrace();
}
  1. Set and update the CSS declarations.
  2. The mutable style sheet can be modified even after being registered to the adapter:
// Update the expansion type for 'myObjectId'
mutable.setDeclaration("#myObjectId", "expansion", "IN_PLACE");
// Add a new declaration
mutable.setDeclaration("#myOtherId", "expansion", "IN_PLACE");
Note
Like any style sheet, the mutable style sheet is lost when the setStyleSheet() API is invoked and a new set of style sheets is applied to the adapter.
How to Customize the Mutable Style Sheet

Reapplying a CSS configuration may be a heavy task, as the adapter may be forced to review filters, origins, recreate representation objects, and so on. It is important to use the mutable style sheet with care and to customize it properly to reapply the CSS wisely. To do so, there are two methods available in the ilog.cpl.css.IlpMutableStyleSheet API: setUpdateMask() and setAdjusting().

  1. setUpdateMask()
  2. This method controls what should be recustomized once a declaration of the mutable style sheet has been updated. The CSS configuration of the adapter is divided into two parts: adapter customization and representation object customization.
    The adapter customization handles the origins, filters, and so on:
Adapter {
  origins[0]: id0;
  origins[1]: id1;
  showOrigin: true;
  filter: @+myFilter;
} 
The representation object customization handles the expansion type of a representation object:
#myObjectId {
  expansion: IN_PLACE;
}
The accepted values for setUpdateMask() are:
For example, if you update the expansion type of a representation object through the mutable style sheet, it is recommended that you set the update mask to UPDATE_OBJECTS_MASK as there is no need to reapply the CSS configuration for the adapter part:
mutable.setUpdateMask(IlpStylable.UPDATE_OBJECTS_MASK);
mutable.setDeclaration("object", "expansion", "IN_PLACE");
  1. setAdjusting()
  2. This method is used when a series of declarations must be applied to the mutable style sheet. When the method is set to true, the mutable style sheet puts all the calls to setDeclaration() into a queue. When the method is set back to false, all the queued declarations are processed in a batch:
mutable.setAdjusting(true);
mutable.setDeclaration("#myObjectId", "expansion", "IN_PLACE");
mutable.setDeclaration("#myOtherId", "expansion", "IN_PLACE");
mutable.setAdjusting(false);