Creating a basic table
Shows you how to create a table component. The table in the sample uses the same data source as the network component. Unlike a tree or a network, a table can only meaningfully display objects of a single class or objects with a common base class. The reason is that the table can show only attributes (columns) that are common to all of the objects (rows) displayed.
In this example, the objects to be displayed are restricted by class to the network elements. Therefore, neither the regions added in Step 1 (
Creating a basic network component) nor the alarms to be added later in Step 5 (
Using custom business objects) will be shown in the table.
To allow this table component to function, you must create a table component, connect the data source to the table component, restrict the content of the table to network elements, and add the table to the container.
This part of the code is referred to as Step 3.
void step3() {
1. Create the table component.
tableComponent = new IlpTable();
JViews TGO supplies
IlpTable as a predefined table component. The new instance of
IlpTable that you create is called
tableComponent.
2. Connect the data source to the table component and filter the objects to be put into the table.
tableComponent.setDataSource(mainDataSource,
ilog.tgo.model.IltNetworkElement.GetIlpClass());
The objects to be displayed are restricted to the class
IltNetworkElement. The method
GetIlpClass is called to access the dynamic business class corresponding to the
IltNetworkElement Java™ class.
3. Add the table component to the container.
tableArea.add(tableComponent, BorderLayout.CENTER);
}
The sample with the table component should look as shown in the following figure.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.