talx x1.0.5

talx.controller.extended
Class ExportInterceptor

java.lang.Object
  extended bytalx.controller.extended.ExportInterceptor
All Implemented Interfaces:
ControllerListener, java.util.EventListener, GUIStateConstants, Interceptor, TALFeature

public class ExportInterceptor
extends java.lang.Object
implements Interceptor, ControllerListener, GUIStateConstants

Manages the export button. For this interceptor to work, some button, presumeably on the reader, must be associated with the EXPORT_BUTTON_NAME. This class will make sure that the button is showing when appropriate and also respond to button clicks by exporting the current message. Messages are exported to the export folder given in the constructor parameter. The entire MIME-formatted message is saved as name_mm-dd-yy-hh-mm.msg. The inline text parts of the message are concatenated and saved as name_mm-dd-yy-hh-mm.txt. The attachment parts are saved under the filename for the attachment (minus any path structures). Other non-text inline parts are not saved except as part of the msg file.


Field Summary
static java.lang.String EXPORT_BUTTON_NAME
           
 
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
ExportInterceptor(java.lang.String location)
          Creates an export interceptor that saves exported message to the given directory.
 
Method Summary
 boolean claim(java.awt.event.ActionEvent ev, Controller c)
          Shows and hides the export button and responds to export button clicks.
 void controllerChange(ControllerChangeEvent ev)
          Sent when the controller wants the GUI to change state.
 void controllerChangeFinished(ChangeFinishedEvent ev)
          Decides whether to show or hide the export button.
 void controllerChangeVetoed(ActionVetoException ex)
          Sent when the system has decided not to transition on a user action.
 void initialize(Controller c)
          Allows the interceptor to change the gui state.
 void release()
          Releases all system resources held by this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXPORT_BUTTON_NAME

public static final java.lang.String EXPORT_BUTTON_NAME
See Also:
Constant Field Values
Constructor Detail

ExportInterceptor

public ExportInterceptor(java.lang.String location)
Creates an export interceptor that saves exported message to the given directory. If location is null, empty or cannot be created or written to, then this constructor will default to a directory called export_messages under the user's home directory. If neither the provided directory nor the default directory can be created or written to, then this class will suppress the export button.

Method Detail

claim

public boolean claim(java.awt.event.ActionEvent ev,
                     Controller c)
              throws ActionVetoException
Shows and hides the export button and responds to export button clicks.

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)
Description copied from interface: Interceptor
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.

Specified by:
initialize in interface Interceptor

release

public void release()
Description copied from interface: TALFeature
Releases all system resources held by this object. The general contract of pluggable features is that once their release method is called, they should be elligible for garbage collection. The exceptions to this are references to this object held in the ActionDispatcher and in the Transport model. Both of those objects are cleared by the system. However, in all other cases, if this object subscribed to a listener interface, it must unsubscribe in this method. This method should block until all object clean-up has been accomplished. This includes closing all open files, etc. Once the object has returned from the release method, the system may go down without further warning.

Specified by:
release in interface TALFeature

controllerChange

public void controllerChange(ControllerChangeEvent ev)
Description copied from interface: ControllerListener
Sent when the controller wants the GUI to change state.

Specified by:
controllerChange in interface ControllerListener

controllerChangeVetoed

public void controllerChangeVetoed(ActionVetoException ex)
Description copied from interface: ControllerListener
Sent when the system has decided not to transition on a user action.

Specified by:
controllerChangeVetoed in interface ControllerListener

controllerChangeFinished

public void controllerChangeFinished(ChangeFinishedEvent ev)
Decides whether to show or hide the export button. The export button will show provided the reply button is showing, the message is real, and the export directory is valid. A real message is any message that is not the default message and not the archive message.

Specified by:
controllerChangeFinished in interface ControllerListener

talx x1.0.5

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