talx.controller
Class CommandInterceptor
java.lang.Object
talx.controller.CommandInterceptor
- All Implemented Interfaces:
- ControllerConstants, GUIStateConstants, Interceptor, TALFeature
- public class CommandInterceptor
- extends java.lang.Object
- implements Interceptor, ControllerConstants, GUIStateConstants
Interceptor to handle basic system commands.
The controller automatically places this interceptor at the bottom
(ie last) of the interceptor stack. Thus, a given action passes through
all other interceptors, then this interceptor, then the current action handler.
| Fields inherited from interface talx.model.GUIStateConstants |
ACTIVE_COMMANDS, ARCHIVE_MESSAGE, CHOICE_DIALOG, COMPOSE_FOCUS, COMPOSE_WINDOW, COMPOSER_CAPTION, COMPOSER_DIRTY, CONFIRM_DIALOG, CURRENT_PEOPLE, CURRENT_PLAYER, DEFAULT_MESSAGE, DIALOG_FOCUS, DIALOG_TEXT, INBOX_FOCUS, INBOX_MAIL_COUNTS, INBOX_MAIL_COUNTS_ANSWERED, INBOX_MAIL_COUNTS_NEW, INBOX_PANEL, INBOX_PLAYER_CAPTIONS, NO_CHANGE, NO_MESSAGE, NO_PEOPLE, NO_PERSON, NO_PLAYER, READER_CAPTION, READER_FOCUS, READER_HEADERS, READER_WINDOW, STATE_ABBR, STATE_CONST, STATE_DESC |
|
Method Summary |
boolean |
claim(java.awt.event.ActionEvent ev,
Controller c)
Handles basic system commands. |
void |
initialize(Controller c)
This method will never actually get called, but it is a contractual obligation. |
void |
release()
This method will never actually get called, but it is a contractual obligation. |
static boolean |
willSave(java.lang.String command)
Returns true if the given command string will cause this interceptor to save state. |
static boolean |
willStop(java.lang.String command)
Returns true if the given command string will cause the controller to shut down. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TEST_MESSAGE_HEADER
public static final java.lang.String TEST_MESSAGE_HEADER
- See Also:
- Constant Field Values
claim
public boolean claim(java.awt.event.ActionEvent ev,
Controller c)
throws ActionVetoException
- Handles basic system commands.
This interceptor is automatically loaded by the controller.
It handles the following basic action commands
(found in ControllerConstants):
- Logout - saves the current state and shuts down the system
- Save - Writes the current state out to a file
- Exit - Shuts down the system without saving the state
- Stop - Shuts down the system without removing the lock file.
this will cause any saved state to be discarded on start-up.
In addition, this class correctly routes local and remote game
actions to the proper game handler.
Finally, this interceptor vetoes any composer word, sentence or edit events.
Thus, interceptors will have access to composer actions, by controller states
will not.
- Specified by:
claim in interface Interceptor
- Returns:
- true to claim the action, false otherwise.
- Throws:
ActionVetoException - to veto the action.
willStop
public static boolean willStop(java.lang.String command)
- Returns true if the given command string will cause the controller to shut down.
This is provided for other interceptors to use to decide whether to veto an action
before it reaches this interceptor. Since this interceptor is always last in the
chain, other interceptors will always see commands before this does. Before the
system quits, the interceptor's release method will be called. However, that will
occur after the state is saved. Some interceptors may wish to alter the state first
before allowing a shutdown.
Note: Under no circumstances should an interceptor veto a command that
returns true from this method.
willSave
public static boolean willSave(java.lang.String command)
- Returns true if the given command string will cause this interceptor to save state.
This is provided for other interceptors to use to decide whether to veto an action
before it reaches this interceptor. Since this interceptor is always last in the
chain, other interceptors will always see commands before this does. However, some
interceptors may place the system in a state that should not be saved. For example,
if the current state depends on some unrecoverable internal state of the interceptor,
then it is appropriate for the interceptor to censor all state-saving actions.
Since the saved state may later be restored without a given interceptor, interceptors
that alter the state to make it unresponsive to the handler system, must stop such
states from being written out.
initialize
public void initialize(Controller c)
- This method will never actually get called, but it is a contractual obligation.
- Specified by:
initialize in interface Interceptor
release
public void release()
- This method will never actually get called, but it is a contractual obligation.
- Specified by:
release in interface TALFeature
© 2001-2005 University of Oregon.
Eugene OR 97403, U.S.A. All Rights Reserved.