| Styling > Customizing Off-Page Connectors > Customizing Off-Page Connector Types |
Customizing Off-Page Connector Types |
INDEX
PREVIOUS
NEXT
|
In ILOG JViews TGO, the off-page connector type determines how the object base is represented. Each off-page connector type is associated with a specific base renderer that is in charge of drawing the object according to its type and alarm information.
In JViews TGO, you can extend the base representation of off-page connectors by using one of the predefined base renderer factory classes (IltOPCImageBaseRendererFactory or IltOPCSVGBaseRendererFactory), or by implementing your own subclass of IltOPCBaseRenderer for each new type of off-page connector that you want to create.
JViews TGO provides the following IltOffPageConnector types that you can use directly in your applications:
The following properties apply to all these predefined off-page connector types:
The following properties are mapped, that is, their value is computed automatically from the alarms set in the object (column Set). You can override the mapped values or customize their graphic representation even when the object does not carry states and alarms.
Property Name |
Type |
Set |
Default Value |
Description |
|---|---|---|---|---|
foreground | Color |
Yes |
28% gray in the IltObject class style |
Denotes the foreground color of the object base. |
background | Color |
Yes |
Transparent ( null) |
Denotes the background color of the object base. |
fillStyle | ilog.util.IlFillStyle |
Network node | IlFillStyle.SOLID_COLOR for user-defined business objects IlFillStyle.PATTERN for predefined business objects |
Denotes the style used to fill the base of an object.
Possible values are: IlFillStyle.NO_FILL IlFillStyle.SOLID_COLOR IlFillStyle.LINEAR_GRADIENT IlFillStyle.RADIAL_GRADIENT IlFillStyle.TEXTURE IlFillStyle.PATTERN |
fillTexture | Image |
Network node | null |
Denotes the texture used to fill the base of an object. This property is only used if fillStyle is set to IlFillStyle.TEXTURE. |
fillPattern | Pattern |
Yes | null (Solid) |
Denotes the pattern used to fill the base of an object. This property is only used if fillStyle is set to IlFillStyle.PATTERN. |
fillStart | float |
Network node | 0f |
Returns the position where the gradient of an object starts, that is, where the color is the one defined by property foreground. This property is only used if fillStyle is set to IlFillStyle.RADIA_GRADIENT or IlFillStyle.LINEAR_GRADIENT. |
fillEnd | float |
Network node | 1f |
Returns the position where the gradient of an object ends, that is, where the color is the one defined by property background. This property is only used if fillStyle is set to IlFillStyle.RADIA_GRADIENT or IlFillStyle.LINEAR_GRADIENT |
fillAngle | float |
Network node | 0 |
Returns the angle (in degrees) of the gradient used to fill the base of an object. This property is only used if fillStyle is set to IlFillStyle.RADIAL_GRADIENT or IlFillStyle.LINEAR_GRADIENT |
borderColor | Color |
Yes |
10% gray |
Denotes the primary color of the base border. |
borderColor2 | Color |
Yes |
60% gray |
Denotes the secondary color of the base border. |
reliefThickness | float |
No | 1 |
Denotes the width of the relief on the base border. |
The following property is specific to the type IltOffPageConnector.Standard. This type determines the graphic representation of an off-page connector in the form of two nested relief diamonds.
Property Name |
Type |
Default Value |
Description |
|---|---|---|---|
reliefDistance | int | 4 |
Denotes the distance between two nested reliefs diamonds. |
The following CSS extract shows how you can customize the graphic representation of standard off-page connectors. In this example, the size of the off-page connector is set to 21x21:
object."ilog.tgo.model.IltOffPageConnector"[type=Standard] {
shapeWidth: 21;
shapeHeight: 21;
}
The principle to create new types of off-page connectors is the same as to create new types of network elements. For details, please refer to Customizing Network Element Types.
The following code extract shows how to create a new IltOffPageConnector type and associate it with an image so that it be be displayed in the JViews TGO graphic components.
// Create the new OPC type
IltOffPageConnector.Type opcType = new IltOffPageConnector.Type("MyType");
// Retrieve the image and create the base renderer factory
Image img = IltSystem.GetDefaultContext().getImageRepository().getImage("type.png");
IltOPCImageBaseRendererFactory factory = new IltOPCImageBaseRendererFactory(img);
// Associate the new OPC type to the image base renderer factory
IltSettings.SetValue("OffPageConnector.Type.MyType.Renderer", factory);
You can also create new off-page connector types by using global CSS settings (see Using Global Settings in Chapter 2, Using Cascading Style Sheets for more information):
setting."ilog.tgo.model.IltOffPageConnector"{
types[0]: @+opcType0;
}
Subobject#opcType0 {
class: 'ilog.tgo.model.IltOffPageConnector$Type';
name: "MyType";
}
Likewise, you can customize the renderer using global CSS settings. To do so, you need to specify the full path to the object to be customized, as well as the value of its name attribute in order to match the right type of object in the system. The CSS property to customize here is renderer. In the example below, the name of the renderer factory class that is included in the search path is MyOPCRendererFactory.
setting."ilog.tgo.model.IltOffPageConnector.Type"[name="MyType"] {
renderer: @+opcRendererFactory1;
}
Subobject#opcRendererFactory1 {
class: 'MyOPCRendererFactory';
}
Another way to represent a type with an image is to specify a source image and an alarm color level parameter for every required base style, directly in CSS. No other base style property or renderer parameter is needed, as a complete image is provided for every needed base style.
To create a new type of off-page connector using an image per base style, do the following:
IltOPCDirectImageBaseRendererFactory to the new type
IltSettings.SetValue:
object."ilog.tgo.model.IltOffPageConnector"["type"=MyType]["objectState.Bellcore.State"=EnabledIdle] {
object."ilog.tgo.model.IltOffPageConnector"["type"=MyType]["objectState.Bellcore.State"=DisabledIdle] {
For details about how to create image base renderers, refer to Customizing Network Element Types From Images.
The predefined off-page connector types have a label and a tooltip specified in the JViews TGO resource bundle (see About Internationalization in the Context and Deployment Descriptor documentation).
The resources that apply to off-page connector types are identified as:
.tgo.OPC_Type_<TYPE NAME>: off-page connector type labels
ilog.tgo.OPC_Type_<TYPE NAME>_ToolTip: off-page connector type tooltips
You can edit the values directly in the JViews TGO resource bundle files.
When you create new off-page connector types, the label and tooltip information will also be retrieved from the same resource bundle to be displayed, for example, in a table cell. As you declare new types, register the corresponding entries into the resource bundle file, as follows:
Considering that you have created the following new off-page connector type:
IltOffPageConnector.Type opcType = new IltOffPageConnector.Type("MyType");
You should declare the following properties in the JTGOMessages.properties file:
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. All rights reserved. Legal terms. | PREVIOUS NEXT |