| Developing with the SDK > Introducing the SDK > The Diagram Component > The Data Source |
The Data Source |
INDEX
PREVIOUS
NEXT
|
The role of the data source is to load the data to display in the diagram, and possibly write back the data if it has been modified.
There are the following predefined types of data source: XML data sources, which read data from an XML file and JDBC data sources, which read data from a database through the JDBC API.
The data source is represented by one of the following classes in the package ilog.views.diagrammer.datasource:
These classes are subclasses of IlvDiagrammerDataSource.
An XML file (IlvXMLDataSource) can be in the required format, which is called diagram format, or in a custom format, in which case XSLT files must be supplied for reading and writing.
A database (IlvJDBCDataSource) must be JDBC-compliant. SQL is used to read and write data.
Extra types of data source can be defined to read data from other sources.
To set the data source of a diagram component, you can use the setDataSource method. Code Sample 1.1 shows how to use this method.
IlvXMLDataSource dataSource = new IlvXMLDataSource(); dataSource.setDataURL(new URL("file:example.xml")); diagrammer.setDataSource(dataSource); |
Alternatively, you can set the data source and the style sheet at the same time by loading a project file (see The Project).
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |