talx x1.0.5

talx.controller
Interface Interceptor

All Superinterfaces:
TALFeature
All Known Implementing Classes:
BadTypingCorrection, CCInterceptor, CommandInterceptor, DialogInterceptor, ExportInterceptor, GossipInterceptor, ImportInterceptor, InboxClickCorrection, JournalInterceptor

public interface Interceptor
extends TALFeature

Interface for controller chain of responsibility objects.


Method Summary
 boolean claim(java.awt.event.ActionEvent ev, Controller c)
          Determines whether this feature is responsible for the action.
 void initialize(Controller c)
          Allows the interceptor to change the gui state.
 
Methods inherited from interface talx.feature.TALFeature
release
 

Method Detail

claim

public boolean claim(java.awt.event.ActionEvent ev,
                     Controller c)
              throws ActionVetoException
Determines whether this feature is responsible for the action. In response to this method, the feature can: Each feature can manage its own state in any way, including updating its state in response to unclaimed or vetoed actions. However, a feature may not update the volatile state without claiming the action. This is because the controller will not fire a changeFinishedEvent if the action is vetoed. Since, by not claiming the state, a feature leaves open the possibilty that another feature will veto it, it is only safe to update the state on actions that it claims. Once an action is claimed, the controller fires a changeFinishedEvent and stops propagating the action through the chain of responsibility.

Interceptors that wish to make some minor change to the gui state but not stop other effects from an action must make their change, refire the action via the controller's doAction() method, and then claim the action. Obviously, such interceptors must remember the action event to prevent them from reacting to it the next time.

Unlike ActionHandlers, which are stateless, Interceptors must manage their own state.

Returns:
true to claim the action, false otherwise.
Throws:
ActionVetoException - to veto the action.

initialize

public void initialize(Controller c)
Allows the interceptor to change the gui state. This method is called in the controller init method just after the controller restores the state but before it fires the first controller change event.


talx x1.0.5

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