Graphic Components > Table Component > Configuring the Table Component > Loading a Project File

A project is a combination of style sheets that supply rendering information and a data source that supplies the data to be represented in a table component. A project is saved as an XML file with extension .itpr.

Loading a project file is the recommended way to configure a graphic component in Java as it is the fastest.

How to Load a Project File into a Table Component

The following code sample shows how to load a project file into a table component, using the method setProject.

IlpTable table = new IlpTable();
table.setProject(new URL("file:project.itpr");

The project is represented by the IlpTGOProject class, included in the package ilog.cpl.project. When a new project is created, the style sheet and data source are both null.

How to Create a New Project for the Table Component

The following code sample shows how to create a new project file by setting the style sheets and data source, then saving the project.

IlpTGOProject project = new IlpTGOProject();
project.setStyleSheet(new URL("file:example.css");
IltDefaultDataSource dataSource = new IltDefaultDataSource();
dataSource.setFileName("data.xml");
project.setDataSource(dataSource);
project.write(new URL("file:example.itpr");