JViews TGO Functions

Functions for direct use in CSS files

Functions for direct use in CSS files 
Function Name
Description
Class Name
Usage
image
Retrieves an image from the Image Repository service registered in your application context.
Parameter:
image location
Example:
@|image("ilog/tgo/ilt_busy.png")
resource
Retrieves a resource value from a given ResourceBundle .
Parameters:
ResourceBundle name (mandatory)
Message identifier (mandatory)
Default message value (optional). Returned if the message requested was not found in the given resource bundle.
Example:
@|resource("ilog.tgo.messages.JTGOMessages", "ilog.tgo.Operational_State")
valuemap
Retrieves a value from an IlpValueMap object that corresponds to the specified key.
Parameters:
IlpValueMap instance
Object key
Example:
@|valuemap(@#valuemap, @severity);
format
Applies a format to the given values.
Parameters:
java.text.Format instance
Arguments of the Format
Example:
@|format(@#formatBean, @attribute)
blinkingcolor
Creates a blinking color.
Note
Blinking colors are not supported in table and tree components.
Parameters:
on color
off color
on period
off period
Example:
@|blinkingcolor(black, white,1000, 500)
pattern
Creates a pattern description, IlPattern, which can be used to customize the representation of JViews TGO predefined business objects.
Parameter:
Pattern type, which can have one of the following values:
Grid , SkewGrid , Dots , ThinHatching .
It can also generate patterns defined in IlvPattern , for example, LIGHT_VERTICAL .
Depending on the pattern type, other arguments can be passed to configure the pattern instance.
Grid patterns accept two integer arguments: xPeriod and yPeriod .
SkewGrid patterns accept two integer arguments: uPeriod and vPeriod .
Examples:
@|pattern("Grid", 3, 2)
@|pattern("SkewGrid", 2, 2)
@|pattern("LIGHT_VERTICAL")
acknowledgedAlarmCount
Returns the number of acknowledged alarms for a given business object.
Parameter:
One of the following possibilities:
Default: all raw severities or traps
Impact: all impact alarm severities
Alarm severity name: for example, Raw.Major , Impact.MajorHigh
Examples:
label: '@|acknowledgedAlarmCount("Impact")';
label: '@|acknowledgedAlarmCount("Impact.MajorHigh")';
acknowledgedAlarmSummary
Returns a summary of acknowledged alarms for a given business object. The returned value is a String listing the number of acknowledged alarms for each chosen severity.
Parameter:
One of the following possibilities:
Default: all raw severities or traps
Impact: all impact alarm severities
Alarm severity name: for example, Raw.Major , Impact.MajorHigh
Examples:
label: '@|acknowledgedAlarmSummary("Impact")';
label: '@|acknowledgedAlarmSummary("Raw.Major")';
alarmCount
Returns the number of outstanding alarms for a given business object.
Parameter:
One of the following possibilities:
Default: all raw severities or traps
Impact: all impact alarm severities
Alarm severity name: for example, Raw.Major , Impact.MajorHigh
Examples:
label: '@|alarmCount("Impact")';
label: '@|alarmCount("Raw.Major")';
alarmSummary
Returns the summary of new and acknowledged alarms for a given business object.
Parameter:
One of the following possibilities:
Default: all raw severities or traps
Impact: all impact alarm severities
Alarm severity name: for example, Raw.Major , Impact.MajorHigh
Examples:
label: '@|alarmSummary()'; ///Equivalent to "Default"
label: '@|alarmSummary("Impact")'; ///Impact alarms
label: '@|alarmSummary("Raw.Major")'; ///Consider only raw major alarms
highestAcknowledgedSeverity
Returns the highest severity of acknowledged alarms for a given business object.
Parameter:
One of the following possibilities:
Default: all raw alarm severities or traps
Impact: all impact alarm severities
Alarm severity name: for example, Raw.Major , Impact.MajorHigh
Examples:
label: '@|highestAcknowledgedSeverity()'; ///Equivalent to "Default"
label: '@|highestAcknowledgedSeverity("Impact")'; ///Impact alarms
label: '@|highestAcknowledgedSeverity("Raw.Major")'; ///Consider only raw major alarms
highestNewSeverity
Returns the highest severity of new alarms for a given business object.
Parameter:
One of the following possibilities:
Default: all raw alarm severities or traps
Impact: all impact alarm severities
Alarm severity name: for example, Raw.Major , Impact.MajorHigh
Examples:
label: '@|highestNewSeverity()'; ///Equivalent to "Default"
label: '@|highestNewSeverity("Impact")'; ///Impact alarms
label: '@|highestNewSeverity("Raw.Major")'; ///Consider only raw major alarms
highestSeverity
Returns the highest severity of outstanding alarms for a given business object.
Parameter:
One of the following possibilities:
Default: all raw alarm severities or traps
Impact: all impact alarm severities
Alarm severity name: for example, Raw.Major , Impact.MajorHigh
Examples:
label: '@|highestSeverity()'; ///Equivalent to "Default"
label: '@|highestSeverity("Impact")'; ///Impact alarms
label: '@|highestSeverity("Raw.Major")'; ///Consider only raw major alarms
newAlarmCount
Returns the number of new alarms for a given business object.
Parameter:
One of the following possibilities:
Default: all raw alarm severities or traps
Impact: all impact alarm severities
Alarm severity name: for example, Raw.Major , Impact.MajorHigh
Examples:
label: '@|newAlarmCount()'; ///Equivalent to "Default"
label: '@|newAlarmCount("Impact")'; ///Impact alarms
label: '@|newAlarmCount("Impact.MajorLow")'; ///Consider only raw major alarms
newAlarmSummary
Returns the summary of new alarms for a given business object.
Parameter:
One of the following possibilities:
Default: all raw alarm severities or traps
Impact: all impact alarm severities
Alarm severity name: for example, Raw.Major , Impact.MajorHigh
Examples:
label: '@|newAlarmSummary()'; ///Equivalent to "Default"
label: '@|newAlarmSummary("Impact")'; ///Impact alarms
label: '@|newAlarmSummary("Impact.MajorLow")'; ///Consider only raw major alarms
primaryStateSummary
Returns the summary of the primary state information for a given business object.
Example:
label: '@|primaryStateSummary()';
secondaryStateSummary
Returns the summary of the secondary state information for a given business object.
Example:
label: '@|secondaryStateSummary()';
settings
Returns an IltSettings.
Parameter:
Setting key
Example:
icon: '@|settings("Link.Media.Fiber.Icon")';
severityColor
Returns the color corresponding to a given alarm severity.
Parameter:
Alarm severity
Examples:
labelBackgroundColor: '@|severityColor(@|highestNewSeverity())';
labelBackgroundColor: '@|severityColor("Raw.Major")';
severityBrightColor
Returns the bright color corresponding to a given alarm severity.
Parameter:
Alarm severity
Example:
alarmBrightColor: '@|severityBrightColor(@|highestNewSeverity())';
severityDarkColor
Returns the dark color corresponding to a given alarm severity.
Parameter:
Alarm severity
Example:
alarmDarkColor: '@|severityDarkColor(@|highestNewSeverity())';
severityIcon
Returns the icon corresponding to a given alarm severity.
Parameter:
IltAlarmSeverity or the String representation of an IltAlarmSeverity .
Example:
alarmIcon: '@|severityIcon("Raw.Major")';
alarmIcon: '@|severityIcon(@|highestSeverity())';
alarmIcon: '@|severityIcon(@|highestSeverity("Impact"))';
tinyImage
Returns an image displaying the tiny representation of a predefined business object.
Example:
icon : '@|tinyImage()';

How to create new CSS functions

JViews TGO allows you to create and register new functions to be used in CSS files to customize the representation of your business objects. These functions should implement the interface IlpCSSFunction. This interface defines the following methods:
  • Returns the name of the function that is used to identify the function in the CSS files.
  • Returns the delimiters that are used to identify the parameters of the function; for example, comma ( , ).
  • Indicates whether the delimiters will also be returned as tokens.
  • This method is the core of the function, where the value will be computed and returned.
The signature of the main method is:
public Object call (Object[] args,
                    Class type,
                    IlpContext appc,
                    IlpGraphicView view,
                    IlpRepresentationObject ro,
                    IlpAttribute attribute);
When a function is evaluated, the parameters are first resolved as subexpressions. Then, the final values of the parameters are passed to the args array.
The parameter type is the expected type of the function when it is known. A null value is possible. The implementation should be careful to return an object of the appropriate type. Otherwise, a simple conversion is applied, if conversion is possible, that is, between primitive types or to a String .
The other parameters provide information about the application context, graphic view, representation object, and attribute at the time when the call is made. Stateless expressions do not need these parameters.
If an error occurs during a call, an exception will be reported and the current property setting will be canceled.
The following application is provided as part of the JViews TGO demonstration software: <installdir> /samples/framework/datasource-explorer2. It shows how to implement and register a new function. See file ByteFunction.java.
Functions are registered in the CSS file with one of the following properties:
  • functionList : lists the functions as a comma-separated list of function names.
  • functions : an indexed property of function names. Allows you to specify the list of functions according to indices. With this indexed property, you can register functions in a modular way in different CSS files.

How to register a function in a CSS file

StyleSheet {
    functionList: "test.function.FirstFunction,test.function.SecondFunction";
}
or
StyleSheet {
    functions[0]: "test.function.FirstFunction";
    functions[1]: "test.function.SecondFunction";
}