sg.edu.nus.peer.management
Class AbstractEventDispatcher

java.lang.Object
  extended by sg.edu.nus.util.AbstractPooledSocketHandler
      extended by sg.edu.nus.peer.management.EventDispatcherAdapter
          extended by sg.edu.nus.peer.management.AbstractEventDispatcher
All Implemented Interfaces:
java.lang.Runnable, EventDispatcher, PooledSocketHandler
Direct Known Subclasses:
BootstrapEventDispatcher, ServerEventDispatcher

public abstract class AbstractEventDispatcher
extends EventDispatcherAdapter

This class extends AbstractPooledSocketHandler and is responsible for handling the incoming socket connection.

The incoming network event will be dispatched to the corresponding event processor and the response will be returned by the event processor.

Version:
1.0 2005-12-30
Author:
Xu Linhao

Constructor Summary
AbstractEventDispatcher(AbstractMainFrame gui)
          Construct an AbstractEventDispatcher.
 
Method Summary
 void addActionListener(ActionListener l)
          Add an instance of the ActionListener into the EventDispatcher.
 void handleConnection()
          Process the incoming socket connection.
abstract  void registerActionListeners()
          Register a set of ActionListeners to the PooledSocketHandler for the purpose of processing any incoming network events.
 void removeActionListener(ActionListener l)
          Remove an instance of the ActionListener from the EventDispatcher.
 void removeAll()
          Remove all ActionListener.
 
Methods inherited from class sg.edu.nus.util.AbstractPooledSocketHandler
processRequest, run, stop, stopAllHandlers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEventDispatcher

public AbstractEventDispatcher(AbstractMainFrame gui)
Construct an AbstractEventDispatcher.

Parameters:
gui - the main frame that contains the event manager
Method Detail

handleConnection

public void handleConnection()
Process the incoming socket connection.

Specified by:
handleConnection in interface PooledSocketHandler
Overrides:
handleConnection in class EventDispatcherAdapter

registerActionListeners

public abstract void registerActionListeners()
Register a set of ActionListeners to the PooledSocketHandler for the purpose of processing any incoming network events.

Specified by:
registerActionListeners in interface EventDispatcher
Overrides:
registerActionListeners in class EventDispatcherAdapter

addActionListener

public void addActionListener(ActionListener l)
Add an instance of the ActionListener into the EventDispatcher.

Parameters:
l - an instance of the ActionListener

removeActionListener

public void removeActionListener(ActionListener l)
Remove an instance of the ActionListener from the EventDispatcher.

Parameters:
l - an instance of the ActionListener

removeAll

public void removeAll()
Remove all ActionListener.