| Graphic Components > Table Component > Table Component Services > Filling the Table with Business Objects |
Filling the Table with Business Objects |
INDEX
PREVIOUS
NEXT
|
The table can be filled with business objects through an IltDefaultDataSource, as illustrated by the following code.
// 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:
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.
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. All rights reserved. Legal terms. | PREVIOUS NEXT |