Developing with the SDK > Introducing the SDK > The Diagram Component > The Project

The project is an association of a style sheet and a data source which supplies data. It groups the inputs for a diagram. A project is saved as an XML file with the extension .idpr (Diagrammer Project File).

Loading a project file is the recommended way to load a diagram in Java because it is the quickest way. Code Sample 1.5 shows how to load a project into a diagram component using the method setProject.

IlvDiagrammer diagrammer = new IlvDiagrammer();
diagrammer.setProject(new IlvDiagrammerProject(
  new URL("file:myproject.idpr")), true);
//display the diagram

Code Sample 1.5 Loading a Project File into a Diagram Component

The project is represented by the IlvDiagrammerProject class, which is in the ILOG JViews Diagrammer package ilog.views.diagrammer.project. When a new project is created, the style sheet and data source are both null.

Code Sample 1.6 shows how to create a new project file, set the style sheet and data source, and save the file.

IlvDiagrammerProject project = new IlvDiagrammerProject();
project.setStyleSheet(new URL("file:example.css"));
IlvXMLDataSource dataSource = new IlvXMLDataSource();
DataSource.setDataURL(new URL("file:example.xml"));
project.setDataSource(dataSource);
project.write(new URL("file:example.idpr"));

Code Sample 1.6 Creating a Project File