Class AbstractBrowserMessageListener
- java.lang.Object
-
- com.biglybt.core.messenger.browser.listeners.AbstractBrowserMessageListener
-
- All Implemented Interfaces:
BrowserMessageListener
- Direct Known Subclasses:
ConfigListener
,DisplayListener
,MetaSearchListener
,TorrentListener
,VuzeListener
public abstract class AbstractBrowserMessageListener extends java.lang.Object implements BrowserMessageListener
Accepts and handles messages dispatched fromBrowserMessageDispatcher
. Subclasses should use the message's operation ID and parameters to perform the requested operation.
-
-
Field Summary
Fields Modifier and Type Field Description protected ClientMessageContext
context
private java.lang.String
id
-
Constructor Summary
Constructors Constructor Description AbstractBrowserMessageListener(java.lang.String id)
Stores the given context for accessing the browser and its services.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
debug(java.lang.String message)
Displays a debug message tagged with the listener ID.void
debug(java.lang.String message, java.lang.Throwable t)
Displays a debug message and exception tagged with the listener ID.ClientMessageContext
getContext()
Returns the context for this listener.java.lang.String
getId()
Returns the unique ID for this listener.abstract void
handleMessage(BrowserMessage message)
Handles the given message, usually by parsing the parameters and calling the appropriate operation.void
setContext(ClientMessageContext context)
Sets the context for this listener.
-
-
-
Field Detail
-
context
protected ClientMessageContext context
-
id
private java.lang.String id
-
-
Method Detail
-
debug
protected void debug(java.lang.String message)
Displays a debug message tagged with the listener ID.- Parameters:
message
- sent to the debug log
-
debug
public void debug(java.lang.String message, java.lang.Throwable t)
Displays a debug message and exception tagged with the listener ID.- Parameters:
message
- sent to the debug logt
- exception to log with message
-
getContext
public ClientMessageContext getContext()
Returns the context for this listener.- Specified by:
getContext
in interfaceBrowserMessageListener
- Returns:
- listener's context
-
getId
public java.lang.String getId()
Returns the unique ID for this listener.- Specified by:
getId
in interfaceBrowserMessageListener
- Returns:
- listener's unique ID
-
handleMessage
public abstract void handleMessage(BrowserMessage message)
Handles the given message, usually by parsing the parameters and calling the appropriate operation.- Specified by:
handleMessage
in interfaceBrowserMessageListener
- Parameters:
message
- holds all message information
-
setContext
public void setContext(ClientMessageContext context)
Sets the context for this listener. Called by its dispatcher when attached.- Specified by:
setContext
in interfaceBrowserMessageListener
- Parameters:
context
- the new context for this listener
-
-