| Developing with the SDK > Using and Writing Data Models > Connecting Data Sources to the Diagram Component |
Connecting Data Sources to the Diagram Component |
INDEX
PREVIOUS
NEXT
|
A diagram component ( IlvDiagrammer instance) has an associated SDM engine instance. The SDM engine is connected to the default SDM model by default.
There are several ways for you to load data into a diagram component:
The simplest way of loading data into an IlvDiagrammer instance is to load an XML file containing the descriptions of the objects to add to the model.
If you have available an XML file in diagram format, you can load it directly in the Designer without needing to write any Java code.
The data model implementation is class IlvDefaultSDMModel with user-defined types (tags) read from the XML file.
To load an XML file and display its contents in Java code, use:
diagrammer.getEngine().setXMLFile("file:example.xml"); |
For details of the advanced uses of XML, see Handling XML Data Files in Java.
You can load a JDBC-compliant database into the Designer without needing to write any Java code. For an example, see Loading Data From a Database in Using the Designer.
The data model implementation is class IlvJDBCSDMModel with no user-defined types.
You can load data from a flat file, for example, a comma-separated values (CSV) file, into the Designer without needing to write any Java code. For an example, see Loading Data From a Flat File in Using the Designer.
The data model implementation is class IlvDefaultSDMModel with no user-defined types.
If you use the in-memory data source, you effectively load a basic data model and you can extend it in the Designer without needing to write any Java code.
The initial data model implementation is class IlvDefaultSDMModel and you can add user-defined types in the Designer.
If you have written custom data model classes, you can assign the data model to the SDM engine of an IlvDiagrammer instance as follows:
IlvSDMModel sdmModel = new MyModel(); diagrammer.getEngine().setModel(sdmModel); |
The data model implementation is user-defined.
See also Using a Custom Data Model in the Designer.
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |