Connecting data sources to the diagram component
A diagram component (
IlvDiagrammer instance) has an associated SDM engine instance. By default, the SDM engine is connected to the default
SDM model.
There are several ways for you to load data into a diagram component:
XML data source
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.
JDBC data source
You can load a JDBC™-compliant database into the Designer without needing to write any Java code. For an example, see Importing data from a database in Using the Designer.
The data model implementation is class
IlvJDBCSDMModelwith no user-defined types.
Flat file data source
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 Importing data from a flat file in Using the Designer.
The data model implementation is class
IlvDefaultSDMModel with no user-defined types.
In-memory data source
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.
Custom data model
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.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.