Perforce JViews TGO Sample: Equipment Component - Image Renderer


Description

This sample shows how to create new card and port types using images and represent these new objects with the equipment component.

How to Use the Sample

The sample shows a typical equipment view with shelves, cards, ports and LEDs.

The Perforce JViews TGO equipment component provides multiple predefined modes of interaction. In this sample, the default behavior is to allow objects to be selected but not moved.

A pop-up menu is associated with the objects to add, acknowledge and clear alarms. This pop-up menu can be seen by clicking with the right mouse button on the object base.

How to Run the Sample as an Application

This sample can be run as an application. The installation directory contains an executable JAR file, equipment-image-renderer.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 Perforce JViews.

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

ant run

Topics Covered

Detailed Description

This sample shows how to create a JTGO equipment component and use its basic and advanced features.

The code specific to this sample is in the doSample method of the class imageRenderer.Main. This sample includes the following steps:

This sample differs from the basic sample in that it defines new card and port types that are graphically represented using images data/images/cards, data/images/ports and data/images/leds.

Finally, in this sample the state of some LEDs depends on the state of a corresponding port. The association between port and LED states is accomplished using an ilog.cpl.model.AttributeValueListener. The LED state is graphically represented using property foreground, which is set using CSS selectors that depend on attribute values.

Installation Directory

The Equipment Component - Image Renderer sample is installed here.

Classes Involved

Source Files

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