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.
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() {
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
.
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.
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.