Developing applications

Describes the user interface components provided in JViews Diagrammer and how they may be customized.

Describes the ready-made user interface components of JViews Diagrammer that help you develop your applications.

Explains how the user interface components can be customized.

User interface components

JViews Diagrammer comes with a set of classes designed to ease the development of Swing GUIs containing one or more IlvDiagrammer objects. These classes are contained in the package ilog.views.diagrammer.application.

Actions

The class IlvDiagrammerAction is a base class for Swing Actions that act on an IlvDiagrammer object. A set of predefined actions that call the main IlvDiagrammer methods is provided.

Toolbars

The class IlvDiagrammerToolBar is a Swing JToolBar that accepts a set of IlvDiagrammerAction instances. The subclasses IlvDiagrammerViewBar, IlvDiagrammerEditBar have predefined actions to control and edit the diagram.

The class IlvDiagrammerPaletteBar is designed to be used for editing diagrams. You can populate it with actions that create new nodes and links according to a set of sample objects.

Menus

The class IlvDiagrammerMenu is a Swing JMenu that accepts a set of IlvDiagrammerAction instances. The subclasses IlvDiagrammerFileMenu, IlvDiagrammerEditMenu, IlvDiagrammerOptionsMenu and IlvDiagrammerHelpMenu have predefined actions to control and edit the diagram, and to set options and give access to Help for the application. The class IlvDiagrammerMenuBar is a complete predefined menu bar containing all the predefined menus.

Overview

The class IlvDiagrammerOverview displays a reduced view of a diagram. You can use it with the zoom facility of a diagram component to control which part of a large diagram is visible.

Tree

The class IlvDiagrammerTree is a Swing JTree that displays the nodes and links contained in the diagram’s data model. The tree is an alternative way to view and select the objects in the diagram.

Property sheet

The class IlvDiagrammerPropertySheet is a Swing JTable that displays the properties of the selected object of the diagram. Use the property sheet to view and edit the properties of the objects in the data model.

Table

The class IlvDiagrammerTable is a Swing JTable that displays the properties of all the objects in the diagram. Use it to have a global view of the data model.

The Application class

The class IlvDiagrammerApplication is a complete Swing application that is built using the components in the Application package. This class lets you view (and optionally edit) one or more diagrams. The following code example shows how to launch the application by invoking the java command on this class.

Example   Launching a JViews Diagrammer application

java ilog.views.diagrammer.application.IlvDiagrammerApplication

The CLASSPATH environment variable must contain the JAR files for the JViews Diagrammer product and the JViews Framework package.

Customizing the user interface components

You can customize all the JViews Diagrammer user interface components through the style sheet. To enable styling of the user interface components, set the IlvDiagrammer property styleApplicationComponents to true.

The following code example shows how to customize a tree, a property sheet, and a table.

Example   Customizing user interface components

 

Diagrammer {

  styleApplicationComponents : "true"; // enable styling of

                                          // components.

}

DiagrammerTree {

  rootLabel : "My Graph"; // set label of root item in tree

}

node:DiagrammerTree {

  text : "@name"; // use "name" property as label of items in tree

}

node:DiagrammerPropertySheet:type {

  editable : "false"; // set "type" property for all nodes read-only

}

node.activity:DiagrammerTable {

  background : "yellow"; // set yellow background for "activity" nodes

                            // in table

}