Perforce JViews TGO Sample: Table Component - Custom Classes
Description
This sample shows how to create custom business classes and use them with the table component.
How to Use the Sample
In addition, there is a combo box at the top of the window that allows you to select the class of objects to display.
How to Run the Sample as an Application
This sample can
be run as an application.
The installation directory contains
an executable JAR file,
table-customClasses.jar
,
that allows you to execute the sample with a double click from a
file browser. Note that if you are using Internet Explorer, you can
open the installation directory
and execute the JAR file from the browser. This
technique may not work in other Web browsers.
Alternatively, you
can run the sample application from the command line.
First check that the Ant utility is properly configured. If not, see the
instructions on how to configure Ant for Perforce JViews.
Then, go to the installation directory
of the sample and type:
ant run
Topics Covered
-
Basic initialization.
See the table/basic sample for details. - Declaring custom business classes in XML.
- Using a JavaBeans class as a business class.
- Mapping attributes of custom classes to graphic properties using cascading style sheets.
Detailed Description
This sample differs from the basic sample in that it shows instances of custom business classes. There are three classes, which illustrate different ways of extending the object model of JTGO:
-
Alarm
This class is fully dynamic and defined in XML in the file customClasses. Its instances are created in alarms.
The attributes of the class are mapped to the graphic attributes of the table by a style sheet declared in alarm. -
Service
This class is a Java class that follows the JavaBean conventions. It is declared in the file customClasses.Service. Its instances are created in services.
The attributes of the class are mapped to the graphic attributes of the table by a style sheet declared in service. -
Element
This class is a custom subclass of one of the predefined JTGO classes, ilog.tgo.model.IltNetworkElement. It is dynamically defined in XML, also in the file customClasses. Its instances are created in elements.
The attributes of the class are mapped to the graphic attributes of the table by a style sheet declared in element.
Installation Directory
The Table Component - Custom Classes sample is installed here.
Classes Involved
-
ilog.tgo.IltSystem
The class that initializes a JViews TGO application.
-
ilog.tgo.datasource.IltDefaultDataSource
The default datasource implementation.
-
ilog.cpl.IlpTable
The table component.
Source Files
-
customClasses.Main
The entry point of the sample.
-
customClasses.Service
The custom business class implementation.