Operations Dialog

The term "operation" refers to specialized callbacks that you can define using the Visual Java operations editor. Callbacks are typically implemented by adding custom code to the Group file. However, for simple callbacks, it is often more convenient to use a Visual Java operation than to add custom code to the group class. In many cases a Visual Java operation can automate all of the code generation for a callback. You may find that you can use the operations editor for all or most of your callbacks.

An operation consists of two parts: a filter and an action. The filter is "when," and the action is "what." For example, consider an operation that shows a window when the user clicks a button. In this case, the operation is defined for the button, with an event filter of "Action Event," and an action of "Show Window."

Operations must be associated with a specific component. Operations defined for a given component can be triggered only by events and messages that originate from the component itself. More than one operation can be defined for each component. Operations are ordered, so that if two operations match the same event, the operation closer to the beginning of the list is invoked first.

Editing Operations Using Visual Java

The operations editor has Insert and Delete buttons: If you accidentally delete operations, you can click Reset to reset the list to its state after the last Apply operation. Note that there is no undo operation, so you cannot undo changes you have applied.

Each time you click Insert, an operation is added to the list. Visual Java automatically assigns a unique name for each operation you create. You can edit that name in the Op Name field. Note that operations names must be unique within a group.

To create an operation:

  1. Click Insert to create the operation
  2. Click on the Filter button to bring up the filter editor. This allows you to modify the filter associated with the operations. Filters are described in Filter Editor.
  3. Click on the Action button to modify the operation's action. Actions are described in Action Editor.

As you add most filters and actions you can test them "live" in the layout window. For example, if you specify an operation that changes the foreground color of a label when a specific button is clicked, the label will change color in the layout window when the button is clicked.

Custom actions added in the Action dialog box are available only when running the application and are not available live in the layout panel.


See also:

Visual Java Overview
The Visual Menu
Visual Java Components
Laying Out GUI Interfaces
Generating Java Source Code
Adding Operations (Filters and Actions)
Visual Java Runtime Classes
Creating Menus
Adding Custom Components and Windows
Using Groups and Shadows (Basic)
Using Groups and Shadows (Advanced)
Visual Java API Documentation
Visual Java Runtime Packages
Class Hierarchy
Index of all Fields and Methods