Perforce JViews TGO Sample: Equipment Component - Editor


Description

The Equipment Editor allows you to generate an equipment view through drag-and-drop graphical interactions.

How to Use the Sample

This section shows you how to use the features of the Equipment Editor through a set of typical use cases.

Case 1 - Building an Equipment from Scratch

This section shows you how to:

Each task is explained in more detail below:

Case 2 - Editing an Existing Equipment

This section shows you how to edit an existing equipment file.

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-editor.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

The graphical user interface of the Equipment Editor as supplied in Perforce JViews TGO is made up of the following elements:

The Equipment Editor Menu Bar

The menu bar includes the File, Edit, View, Background, Palette, Window and Help menus. Some of the commands of these menus can be accessed through the toolbars. You can access the menu commands either with the mouse or by using a keyboard shortcut. The appropriate key sequence is shown beside each menu option.

File Menu

The file menu contains the following commands:

Edit Menu

The Edit menu contains the following commands:

View Menu

The View menu contains the following commands:

Background Menu

The Background menu contains the following commands:

Each equipment buffer view can have a background loaded or removed through the Background menu.

Palette Menu

The Palette menu contains the following commands:

Window Menu

The Window menu contains the following commands:

Help Menu

The Help menu contains the following commands:

The Equipment Editor Toolbar

The main toolbar is displayed at the top of the editor, below the menu bar. It is dockable, which means that you can detach it by dragging and dropping (point at the left border of the toolbar to drag it).

The toolbar provides shortcut buttons for the following menu commands:

The Equipment Editor Views

The Equipment Editor contains four views: a palettes view, a hierarchy view, an object attributes view, and a buffer view. The first two views display in the top left part of the editor, and can be switched by clicking the corresponding tabs. The object attributes view displays in the bottom left part of the editor. The buffer view displays in the right part; it is a floating window.

Palettes

The Palettes tab itself contains four tabbed panes corresponding to the categories of objects that you can drag and drop into the buffer view to build your equipment. By default, there are four palettes: Containers (shelves, card carriers), Cards, Ports, and LEDs. You can create your own palettes, add them as new tabs or replace the default ones.

Click a tab to display the corresponding set of equipment objects. You can use any of these objects by simply dragging and dropping them into the buffer view.

Object Attributes

The bottom left part of the editor displays the identifier, type and attributes of the selected object.

The editor creates unique identifiers, but you can modify them to make the connection to a back-end application easier. To change the identifier of a selected object, enter the new identifier in the Persistent ID text box, and press Return. The new identifier will be saved with the buffer view.

The class of the selected object is indicated in the Business Class combo box. This combo box shows all the classes that are compatible with the selected object. To import custom business classes, you can either add your business class definitions to the deployment descriptor so that they are loaded when the Equipment Editor is launched, or you can import the class definitions dynamically through the menu item File->Import Business Classes. Once your business classes are available in the Equipment Editor, all objects created can have their classes changed.

The attributes of the selected object and their values display in a two-column table. When you change an attribute value, the selected object in the buffer view is automatically updated.

Hierarchy View

The hierarchy view displays the hierarchical structure of the equipment displayed in the active buffer view. An equipment is a potential container of several objects with different levels of embedding. This containment hierarchy is illustrated in the form of a tree.

The tree is a visual representation of the structure of the equipment in the buffer view. It displays the name of the objects with an icon representing their type. Among the icons are the following:

The selection in the tree reflects the selection in the active buffer view.

Buffer View

The buffer view is a floating window in which you model your equipment. This is actually your workspace. You can have several buffer views open at a time.

In a buffer view, you can:

The following set of interactors is associated with the buffer view.

Click interactors (icons) in the toolbar to:

Equipment Editor Features

This section describes the following main features of the equipment editor:

Equipment objects

The objects you can use to build an equipment are: shelves, card carriers, cards, ports and LEDs.

Shelves

Shelves are resizable objects which cannot be inserted in another object. When a shelf is filled with objects, you have to click the very edge of the shelf to select it. You can also select objects through the hierarchy view.

Shelves have the following attributes:

The slot sizes attribute has a dedicated editor associated with it which you can display by clicking the attribute value in the attributes table. This attribute includes the number of slots and their horizontal and vertical sizes as illustrated in the following figure:

In this editor, you can change the number of slots along the x and y axes of the shelf, either by clicking the up and down arrows at the right side of the corresponding fields, or by typing an integer in the fields. The number of slots you specify determines the number of rows in the tables of the editor. In both tables, you may change the size of each slot individually.

When you remove slots, their sizes are saved. If you subsequently add slots, the saved slot sizes will be applied in the first place. Once all the saved sizes have been reused, the last saved size will be applied to any additional slot.

Card Carriers

Card carriers are resizable objects which can be inserted in shelves and card carriers. They contain slots in which you can place cards. The slots all have the same size. This size depends on the number of slots and the overall size of the card carrier.

Card carriers have the following attributes:

You can edit the spanning of a card carrier, that is, the space over which the card carrier extends. In the buffer view, right-click the card carrier to display a pop-up menu with the command Span Editing. This command displays the following dialog:

This dialog allows you to change the spanning of the card carrier over the x and y axes. For example, if you specify an X Span of 0.3 and a Y Span of 2, you get the following result:

Cards

Cards are resizable objects that can be inserted in shelves and card carriers. They can carry ports and LEDs. If this is the case, the ports and LEDs are positioned relative to the origin of the card. These objects keep their position when the card is resized and thus may be drawn outside of the card. They remain part of the card, though.

Cards have the following attributes:

Like a card carrier, you can edit the spanning of a card by right-clicking the card in the buffer view. For more information, see Card Carriers.

Ports

Ports are nonresizable objects that can be inserted in cards. They have the following attributes:

LEDs

LEDs can be inserted in cards. They have the following attributes:

Palettes

You can perform several operations on the Equipment Editor palettes.

Importing a new palette

To import a new palette, choose Import a New Palette from the Palette menu.

  1. Select an XML file that describes an equipment or a set of objects.
  2. Click Import.

A new palette is added to the existing set of palettes. The name of the palette displayed in the editor is the name of the XML file without the extension. If a palette with the same name already exists, a unique number is added to the name of the palette.

Renaming a palette

To rename a palette, choose Rename Palettes from the Palette menu.

  1. Select the palette to be renamed.
  2. Click Rename. (The name of the palette must be unique).
  3. Click OK to confirm your changes or Cancel to abort them.
Adding or removing a palette

To add or remove a palette, choose Organize Palettes from the Palette menu.

Click OK to confirm your changes or Cancel to abort them.

Adding new objects to a palette

You can add objects from the active buffer view to any palette, except to the default palettes:

  1. Click the palette in which you want to add objects.
  2. Select one or several objects in the buffer view.
  3. Choose Add Objects from the Palette menu.
Removing an object from a palette

You can remove objects from a palette, except from the default palettes:

  1. Click the palette from which you want to remove objects.
  2. Select the objects in the palette.
  3. Choose Remove Objects from the Palette menu.

If you have an object made up of several base items and you want to keep a lower level item, drag and drop this object in the buffer view, then add it to a palette as explained in Adding new objects to a palette. Finally, remove the higher level object in the palette.

In the case of a complex object, you have to click at the very edge of the top-level object to select it.

Saving palettes

When you quit the application, the user-defined palettes are saved in XML format. The name of the XML file is the name you gave to the palette when you added it or when you renamed it, followed by the .xml extension.

By default, the user-defined palettes are saved to data/palettes. The editor uses the resource file userPalettes.ini to save the list of user-defined palettes. The name of this file is given by the property equipmentEditor.palette.user.resources that you can modify in the file resources/properties/EquipmentEditorConfig.properties. Note that the editor uses the property equipmentEditor.palette.path to find the resource file, which must be in the same directory as the XML file that describes the palettes.

The path to save the default palettes is given by the property equipmentEditor.palette.default.resources that you can modify in the file resources/properties/EquipmentEditorConfig.properties.

Background

You can place a background behind the equipment you are designing in the buffer view. The supported formats for a background file are: jpg, png, and ivl.

A background cannot be selected nor edited.

Removing a Background

To remove a background, select Remove Background from the Background menu.

Customization

The paths to the labels and icons used by the editor can be customized through a property file located in resources/properties/EquipmentEditorMessages.properties.

You can modify the property file to use your own labels and icons.

When several persons use the same installation, it is recommended that you override the property file with a customized copy named <username>.properties that should be put in the directory resources/properties. This is mainly to avoid conflicts when using customized palettes.

For example, if your username is jsmith, you should create:

This saves your palettes in data/palettes/jsmith and avoids conflicts with other users.

Equipment Files

The editor uses a specific format (.eqt) to save the equipment displayed in a buffer view. In fact, when you save a buffer view, four files are created:

You can also load and save .xml files describing equipment. When you save such a file, you will be asked if you want to save it as an XML file (you will lose configuration information such as the background) or to create an Equipment Editor file (.eqt).

Installation Directory

The Equipment Component - Editor sample is installed here.

Classes Involved

Source Files

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