| Getting Started > Tutorial: Getting Started with ILOG JViews TGO > Using Custom Business Objects |
Using Custom Business Objects |
INDEX
PREVIOUS
NEXT
|
This section shows you how to read in a file containing alarms, which are instances of a custom business class. Custom business classes are dynamic classes that you define for yourself, as opposed to those that are predefined in JViews TGO. They can be used to represent any type of business object.
The data for this part of the tutorial is in the file:
<installdir>/tutorials/gettingStarted/data/alarms.xml
A custom style sheet is used to create an attractive display of the instances of the alarm class. For example, the style sheet defines the labels used in the table column headers, the background color of the table cells, and whether to use an icon instead of a string value.
A style sheet is read in from a CSS file. In the example, the alarm configuration is defined in the file:
<installdir>/tutorials/gettingStarted/data/alarm.css
This CSS file is imported by the style sheet (CSS) file of each graphic component interested in the alarm business class. This is illustrated in the file
<installdir>/tutorials/gettingStarted/data/table.css
by the following line:
@import "alarm.css"
Then, the style sheet of the graphic component is loaded with the method setStyleSheets, as shown in Configuring the Network Component.
This part of the code is referred to as Step 5.
void step5(Container container) throws Exception{
alarms.xml that contains the declaration of the custom dynamic class Alarm, and a number of its instances.
| Note |
| You read the data into the same data source as used for all the previous data. The custom class declarations can also be read at startup time by declaring them in the deployment descriptor. |
java.lang.String for the id attribute.
Alarm class are defined by giving specific values to the attributes of the class. For example:
IlpTable is alarmTableComponent. This table will be used to display the alarms.
IlpClassManager. It handles a hierarchy of business classes. See Business Class Manager API in the Business Objects and Data Sources documentation for details. The application context allows you to retrieve the class manager service.
getClass returns the specified class.
mainDataSource. The class of business objects to be displayed from this data source is specified as alarmClass.
tableComponent and alarmTableComponent and places them in a tabbed pane. It is written in pure Swing code.
IlpFilter interface is implemented as treeAlarmFilter. The method accept is used to test the acceptability of the objects offered to this filter. The method returns true if the filter accepts an object.
Alarm class has the attributes perceivedSeverity and acknowledged. Only alarms with a severity greater than 3 and with the acknowledged attribute set to false will be included in the table.
The sample should now look as shown in Figure 2.5.
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. All rights reserved. Legal terms. | PREVIOUS NEXT |