uk.ac.essex.common.gui.impl
Class DefaultApplicationControllerImpl

java.lang.Object
  extended by uk.ac.essex.common.gui.impl.DefaultApplicationControllerImpl
All Implemented Interfaces:
ExceptionHandler, ApplicationController, DefaultApplicationController, Service

public abstract class DefaultApplicationControllerImpl
extends java.lang.Object
implements DefaultApplicationController, ExceptionHandler


Date: 15-Jul-2002


Field Summary
protected  ApplicationFrame applicationFrame
           
 
Constructor Summary
DefaultApplicationControllerImpl()
           
 
Method Summary
 void addActionHandler(java.lang.String name, ActionHandler actionHandler)
          Register an ActionHandler for this viewer.
 void destroy()
          Destroy the service
 ActionHandler getActionHandler(java.lang.String name)
           
 ApplicationFrame getApplicationFrame()
           
protected abstract  java.lang.String getCurrentFilePreferenceName()
           
protected  ApplicationFrameParameters getDefaultParameters(java.lang.String title)
           
 EditHandler getEditHandler()
           
 FileHandler getFileHandler()
           
protected abstract  java.lang.String getFileListPreferenceName()
           
 OptionsHandler getOptionsHandler()
           
 void initialise()
          Initialise the service
 java.lang.String[] listActionHandlers()
           
 void removeActionHandler(java.lang.String name)
          UnRegister an ActionHandler for this viewer.
 void restoreSessionFiles(java.lang.String fileListKey, java.lang.String currentFileKey, FileOpImpl fileOp)
          Restore a users session files.
protected  void saveOpenFiles(java.util.List<ApplicationFile> openFiles, java.lang.Object messageIfNotSaved)
           
protected  void saveSessionFiles(java.util.List<ApplicationFile> openFiles, java.util.prefs.Preferences preferences, java.lang.String fileListKey, java.lang.String currentFileKey)
          If any file has not been saved it will not be appended to the file list
 void setEditHandler(EditHandler editHandler)
           
 void setFileHandler(FileHandler fileHandler)
           
 void setOptionsHandler(OptionsHandler optionsHandler)
           
protected abstract  boolean shouldRestoreSession()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.essex.common.gui.DefaultApplicationController
getFileOp, restoreSession
 
Methods inherited from interface uk.ac.essex.common.exception.ExceptionHandler
handleException, handleThrowable
 

Field Detail

applicationFrame

protected ApplicationFrame applicationFrame
Constructor Detail

DefaultApplicationControllerImpl

public DefaultApplicationControllerImpl()
Method Detail

getCurrentFilePreferenceName

protected abstract java.lang.String getCurrentFilePreferenceName()

getFileListPreferenceName

protected abstract java.lang.String getFileListPreferenceName()

shouldRestoreSession

protected abstract boolean shouldRestoreSession()

restoreSessionFiles

public void restoreSessionFiles(java.lang.String fileListKey,
                                java.lang.String currentFileKey,
                                FileOpImpl fileOp)
Restore a users session files. This is all open files on the last invocation.

Parameters:
fileListKey - - The preference key containing the list of open files
currentFileKey - - The file that should be set to be current
fileOp - - The file op to handle loading the files

addActionHandler

public void addActionHandler(java.lang.String name,
                             ActionHandler actionHandler)
Register an ActionHandler for this viewer. This could be an action handler that manages all file actions, all help actions etc..

Specified by:
addActionHandler in interface DefaultApplicationController
Parameters:
name - - The name to associate the handler with
actionHandler - - The handler to add

removeActionHandler

public void removeActionHandler(java.lang.String name)
UnRegister an ActionHandler for this viewer.

Specified by:
removeActionHandler in interface DefaultApplicationController
Parameters:
name - - The name of the handler
See Also:
addActionHandler(java.lang.String, uk.ac.essex.common.action.ActionHandler)

listActionHandlers

public java.lang.String[] listActionHandlers()
Specified by:
listActionHandlers in interface DefaultApplicationController
Returns:

getActionHandler

public ActionHandler getActionHandler(java.lang.String name)
Specified by:
getActionHandler in interface DefaultApplicationController
Parameters:
name -
Returns:

getApplicationFrame

public ApplicationFrame getApplicationFrame()
Specified by:
getApplicationFrame in interface DefaultApplicationController
Returns:

getFileHandler

public FileHandler getFileHandler()
Specified by:
getFileHandler in interface DefaultApplicationController
Returns:

setFileHandler

public void setFileHandler(FileHandler fileHandler)
Specified by:
setFileHandler in interface DefaultApplicationController

getOptionsHandler

public OptionsHandler getOptionsHandler()
Specified by:
getOptionsHandler in interface DefaultApplicationController
Returns:

setOptionsHandler

public void setOptionsHandler(OptionsHandler optionsHandler)
Specified by:
setOptionsHandler in interface DefaultApplicationController

getEditHandler

public EditHandler getEditHandler()
Specified by:
getEditHandler in interface DefaultApplicationController
Returns:

setEditHandler

public void setEditHandler(EditHandler editHandler)
Specified by:
setEditHandler in interface DefaultApplicationController

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Service
Initialise the service

Specified by:
initialise in interface DefaultApplicationController
Specified by:
initialise in interface Service
Throws:
InitialisationException

destroy

public void destroy()
             throws DestructionException,
                    ShutdownCancelledException
Destroy the service

Specified by:
destroy in interface DefaultApplicationController
Specified by:
destroy in interface Service
Throws:
DestructionException
ShutdownCancelledException

getDefaultParameters

protected ApplicationFrameParameters getDefaultParameters(java.lang.String title)
Parameters:
title -

saveOpenFiles

protected void saveOpenFiles(java.util.List<ApplicationFile> openFiles,
                             java.lang.Object messageIfNotSaved)
                      throws ShutdownCancelledException
Parameters:
openFiles -
messageIfNotSaved -
Throws:
ShutdownCancelledException

saveSessionFiles

protected void saveSessionFiles(java.util.List<ApplicationFile> openFiles,
                                java.util.prefs.Preferences preferences,
                                java.lang.String fileListKey,
                                java.lang.String currentFileKey)
If any file has not been saved it will not be appended to the file list

Parameters:
openFiles - - The list of files currently open
preferences -