talx x1.0.5

talx.controller.base
Class DialogInterceptor

java.lang.Object
  extended bytalx.controller.base.DialogInterceptor
All Implemented Interfaces:
GUIStateConstants, Interceptor, TALFeature
Direct Known Subclasses:
AbortInterceptor, DeleteInterceptor, SendInterceptor

public class DialogInterceptor
extends java.lang.Object
implements Interceptor, GUIStateConstants

Provides basic functionality for most interceptor classes that handle dialog behaviors. This class uses a tree structure to determine which dialogs to show and which actions to take in response. The nested DialogTree class represents this structure.


Nested Class Summary
protected  class DialogInterceptor.DialogActivator
          Class used by DialogTree to determine if a dialog should be shown.
 class DialogInterceptor.DialogRunner
          Class used by DialogTree to handle yes or no clicks.
protected  class DialogInterceptor.DialogTree
          class to manage sequences of dialogs to be shown.
 
Field Summary
protected  StringValueMap sequences
          The sequences to execute for the given commands.
 
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
 
Constructor Summary
DialogInterceptor()
           
 
Method Summary
 void cancelAction()
          Call this methods to cancel the action that started the current sequence of dialogs.
 boolean claim(java.awt.event.ActionEvent ev, Controller c)
          Handles dialogs listed in sequences.
 void initialize(Controller c)
          Called when the system starts up.
 void release()
          Called when the system shuts down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sequences

protected StringValueMap sequences
The sequences to execute for the given commands. Each key String is a possible command. When the claim method receives a command with an entry in this StringValueMap, it will attempt to cast the resulting entry value to a DialogTree and execute the appropriate sequence of commands.

Constructor Detail

DialogInterceptor

public DialogInterceptor()
Method Detail

claim

public boolean claim(java.awt.event.ActionEvent ev,
                     Controller c)
              throws ActionVetoException
Handles dialogs listed in sequences. Constructors of subclasses should initialize the sequences StringValueMap to contain all the command = dialog tree pairs to execute.

If a dialog is showing

Commands resulting from yes or no clicks

This method will handle yes or no clicks by calling the dialog tree's doYes or doNo methods. Each time a dialog is encountered in the tree, it's activator is checked. If it should not be shown, the default action is taken and tree traversal continues. If a dialog is encountered that should be shown, it is shown. If no encountered dialog should be shown, the root event is requeued. In any event, the yes or no command is claimed.

Other Commands

The command interceptor's willStop and willSave methods are consulted. If the command will cause the system to stop, this method first clears out the dialog from the GUIState so that any attempt to save state before stopping will result in the state sans dialog hoopla and as if the root action had never been generated. If the command will not stop, but will save state, this method vetoes it. If the action event was generated by a CommandFilter, this method lets it go. All other commands are vetoed.

If no dialog is showing

This method checks to see if the action is the one it suspended and then requeued. If so, it allows it through without activating the dialog tree. Otherwise, it looks for a dialog tree corresponding to the command. If one is found, this method traverses the tree. As each dialog is encountered, it's activator is consulted. If the dialog should show, the state is changed accordingly and the action is claimed. If the dialog should not show, its default action is taken and traversal continues. If no showable dialogs are encountered, the root action is left unclaimed.

Specified by:
claim in interface Interceptor
Returns:
true to claim the action, false otherwise.
Throws:
ActionVetoException - to veto the action.

initialize

public void initialize(Controller c)
Called when the system starts up. The default implementation does nothing.

Specified by:
initialize in interface Interceptor

release

public void release()
Called when the system shuts down. The default implementation does nothing.

Specified by:
release in interface TALFeature

cancelAction

public void cancelAction()
Call this methods to cancel the action that started the current sequence of dialogs.


talx x1.0.5

© 2001-2005 University of Oregon.
Eugene OR 97403, U.S.A. All Rights Reserved.