| Graphic Components > Network Component > Configuring the Network Component > Configuring a Network Component through a CSS File |
Configuring a Network Component through a CSS File |
INDEX
PREVIOUS
NEXT
|
You can customize the following features in a CSS file:
The network configuration can be split across several CSS files. The method IlpNetwork.setStyleSheets accepts several CSS filenames.
There are three ways to apply a CSS configuration to a network component, depending on whether you have one or several configuration files:
IlpNetwork as follows:
ilog.cpl.network.defaultConfiguration.css from the jviews-tgo-all.jar file.
<tgo xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "ilog/cpl/schema/project.xsd" style="configurationFile1.css,configurationFile2.css">
setStyleSheets method as follows:
setStyleSheets as follows:
The following code represents an example of configuring a network in CSS. It is based on the CSS files located in
<installdir>/samples/network/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.
// ***************************************************
// * COMPONENT CUSTOMIZATION *
// * *
// * This section is enclosed by *
// * Network { *
// * } *
// * and specifies which feature will be customized: *
// * - toolbar (Network Component's toolbar) *
// * - view (Scrollbar configuration) *
// * - overview (Presence of an overview) *
// * - interactor (Default view interactor) *
// * - zooming (Zoom policy set in the view) *
// * - graphlayout (Layout for the nodes) *
// * - linklayout (Layout for the links) *
// * - labellayout (Layout for the labels) *
// * - positioning (Position policy for objects) *
// * - backgrounds (Backgrounds set in the view) *
// * - adapter (Network adapter customization) *
// ***************************************************
Network {
toolbar: true;
interactor: true;
zooming: true;
adapter: true;
}
For detailed information about the CSS syntax, refer to section Introducing Cascading Style Sheets in the Styling documentation.
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 Network 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 Network rule. You will find detailed documentation for each of these properties in the ILOG JViews TGO Java API Reference Documentation, package ilog.cpl.network.renderer.
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 network 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:
Select, used for predefined actions, or
AbstractButton with a constructor that takes an instance of IlpViewsView as argument, or
Separator short name to indicate that a separator should be placed in the specified position.
You can add toolbar separators in specified positions of the network component toolbar. When configuring the network 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:
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.network.action.toolbar.IlpNetworkSelectButton.
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. They 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 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:
ilog.cpl.graph.action.IlpSelectAllObjectsAction
ilog.cpl.graph.action.IlpRemoveSelectedObjectsAction
An interactor can have a pop-up menu factory associated with it. This factory can be specified using the property popupMenuFactory. The value of this property should be a bean that implements the interface IlpPopupMenuFactory. 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 a network view.
JViews TGO provides a list of predefined toolbar buttons usable in the network component (see Table 2.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';
}
To add your own toolbar button, you need to create a new action class that inherits from IlpNetworkInteractorAction and contains a constructor that takes an IlpViewsView as parameter.
public class CustomButtonAction extends IlpNetworkInteractorAction {
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 IlpNetworkInteractorButton, and you will be able to customize the properties of this button as with the predefined buttons. For example, you can customize the following:
This rule controls the view.
You can customize the following properties of the view:
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 a network view.
This rule controls the overview window.
The property enabled controls the visibility of the overview window. The default value is false.
The following CSS sample shows how to customize the overview:
Overview {
enabled: 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 a network view.
This rule controls the interactor associated with the view.
You can customize the following properties of the interactor:
Prior to configuring the network view interactor, you need to configure the network component so that the interactor configuration is enabled:
Network {
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.
You can customize the default view interactor to be one of the interactors present in the toolbar configured for the network component. In this case, the toolbar button is identified when the network 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 network view to use the Select toolbar button as the default view interactor:
Interactor {
name: "Select";
}
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 network view. Please refer to Interacting with the Network View and Interacting with the Network Objects for more information about interactor customization.
When the interactor renderer is enabled, you can also customize objects interactors using property interactor. Please refer to IlpInteractorRenderer in the ILOG JViews TGO Java API Reference Documentation for further information.
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:
ilog.tgo.composite.IltLogicalZoomPolicy)
ilog.tgo.composite.IltPhysicalZoomPolicy)
Property Name |
Type |
Default |
Description |
|---|---|---|---|
decorationNames | String[] | null |
Specifies a list of decoration names that are customized at the zoom policy level. See ilog.tgo.graphic.IltGraphicElementName for a list of decoration names that can be used. |
visibilityThresholds |
double[] |
null |
Specifies a list of thresholds, one for each decoration name customized with property decorationNames. These thresholds indicate the zoom level below which the decorations become invisible in the view. It allows you to hide decorations as the user zooms out in the view. |
ilog.tgo.composite.IltMixedZoomPolicy)
Property Name |
Type |
Default |
Description |
|---|---|---|---|
zoomThreshold |
double |
1 |
Specifies the zoom threshold when the physical zoom or the logical zoom should be used |
subnetworkZoomFactor |
double |
1 |
Specifies an additional zoom threshold that is applied to expanded subnetworks |
decorationNames | String[] | null |
Specifies a list of decoration names that are customized at the zoom policy level. See ilog.tgo.graphic.IltGraphicElementName for a list of decoration names that can be used. |
visibilityThresholds |
double[] |
null |
Specifies a list of thresholds, one for each decoration name customized with property decorationNames. These thresholds indicate the zoom level below which the decorations become invisible in the view. It allows you to hide decorations as the user zooms out in the view. |
The following CSS sample shows how to customize the zoom policy in a network 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 a network view.
JViews TGO provides three predefined zoom policies that you can use directly in the network 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. 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;
}
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).
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.
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).
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";
}
When the node layout is configured for a view, it is applied to the view and to all the subnetworks displayed in this network view.
However, you can specify different node layouts for subnetworks. The node layouts of subnetworks are configured in CSS using the same properties as for the view configuration (layouts and autoLayoutIndex).
When you configure the node layout for a specific subnetwork, you must declare the CSS selector with a specific pseudoclass that identifies the graph layout renderer. The pseudoclass must be graphLayoutRenderer, as illustrated below:
GraphLayout {
layouts[0]: @+treeLayout;
autoLayoutIndex: 0;
}
Subobject#treeLayout {
class: 'ilog.views.graphlayout.tree.IlvTreeLayout';
flowDirection: Bottom;
}
#SubNetwork:graphLayoutRenderer {
layouts[0]: @+hierarchicalLayout;
autoLayoutIndex: 0;
}
Subobject#hierarchicalLayout {
class: 'ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout';
flowDirection: Top;
}
The property autoLayoutIndex, when used in an object selector with the graphLayoutRenderer pseudoclass, specifies the automatic node layout that is applied to the subnetwork.
You can also specify nonautomatic node layouts for subnetworks. This configuration is achieved in the same way as for the view configuration (layouts property with multiple node layouts and the autoLayoutIndex set to -1).
When you call the method performAttachedLayout(int index), it is applied recursively in the model hierarchy. Therefore if a node layout is configured for the given index in the subnetwork, this specific layout is performed. Otherwise, the node layout configured for the parent network is executed.
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:
layoutIgnored: If this property is set to true, the object is completely ignored by the graph model (using an IlvLayoutGraphicFilter).
markedForIncremental: If the layout algorithm is an IlvHierarchicalLayout, you can use the property markedForIncremental. When this property is set to true for an object, the method IlvHierarchicalLayout.markForIncremental(java.lang.Object) is called for this object. This means that the position of the object is recomputed during the next incremental layout. This property has an effect only if the incrementalMode property of the layout itself is set to true. For example:
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 a network view.
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.
The following CSS sample shows how to customize the link layout:
LinkLayout {
class: "ilog.views.graphlayout.link.IlvLinkLayout";
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.
When the link layout is configured for a view, it is applied to the view and to all the subnetworks displayed in this network view.
However, you can also specify different link layouts for subnetworks. The link layout is configured in CSS using the property linkLayout and the pseudoclass linkLayoutRenderer, as illustrated below:
LinkLayout {
class:'ilog.views.graphlayout.link.IlvLinkLayout';
}
#SubNetwork:linkLayoutRenderer {
linkLayout: @+shortLinkLayout;
}
Subobject#shortLinkLayout{
class: 'ilog.tgo.graphic.graphlayout.IltShortLinkLayout';
}
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 Network Component.
Link parameters are set in the style sheet as follows:
object."ilog.tgo.model.IltAbstractLink":linkLayoutRenderer {
linkStyle: ORTHOGONAL_STYLE;
}
#Link1:linkLayoutRenderer {
linkStyle: DIRECT_STYLE;
}
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 a network view.
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 a network view.
This rule allows you to configure two kinds of background that affect the network component representation:
This refers to background files such as maps or background images. You can specify a network background through:
IlpBackgroundCSSConfiguration encapsulates all the properties supported by the predefined background types. You should use it if want to use one of the predefined types.
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.
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.
This refers to the representation of the view as a background for your network backgrounds (the area that the network 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:
Please refer to the class ilog.cpl.network.renderer.IlpBackgroundsRenderer in the ILOG JViews TGO Java API Reference Documentation for more information on configuring the background in a network.
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 a network view.
This rule controls the configuration of the network adapter. The network adapter is responsible for converting the business objects in the data source to representation objects (network nodes) in the network component. It provides the following features:
IltAlarm business class is part of the list of excluded classes.
These network adapter features can be customized through CSS using the following properties:
Property Name |
Property Type |
|---|---|
filter | |
origins |
list of object identifiers |
networkNodeFactory | |
networkLinkFactory | |
expansionStrategyFactory | |
acceptedClasses |
list of ilog.cpl.model.IlpClass |
excludedClasses |
list of ilog.cpl.model.IlpClass |
Prior to configuring the adapter, you need to configure the network component so that the adapter configuration is enabled:
Network {
adapter: true;
}
After that, you can customize each adapter property in the Adapter rule as illustrated by the following code extract. Refer to 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";
}
You can programmatically modify the CSS configuration of the default network adapter (ilog.cpl.network.IlpNetworkAdapter ) 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:
ilog.cpl.css.IlpMutableStyleSheet and register it yourself through the setStyleSheet() API:
| 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.
|
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().
IlpStylable.UPDATE_COMPONENT_MASK: Only the adapter part is recustomized.
IlpStylable.UPDATE_OBJECTS_MASK: Only the representation object part is recustomized.
IlpStylable.UPDATE_ALL_MASK: Bot the adapter and representation object parts are recustomized.
IlpStylable.UPDATE_NONE_MASK: Nothing is recustomized.
UPDATE_OBJECTS_MASK as there is no need to reapply the CSS configuration for the adapter part:
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. All rights reserved. Legal terms. | PREVIOUS NEXT |