Rogue Wave JViews TGO Sample: TGO-SDM Adapter - Converter


Description

This sample shows how to use the TGO-SDM Adapter to convert a JViews TGO XML file into a JViews SDM XML file.

How to Use the Sample

The sample starts by opening a JViews TGO XML file and parsing its contents into a JViews TGO data source (ilog.cpl.datasource.IlpDataSource) to populate a JViews TGO Network component (ilog.cpl.IlpNetwork). At the same time, the data is processed by the TGO-SDM Adapter (ilog.cpl.sdm.IlpDefaultSDMAdapter) that populates a JViews Diagrammer SDM model (ilog.views.sdm.IlvSDMModel). The sample provides mechanisms to export the contents of the SDM model to an output file in JViews Diagrammer XML format.

The mapping between the JViews TGO attributes (ilog.cpl.model.IlpAttribute) and JViews Diagrammer SDM properties (ilog.views.sdm.IlvSDMModel.getObjectProperty) is defined by the interface converter.BindingSupport whose default implementation converter.util.DefaultAttributeBinding can easily be modified to support customized mappings.

The main frame displays a top menu bar with two menus:

In the center of the frame, you can see the JViews TGO view (to the left) and the JViews Diagrammer view (to the right) with their corresponding interactive menus.

Sample Quick Start:

After the JViews Diagrammer data has been saved in XML format, it can be imported in JViews Diagrammer tools such as the Designer for JViews Diagrammer to help style the data.

The sample includes an additional JViews Diagrammer styling file, diagrammer-sphere.css, that depends on the custom symbol palette diagrammer-sphere-palette.jar (located in the data directory). Both files were created with the Designer for JViews Diagrammer tool.

How to Run the Sample as an Application

This sample can be run as an application. The installation directory contains an executable JAR file, tgosdmadapter-converter.jar, that allows you to execute the sample with a double click from a file browser. Note that if you are using Internet Explorer, you can open the installation directory and execute the JAR file from the browser. This technique may not work in other Web browsers.

Alternatively, you can run the sample application from the command line. First check that the Ant utility is properly configured. If not, see the instructions on how to configure Ant for Rogue Wave JViews.

Then, go to the installation directory of the sample and type:

ant run

Topics Covered

Detailed Description


This sample illustrates how to use the TGO-SDM Adapter (ilog.cpl.sdm.IlpDefaultSDMAdapter) to convert business data (ilog.cpl.model.IlpObject) from a JViews TGO data source (ilog.cpl.datasource.IlpDataSource) to a JViews Diagrammer model (ilog.views.sdm.IlvSDMModel). When the data is in JViews Diagrammer format, it can be stored in a JViews Diagrammer XML file to be imported in a JViews Diagrammer application, such as the JViews Diagrammer Designer.

For the sake of simplicity, the main class converter.Main is responsible for building the GUI, handling file access (opening and saving XML and CSS files), as well as managing the JViews TGO data source to JViews Diagrammer model conversion. Some key methods are:

Although the sample always launches with a GUI, the converter.Main implementation also provides a basic headless mode where the conversion is applied automatically using command-line parameters. This mode is disabled by default but can be helpful for users who want to modify the sample to perform batched conversions.

The TGO-SDM Adapter is designed to map the JViews TGO data source hierarchy (parent-child relationships, link connectivity, for example) as well as the binding between the JViews TGO attributes (ilog.cpl.model.IlpAttribute) and the JViews Diagrammer SDM properties (ilog.views.sdm.IlvSDMModel.getObjectProperty).

The attribute binding is defined by an interface, converter.BindingSupport, that can be extended to provide customized binding between JViews TGO attributes and SDM properties. The default implementation (converter.util.DefaultAttributeBinding) only applies the standard binding that is available through ilog.cpl.sdm.IlpDefaultSDMAdapter.addDefaultBindings.

To be able to load and convert custom JViews TGO business data, the user must either modify the JViews TGO deployment descriptor file (deploy.xml) to parse the custom JViews TGO class declarations (ilog.cpl.model.IlpClass), or make sure that the class declaration is properly embedded in the JViews TGO XML file being parsed.

This sample is supported by the following data files:

Installation Directory

The TGO-SDM Adapter - Converter sample is installed here.

Classes Involved

Source Files

Copyright © Rogue Wave Software, Inc. 1997, 2015. All rights reserved. Legal terms.