uk.ac.man.bioinf.apps.optionable
Class SaveableOptions

java.lang.Object
  |
  +--uk.ac.man.bioinf.apps.optionable.SaveableOptions
All Implemented Interfaces:
EventListener, OptionHandler, SystemListener
Direct Known Subclasses:
FileSaveableOptions

public abstract class SaveableOptions
extends Object
implements SystemListener, OptionHandler

SaveableOptions.java This class is used to initilise and save all of the necessary options required. This class is fully synchronized Created: Tue Feb 02 16:40:27 1999

Version:
$Id: SaveableOptions.java,v 1.16 2001/05/14 17:08:18 lord Exp $
Author:
Phillip Lord

Field Summary
 
Fields inherited from interface uk.ac.man.bioinf.apps.systemevents.SystemListener
NO_VETO, VETO_DUE_TO_ERROR, VETO_DUE_TO_USER_REQUEST
 
Constructor Summary
SaveableOptions(SystemEventProducer producer, OptionableExceptionHandler exHandler)
           
 
Method Summary
 void addOptionable(Optionable optionable)
          Add an optionable object.
protected  OptionableExceptionHandler getExceptionHandler()
           
abstract  InputStream getLoadStream()
           
abstract  OutputStream getSaveStream()
           
protected  void loadOptions()
           
 void removeOptionable(Optionable optionable)
          Remove the following optionable object from the list
 void requestOptionUpdate(Optionable optionable)
          Request that the optionable object set the the options of the optionable object via its setOptions method.
 void systemEventOccured(SystemEvent event)
          This is an event listener for system events.
 int systemListenerPriority()
          Some events (particularly shut downs) have to happen in a very specific order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaveableOptions

public SaveableOptions(SystemEventProducer producer,
                       OptionableExceptionHandler exHandler)
Method Detail

getExceptionHandler

protected OptionableExceptionHandler getExceptionHandler()

systemEventOccured

public void systemEventOccured(SystemEvent event)
Description copied from interface: SystemListener
This is an event listener for system events. All listeners should be signalled before the SystemEvent occurs. They should not return from this method until they are ready for that event to occur. An exception is thrown if the listener wishes to veto this system event. g

Specified by:
systemEventOccured in interface SystemListener
Parameters:
event - the system event occuring

systemListenerPriority

public int systemListenerPriority()
Description copied from interface: SystemListener
Some events (particularly shut downs) have to happen in a very specific order. This method provides a priority to allow this to happen. Those with the lowest priority are informed first. Any valid int value is acceptable. This interface does not provide the ability to set different priorities for different events. The same effect can be achieved by delegating the to a small class. This way a single object can register more than one listener object, and thus have different priorities for different events A listener should not change its priority. There is not guarentee when this value will be used.

Specified by:
systemListenerPriority in interface SystemListener

getSaveStream

public abstract OutputStream getSaveStream()
                                    throws IOException
IOException

getLoadStream

public abstract InputStream getLoadStream()
                                   throws IOException
IOException

loadOptions

protected void loadOptions()

addOptionable

public void addOptionable(Optionable optionable)
Description copied from interface: OptionHandler
Add an optionable object. On adding the Optionhandler should set itself as the OptionHandler for the optionable object, and call requestOptionUpdate also.

Specified by:
addOptionable in interface OptionHandler

removeOptionable

public void removeOptionable(Optionable optionable)
Description copied from interface: OptionHandler
Remove the following optionable object from the list

Specified by:
removeOptionable in interface OptionHandler
Parameters:
optionable -

requestOptionUpdate

public void requestOptionUpdate(Optionable optionable)
Description copied from interface: OptionHandler
Request that the optionable object set the the options of the optionable object via its setOptions method. This could be used for a variety of reasons, although the most obvious is a "revert to saved" option.

Specified by:
requestOptionUpdate in interface OptionHandler
Parameters:
optionable - the optionable object
See Also:
Optionable.setOptions(java.lang.Object)