com.ohrasys.app
Class AbstractAppView

java.lang.Object
  extended by com.ohrasys.app.AbstractAppView
All Implemented Interfaces:
AppControllerEventListener, java.awt.event.ActionListener, java.util.EventListener

public abstract class AbstractAppView
extends java.lang.Object
implements AppControllerEventListener

A basic application view which should be subclassed and specialized by specific application implementations.


Field Summary
protected  AppViewEventListener controller
          The controller that will listen to this application view
 
Constructor Summary
AbstractAppView()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          A method that dispatches all events received by this view.
protected  void notifyController(java.awt.event.ActionEvent event)
          Notifies the registered listener about the event.
protected abstract  java.awt.event.ActionEvent processEvent(java.awt.event.ActionEvent evt)
          The method that processes incoming events.
 void setController(AppViewEventListener controller)
          Registers ActionListener to receive events.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

controller

protected transient AppViewEventListener controller
The controller that will listen to this application view

Constructor Detail

AbstractAppView

public AbstractAppView()
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
A method that dispatches all events received by this view. This method should be overridden by subclasses.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
evt - The event to process.

setController

public void setController(AppViewEventListener controller)
                   throws java.util.TooManyListenersException
Registers ActionListener to receive events.

Parameters:
controller - The listener to register.
Throws:
java.util.TooManyListenersException - If more than one controller is associated with this view.

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The physical address of this instance.

processEvent

protected abstract java.awt.event.ActionEvent processEvent(java.awt.event.ActionEvent evt)
The method that processes incoming events.

Parameters:
evt - The incoming event from the controller
Returns:
The outgoing response event to the controller. This method should return null if no response is required. For instance if a the controller sends a request to change a model member variable but the new value is the same as the existing value, then no action need be taken, therefore no response should be generated.

notifyController

protected void notifyController(java.awt.event.ActionEvent event)
Notifies the registered listener about the event.

Parameters:
event - The event to be fired