skip to main content
Gantt > Getting started > Introducing JViews Gantt > Developing with JViews Gantt > Populating the data model
 
Populating the data model
The data model is the source of the display: JViews Gantt shows activities, constraints, resources, and reservations to represent the data model with a look-and-feel defined in the style sheet. Without a data model, you cannot define a style sheet and you cannot create a chart.
Prototyping
If you are starting a project and you want to prototype your application rapidly, you will probably adopt the fastest way of populating the data model.
JViews Gantt offers a prebuilt in-memory data model that you can populate manually in the Designer or programmatically, or that can be populated from XML or text (CSV) files through data sources. Another prebuilt data model is available which can be populated from a database using the JDBC data source. If you can use JDBC, XML, or a flat file, you can directly import your data into the Designer.
There are two cases:
*If your application data is compliant with one of the JViews Gantt data sources, you can easily populate the data model using the data source facility in the Designer or by using the API.
*If your application data is not compliant with one of the JViews Gantt data sources, you should probably create a sample of your data in an XML file or in Microsoft® Excel, to emulate your data.
As soon as you can populate the data model, you can display the chart using the default style sheet. Then you can define your own styling to create business-specific representations.
If you use a flat file or data from a database that can be connected through JDBC, you must be able to map your data to the objects required by the default data model of Rogue Wave® JViews Gantt. See Data from a database.
If your data is in XML, it must be in the format of the Schedule Data eXchange Language (SDXL) or be made to conform to this format. See XML data.
If you have an in-memory data model, you need to be willing to replicate the data by copying it to the default data model. See In-memory data.
Otherwise, you must undertake some customization using the Java® API of the SDK for extending or developing the component. See Connecting to data in-memory in Developing with the SDK.
To be able to use the default data model, you need, at the very least, to be able to map to the object that represents activities.
Development
When you develop the operational application, you can still use the in-memory data model and one of the data sources provided with JViews Gantt. This may imply that your application can generate an XML file that JViews Gantt can read, or that you use XSLT to transform the XML format of your application.
If your application data is in an object model, you can implement the data model interface of JViews Gantt to map your object model closely to the JViews Gantt data model. This approach requires more development, but it prevents any data duplication, and ensures perfect synchronization between the data and the graphics.
Data from a database
If you can map your database data directly to the objects required by the data model in Rogue Wave JViews Gantt, you can write SQL queries and map to columns in the New Gantt Chart Wizard of the Designer. You must be able to map to the object representing activities at the very least. The other objects in the data model represent resources, constraints, and reservations. The mapping is to objects in the normal JDBC data model used to connect to a database in Rogue Wave® JViews Gantt
.
NOTE Rogue Wave® JViews Gantt provides predefined SQL queries for Microsoft® Project databases.
If you cannot map your database data directly to the Rogue Wave® JViews Gantt objects, you can still use the normal JDBC data model in the product, but you will have to map the objects yourself using Java® code in the SDK. See Developing with the SDK. Examples of database data that cannot be mapped directly are when activities are spread over several tables or when the data requires advanced mathematical calculations that cannot be handled in SQL.
XML data
If your XML data is already in the format of the Schedule Data eXchange Language (SDXL), you can use the normal Rogue Wave JViews Gantt reader and the default data model. You can do this through the New Gantt Chart Wizard in the Designer. The SDXL format is compatible with the format used by Rogue Wave® Gantt for .NET.
If your XML data is in a different format, you can use XSLT to put your data into SDXL format before you import the data. You can change the format using the New Gantt Chart Wizard in the Designer. Then you can use the normal reader and default model.
If the transformation of your XML data requires features that XSLT cannot handle, such as advanced math., you must implement your own reader in Java® code by extending the component in the SDK and plug the reader into the default model. See How to read an IlvGanttModel from an SDXL file using serialization in Developing with the SDK.
In-memory data
If you do not want to replicate the data from the in-memory model to the default model, you have the following choices:
*If your model is based on four Swing table models ( TableModel ), with one for activities, one for resources, one for constraints, and one for reservations, you can probably use the normal Gantt table model directly with a suitable mapping configuration.
*If your model is of a different type, you must write your own version of the data model used by Rogue Wave JViews Gantt to wrap your existing model.
If you are willing to copy your data, you can populate the default data model used in Rogue Wave® JViews Gantt with data from your in-memory data model.
All these solutions require using some Java® code in the SDK. See Connecting to data in-memory in Developing with the SDK.

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.