Perforce JViews Diagrammer Code Example: Flag Renderer


Description

This sample shows how to extend the SDM renderers to set a decoration on a node.

How to Use the Code Example

How to Run the Code Example as an Application

This code example can be run as an application. The installation directory contains an executable JAR file, diagrammer-flag-renderer.jar, that allows you to execute the code example 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 code example 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 Perforce JViews.

Then, go to the installation directory of the code example and type:

ant run

Topics Covered

Detailed Description

This sample addresses a typical graphical need that can be answered with an SDM renderer. The need is to set a decoration on a node that will always be visible, for example, if the state of a model object changes and it needs to catch the user's attention. The renderer must display a flag on the node such that the flag remains visible even if the object is hidden by another graphic object.

In this sample, the state property is used to indicate when a new decoration should be added to the node representation. When the value of the property is normal, the representation is simply a shape and a label. If the value of the state property is changed to error or warning, a new decoration is added on top of the object to catch the user's attention. You can modify the value of this property by selecting a node, and editing the property using the property sheet.

Installation Directory

The Flag Renderer code example is installed here.

Classes Involved

Source Files

Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All rights reserved. Legal terms.