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 Object implements BrowserMessageListener
Accepts and handles messages dispatched from BrowserMessageDispatcher. Subclasses should use the message's operation ID and parameters to perform the requested operation.
  • Field Details

  • Constructor Details

    • AbstractBrowserMessageListener

      public AbstractBrowserMessageListener(String id)
      Stores the given context for accessing the browser and its services.
      Parameters:
      context - used to access the browser
  • Method Details

    • debug

      protected void debug(String message)
      Displays a debug message tagged with the listener ID.
      Parameters:
      message - sent to the debug log
    • debug

      public void debug(String message, Throwable t)
      Displays a debug message and exception tagged with the listener ID.
      Parameters:
      message - sent to the debug log
      t - exception to log with message
    • getContext

      public ClientMessageContext getContext()
      Returns the context for this listener.
      Specified by:
      getContext in interface BrowserMessageListener
      Returns:
      listener's context
    • getId

      public String getId()
      Returns the unique ID for this listener.
      Specified by:
      getId in interface BrowserMessageListener
      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 interface BrowserMessageListener
      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 interface BrowserMessageListener
      Parameters:
      context - the new context for this listener