Rogue Wave JViews Diagrammer Sample: Extending a Designer Project
Description
![]() |
This sample shows how to use the Rogue Wave JViews Diagrammer SDK to extend a project built with Rogue Wave JViews Diagrammer Designer.
How to Use the Sample
- Move the mouse pointer over the map, the latitude and longitude are displayed in the corresponding fields.
- Right-click a node or a link to show a contextual pop-up menu. Use the items in the menu to change the status of a node or display a property sheet.
How to Run the Sample as an Application
This sample can also be run as an application. The installation directory contains an executable JAR file, diagrammer-extension.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
- Extension of a Designer project using the Rogue Wave JViews Diagrammer SDK
- Adding interactions to a diagram
Detailed Description
This sample shows how to use the Rogue Wave JViews Diagrammer SDK to extend a project built with the Rogue Wave JViews Diagrammer Designer.
The sample first loads a project created using Rogue Wave JViews Diagrammer Designer. The project has a background bitmap representing a map of the USA with a network of cities connected by links. The cities have a size attribute and a status attribute. The links also have a size attribute. The project's style sheet defines rules so that the sizes of nodes and the widths of links depend on the size attribute. The colors of nodes depends on the status field.
The project file is stored in the data
sub-directory of this sample.
Note: The background map is only a bitmap and does not contain any projection information. Therefore, this sample does not use the Rogue Wave JViews Maps product; it can be run even if Rogue Wave JViews Maps is not installed. Consequently, the positions of the city nodes are saved as x/y coordinates in pixels. See the Integration with JViews Maps sample to learn how to use Rogue Wave JViews Maps to define real georeferenced diagrams with Rogue Wave JViews Diagrammer.
The sample adds two interactions to the Rogue Wave JViews Diagrammer Designer project:
- When you move the mouse cursor over the diagram, the latitude and longitude of the mouse position are displayed at the bottom of the window.
Note: In this sample, the latitude and longitude are computed using a linear function from the x and y positions. In a real application, you would need to use the Rogue Wave JViews Maps product to get the latitude and longitude using a geographic transformation.
To see the code for this interaction, see thecreateLatLongFields
method in this sample's source file. - Right-click the diagram to display a contextual pop-up menu.
- If you click on a node, the pop-up menu displays the name of the city and allows you to:
- Change the status of the city node.
- Display a dialog box with the node properties.
- If you click on a link, the pop-up menu displays the source and destination cities of the node, and allows you to display the link properties.
createPopupMenu
in this sample's source file. - If you click on a node, the pop-up menu displays the name of the city and allows you to:
Installation Directory
The Extending a Designer Project sample is installed here.
Classes Involved
-
ilog.views.diagrammer.IlvDiagrammer
The main class of the diagram component.
-
ilog.views.diagrammer.application.IlvDiagrammerPropertySheet
A component to view and edit the properties of the selected object in a diagram component.
-
ilog.views.swing.IlvPopupMenuManager
This class enables Swing pop-up menus on graphic objects in a manager view.
-
ilog.views.swing.IlvSimplePopupMenu
A simple version of a
JPopupMenu
component.
Source Files
-
DiagrammerExtension
The complete source of the sample.