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 network 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 network component

The following code sample shows how to load a project file into a network component, using the method setProject .
IlpNetwork network = new IlpNetwork();
network.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 network 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");