| Developing with the SDK > Using and Writing Data Models > JavaBeans Example > The Phenol Molecule Data Source |
The Phenol Molecule Data Source |
INDEX
PREVIOUS
NEXT
|
The classes and methods of the Molecule example represent a molecule so that the diagram component can display it. To display a specific molecule, you need to load the Molecule instance from a data source.
Code Sample 2.7 shows a data source that contains a Phenol molecule. This class is a subclass of IlvDiagrammerDataSource.
public class PhenolMoleculeDataSource extends IlvDiagrammerDataSource { ... |
To load a data source into a diagram component, call its read method, which is shown in Code Sample 2.8.
The code lines in the read method are as follows:
Molecule instance with a static method for this purpose.
Molecule instance into the molecule model.
The data source class has other methods which must be implemented because they are abstract, but they do nothing. Code Sample 2.9 shows these methods.
The write method is not needed because the molecule data cannot be written.
The serialize method is not needed because there is no need to write any additional information to define the data source in a project file.
The deserialize method is not needed because there is no need to read any additional information to load the data source from a project file.
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |