Filling the table with business objects

The table can be filled with business objects through an IltDefaultDataSource, as illustrated by the following code.

How to fill a table with business objects

// Create a table component and connect it to a data source
IlpTable tableComponent = new IlpTable();
IltDefaultDataSource dataSource = new IltDefaultDataSource();
// The second parameter specifies which kind of object contained 
// in the data source the table will show
tableComponent.setDataSource(dataSource, IltNetworkElement.GetIlpClass());

// Create a business object and insert it in the data source
IltObjectState os = new IltBellcoreObjectState();
os.set(IltBellcore.State.EnabledActive);
IltNetworkElement london = 
  new IltNetworkElement("Fax", IltNetworkElement.Type.Fax, os);
dataSource.addObject(london);
Note that a data source can also load an XML file containing business objects, as shown in Creating a table component: a sample.
You can also use project files to easily create and load data source business objects into your table component, as illustrated below:

How to fill a table with business objects using a project file

You can create the following project file to indicate the type of data source to be used and the XML file that contains the data source information:
<?xml version="1.0"?>
<tgo xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation = "ilog/cpl/schema/project.xsd">
  <datasource javaClass="ilog.tgo.datasource.IltDefaultDataSource" 
fileName="network.xml"/>
</tgo>
Once the project file is specified, you can load it in the component using method IlpTable.setProject(URL projectURL) or IlpTable.setProject(IlpProject project) . See Loading a project file for details.