You must define a project file to tell the
diagram component to use the data source. The project file
is an XML file called
phenol-molecule.idpr
.
This file contains the class name of the data source, and also the
path of the
style sheet used to represent the molecule.
The following code example shows the project file contents.
The project file for the Molecule example
<diagrammer style="molecule.css">
<datasource class="PhenolMoleculeDataSource"/>
</diagrammer>
To display the molecule, you can simply load the project
file into the diagram component as follows:
Diagrammer.setDataFile(new URL("file:phenol-molecule.idpr"));
Note
The sample uses the prebuilt class IlvDiagrammerApplication
,
so you do not see the call to setDataFile
.
Instead the project file is passed as a command-line argument to the
application.