Perforce JViews Framework Code Example: Keyboard Selection
Description
This sample shows how to select nodes and links in a grapher by using the keyboard.
How to Use the Code Example
- The application displays a grapher containing some nodes, links, and nested subgraphers. You can select nodes and links by clicking them.
- Press the Tab key to cycle through the GUI elements and the nodes of the subgrapher. With each key press, a different GUI element gets focus or a different node is selected.
- Press Shift+Tab to cycle backwards.
- When the focus is inside the view and an object is selected, hold down the Ctrl key and press Tab twice to move the focus to the GUI elements.
- Select a node inside the view and press the F and B keys to cycle the selection inside the view. The focus does not leave the view, as it does when you press the Tab key.
- The GUI elements in the upper left panel allow specification of the objects available for selection by pressing the Tab, F, and B keys.
- The GUI elements in the upper right panel allow specification of the selection order and whether the selection cycle descends into subgraphs.
-
The selection order can be:
- unordered - The conventional order of the objects in the manager is used.
- x then y - The objects are selected in ascending order based on the values of their x coordinates. Objects with the same x coordinate are selected in ascending order based on the values of their y coordinates.
- y then x - The objects are selected in ascending order based on the values of their y coordinates. Objects with the same y coordinate are selected in ascending order based on the values of their x coordinates.
- nested then x - Objects of the same subgraph are selectable before an object outside the subgraph is selected. Within the same subgraph, the objects are selected in ascending order based on the values of their x coordinates. Objects with the same x coordinate are selected in ascending order based on the values of their y coordinates.
- nested then y - Objects of the same subgraph are selectable before an object outside the subgraph is selected. Within the same subgraph, the objects are selected in ascending order based on the values of their y coordinates. Objects with the same y coordinate are selected in ascending order based on the values of their x coordinates.
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,
keyboardsel.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
- How to use the keyboard to select objects
Installation Directory
The Keyboard Selection code example is installed here.
Classes Involved
- ilog.views.accelerator.IlvCycleSelectAccelerator
- ilog.views.IlvGrapher
- ilog.views.IlvManagerView
- ilog.views.IlvLinkImage
- ilog.views.IlvAccelerator
- ilog.views.IlvDefaultManagerFrame
- ilog.views.interactor.IlvSelectInteractor
- ilog.views.util.swing.IlvJComboBox