com.aelitis.azureus.ui.swt.browser.msg
Class MessageDispatcherSWT

java.lang.Object
  extended by com.aelitis.azureus.ui.swt.browser.msg.MessageDispatcherSWT
All Implemented Interfaces:
BrowserMessageDispatcher

public class MessageDispatcherSWT
extends Object
implements BrowserMessageDispatcher

Dispatches messages to listeners registered with unique IDs.


Constructor Summary
MessageDispatcherSWT(ClientMessageContext context)
          Registers itself as a listener to receive sequence number reset message.
 
Method Summary
 void addListener(BrowserMessageListener listener)
          Registers the given listener for the given ID.
 void deregisterBrowser(BrowserWrapper browser)
          Detaches this dispatcher from the given Browser.
 void dispatch(BrowserMessage message)
          Dispatches the given message to the appropriate listener.
 BrowserMessageListener getListener(String id)
          Returns the listener with the given ID.
 void registerBrowser(BrowserWrapper browser)
           
 void removeListener(BrowserMessageListener listener)
          Deregisters the listener with the given ID.
 void removeListener(String id)
          Deregisters the listener with the given ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageDispatcherSWT

public MessageDispatcherSWT(ClientMessageContext context)
Registers itself as a listener to receive sequence number reset message.

Method Detail

registerBrowser

public void registerBrowser(BrowserWrapper browser)

deregisterBrowser

public void deregisterBrowser(BrowserWrapper browser)
Detaches this dispatcher from the given Browser. This dispatcher listens for dispose events from the browser and calls this method in response.

Parameters:
browser - Browser which will no longer send messages

addListener

public void addListener(BrowserMessageListener listener)
Registers the given listener for the given ID.

Specified by:
addListener in interface BrowserMessageDispatcher
Parameters:
id - unique identifier used when dispatching messages
listener - receives messages targetted at the given ID
Throws:
IllegalStateException - if another listener is already registered under the same ID

removeListener

public void removeListener(BrowserMessageListener listener)
Deregisters the listener with the given ID.

Specified by:
removeListener in interface BrowserMessageDispatcher
Parameters:
id - unique identifier of the listener to be removed

removeListener

public void removeListener(String id)
Deregisters the listener with the given ID.

Specified by:
removeListener in interface BrowserMessageDispatcher
Parameters:
id - unique identifier of the listener to be removed

getListener

public BrowserMessageListener getListener(String id)
Description copied from interface: BrowserMessageDispatcher
Returns the listener with the given ID.

Specified by:
getListener in interface BrowserMessageDispatcher
Parameters:
id - unique identifier of the listener to be returned
Returns:
the located listener

dispatch

public void dispatch(BrowserMessage message)
Description copied from interface: BrowserMessageDispatcher
Dispatches the given message to the appropriate listener.

Specified by:
dispatch in interface BrowserMessageDispatcher
Parameters:
message - holds the listener ID, operation ID and parameters