Global settings defined in CSS allow you
to create global state objects, alarm objects or telecom objects
in the system and refer to them by their names when you customize
them.
To do so, you need first to create a CSS
file containing all the global settings.
Settings {
alarm: true;
}
Alarm {
impactSeverities[0]: @+impactSeverity0;
}
Subobject#impactSeverity0 {
class: 'ilog.tgo.model.IltAlarm.ImpactSeverity';
name: "Alarm.Impact.InformationalHigh";
severity: 220;
}
setting."ilog.tgo.model.IltAlarm.ImpactSeverity"[name="Alarm.Impact.Information
alHigh"] {
description: "Informational High";
}
This example shows how to create an impact severity object, then
add it to the state system. The creation is enabled by the
alarm: true
declaration. Next, objects with impact severities of the type
created can be customized with a new description message.
Once the global CSS settings file is created, an instance of ilog.tgo.resource.IltSettings, which
serves as the global settings root object, is created. The CSS
settings file is then assigned to the root object using the setStyleSheets method:
IlpContext context = IltSystem.GetDefaultContext();
IltSettings settingsRoot = new IltSettings(context);
try{
settingsRoot.setStyleSheets( new String[] {"global.css"} );
}
catch (IlvStylingException e) {
e.printStackTrace();
}
The default settings can be restored by passing
null
to the setStyleSheets method:
IlpContext context = IltSystem.GetDefaultContext();
IltSettings settingsRoot = new IltSettings(context);
try{
settingsRoot.setStyleSheets( null );
}
catch (IlvStylingException e) {
e.printStackTrace();
}
Note
New objects previously created through
the global settings CSS file remain in the system.