3D PLM Enterprise Architecture

User Interface - Frame

The CAA Command Model

Understanding commands and how they work
Technical Article

Abstract

This article introduces the commands as the key objects allowing for CAA application interactivity.


Why Commands?

The high-level interactivity proposed by CAA requires that the basic interactive mechanisms be processed efficiently and consistently. These interactive mechanisms make it possible to:

The last two items illustrate a part of the Model View Controller (MVC) paradigm. CAA offers an object that provides these mechanisms as its behavior: the CAA command. It is the key object to make up the CAA User Interface Model interactive.

[Top]

What Is a CAA Command?

A CAA command is an instance of a class deriving from the CATCommand class and that supports these interactive mechanisms:

[Top]

CAA Command Typology

CAA commands fall into the following categories:

One-shot Commands

These are commands that are run from their beginning to their end from a single user interaction, with no means to stop them. Their dialog is limited to selecting the push item or the icon in a toolbar that represent them, and can display a confirmation dialog before proceeding.

Dialog Box Commands

These are commands that appear to the end user as a dialog box. The dialog box is the command itself, rather than being part of another command. The dialog sequence is limited to entering parameter values, or selecting options, and clicking push buttons such as OK, Apply, or Cancel.

State Dialog Commands

These are commands modeled as state machines. They can have several states. Each state lets the end user select objects, enter parameters, or choose options. Transitions depend on conditions set on what the end user selects, enters, or chooses. If these conditions are met, transitions trigger actions when skipping to the next state to progress to the command completion. Dialog boxes can be used to allow for parameter or option input.

[Top]

The Command Tree Structure

At run time, most of the CAA commands make a tree structure. Each command is usually created with a parent command (or father command), either passed as a parameter in the command class constructor, or using the CATCommand base class constructor, or possibly set or reset using the CATCommand SetFather method. This parent has itself a parent, and so on up to the root of the tree named the command selector, a specific command that manages the availability and life cycle of dialog commands. Commands created without a parent, that is with a NULL parent, have automatically the command selector as parent. The figure below is a view of a CAA session as its command tree structure.

Fig.1: The Command Tree Structure

This figure shows that:

The dialog command seen by the end user and that is currently running is named the active command. It is said to have the focus, one command being active at a given instant. The command selector manages the focus and gives it to, or takes it from, the dialog commands that the end user selects.

CAAAfrCommandTree2.gif (21264 bytes)

The command tree structure is used to convey end user intents from the object that detects the event up to the object that is able to process it. This is devoted to the Send/Receive notification protocol. For example, in a dialog box, the OK push button is a command created as a child of the dialog box itself, or as one of its subcommands, such as an invisible frame that groups the OK, Apply, and Cancel push buttons. By setting a callback on the push button, the dialog box expects to catch the end user intent when the end user will click OK. The method executed when such an event occurs is a member function of the dialog box class, declared as part of the callback.

The object selected by the end user can be something else than a command. For example, in a viewer, an object representation is usually selected. In this case, a manipulator, that is another form of a command, is associated with the representation.

[Top]

Command Running Mode and Command Focus and Lifecycle Management

The command selector manages the focus between the commands. It receives the notifications sent by commands below it to react to end user interactions that climb up along the command tree structure and that were not caught and processed by another command. It sends these notifications to the active command. To enable this management, a dialog command has a running (or start) mode. It can be set as:

CAAAfrCommandTree4.gif (3433 bytes) Exclusive: The active command is run in the exclusive mode. No other command exists on the command stack.
CAAAfrCommandTree3.gif (3776 bytes) Shared: The active command is run in the shared mode. Other commands can be deactivated on the command stack If any, they are all shared commands, except the lower command that may be exclusive.

A dialog command known by the command selector, that is created either as exclusive or shared, is managed by the command selector using the three methods Activate, Desactivate, and Cancel. As a general rule, these methods do the following:

The following table shows a summary of when these methods are called, and what they should contain, depending on the command type and running mode.

Command Type Possible Running Modes Activate Desactivate Cancel
One shot Exclusive Called when the end user selects the command. Should contain the body of the command and should request the command destruction (*) when the job completes Called when a shared command takes the focus. Should never be called if Activate includes a request to delete the command, since in this case, the command completes before the end user can select another command. Otherwise, should hide its temporary objects. Called when an exclusive command takes the focus. Never called if Activate includes a request to delete the command. Otherwise, should do a clean up of  the command temporary objects ans request the command destruction (*)
Undefined Never called Never called Never called
Dialog box Exclusive or Shared Called when the end user selects the command or when the command takes the focus again after being put on the command stack by a shared command. Shows the dialog box by default. The dialog box creation should be made in the constructor. Called when a shared command takes the focus. Hides the dialog box by default Called when an exclusive command takes the focus. Hides the dialog box box by default. Should request its destruction (*)
State dialog command Exclusive or Shared Called as soon as the end user selects the command or when the command takes the focus again after being put on the command stack by a shared command. Should not contain the body of the command, since this is the role of the BuildGraph method, but can contain the creation of interactive objects that can be useful to the command. Called when a shared command takes the focus. Should hide its temporary objects, such as dialog boxes, and delete interactive objects Called when an exclusive command takes the focus, or when the command completes. The command is automatically deleted

* Requesting a command destruction is made using the RequestDelayedDestruction method.

[Top]


In Short

The CAA commands are key objects to provide interactivity. They can have the one-shot, dialog boxes, or state dialog command type, depending from their base class. They can run in exclusive, shared, or undefined mode depending on their type.

Most of them build a tree structure at run time, used to convey notifications emanating from end user interactions, up to the appropriate command, that is the command able to perform the end user intent. The command at the top of the tree structure, named the command selector, sends orphan notifications to the active command and manages the command focus thanks to the Activate, Desactivate, and Cancel methods that each command should override.

[Top]


References

[1] Making Your Dialog Commands Available
[2] The Send/Receive Communication Protocol
[3] Getting Started with Dialog Boxes
[4] Getting Started with State Dialog Commands
[5] Understanding the Application Frame Layout
[Top]

History

Version: 1 [Nov 2001] Document created
[Top]

Copyright © 2001, Dassault Systèmes. All rights reserved.