Previous Next

Bean Works Architecture

Selection and command classes

The framework provides abstract base classes for both selections and commands, as well as an extensible mechanism for executing and maintaining commands issued while a component is running. This figure shows the primary classes that define the use of selections and commands:

Selections

ModelSelection provides the abstraction for all selection classes. You create a selection for your component by extending ModelSelection so that it can contain specifications that are appropriate to the type of data in your component's model, and can provide access to the selected data. The selection should be able to specify all data in the model, no data (an empty selection), or subsets of data as appropriate.

ModelSelection also implements interfaces that allow it to be copied and to be used as the vehicle for data transfer between your component's model and the clipboard.

Commands

Command provides the abstraction for all command classes. You extend Command to create command classes that perform specific changes on target data, often specified by a ModelSelection object. To create a serially undoable command, you override Command methods called by the framework to do, undo, and redo the command. You can also create commands that cannot be undone.

The command processor

The framework provides an abstract class, ICommandProcessor, that defines the methods called by a component controller to do, undo, and redo commands. CommandProcessor is an implementation of ICommandProcessor that supports unlimited undo and redo by maintaining a command log of all serially undoable commands that are executed. This is the default command processor used by subclasses of ComponentController.

You don't need to work with the command processor classes directly unless you want to create your own command processing mechanism.


Previous Next

Copyright © Taligent, Inc. 1996 - 1997.
Copyright
© IBM Corporation 1996 - 1997.
All Rights Reserved.