com.aelitis.azureus.ui.swt.browser
Class BrowserContext

java.lang.Object
  extended by com.aelitis.azureus.core.messenger.ClientMessageContextImpl
      extended by com.aelitis.azureus.ui.swt.browser.BrowserContext
All Implemented Interfaces:
ClientMessageContext, EventListener, org.eclipse.swt.events.DisposeListener, org.eclipse.swt.internal.SWTEventListener

public class BrowserContext
extends ClientMessageContextImpl
implements org.eclipse.swt.events.DisposeListener

Manages the context for a single SWT Browser component, including listeners and messages.

Author:
dharkness

Nested Class Summary
static interface BrowserContext.loadingListener
           
 
Nested classes/interfaces inherited from interface com.aelitis.azureus.core.messenger.ClientMessageContext
ClientMessageContext.torrentURLHandler
 
Field Summary
protected  boolean wiggleBrowser
           
 
Constructor Summary
BrowserContext(String _id, BrowserWrapper _browser, org.eclipse.swt.widgets.Control _widgetWaitingIndicator, boolean _forceVisibleAfterLoad)
          Creates a context and registers the given browser.
 
Method Summary
 void addListener(BrowserContext.loadingListener l)
           
 void addMessageListener(BrowserMessageListener listener)
          Accesses the context associated with the given browser.
 boolean allowPopups()
           
 boolean executeInBrowser(String javascript)
           
 void fillWithRetry(String s, String s2)
           
 Object getBrowserData(String key)
           
 long getContentNetworkID()
           
protected  String[] getContentTypes(String event_location, String _referer)
           
 boolean isPageLoading()
           
protected  boolean mayExecute(String javascript)
           
protected  boolean maySend(String key, String op, Map params)
           
protected  boolean openTorrent(BrowserWrapper browser, org.eclipse.swt.browser.LocationEvent event)
           
 boolean sendBrowserMessage(String key, String op)
          Sends a message to the JavaScript message dispatcher in the page.
 boolean sendBrowserMessage(String key, String op, Collection params)
           
 boolean sendBrowserMessage(String key, String op, Map params)
          Sends a message to the JavaScript message dispatcher in the page.
 void setAllowPopups(boolean allowPopups)
           
 void setAutoReloadPending(boolean is_pending, boolean aborted)
           
 void setBrowserData(String key, Object value)
           
 void setContentNetworkID(long contentNetworkID)
           
protected  void setPageLoading(boolean b, String url)
           
 void setTorrentURLHandler(ClientMessageContext.torrentURLHandler handler)
           
 void setWiggleBrowser(boolean wiggleBrowser)
           
 void widgetDisposed(org.eclipse.swt.events.DisposeEvent event)
           
 
Methods inherited from class com.aelitis.azureus.core.messenger.ClientMessageContextImpl
debug, debug, getDispatcher, getID, removeMessageListener, removeMessageListener, setMessageDispatcher
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wiggleBrowser

protected boolean wiggleBrowser
Constructor Detail

BrowserContext

public BrowserContext(String _id,
                      BrowserWrapper _browser,
                      org.eclipse.swt.widgets.Control _widgetWaitingIndicator,
                      boolean _forceVisibleAfterLoad)
Creates a context and registers the given browser.

Parameters:
id - unique identifier of this context
browser - the browser to be registered
Method Detail

openTorrent

protected boolean openTorrent(BrowserWrapper browser,
                              org.eclipse.swt.browser.LocationEvent event)

getContentTypes

protected String[] getContentTypes(String event_location,
                                   String _referer)

setPageLoading

protected void setPageLoading(boolean b,
                              String url)
Parameters:
b -
url -
Since:
3.1.1.1

setTorrentURLHandler

public void setTorrentURLHandler(ClientMessageContext.torrentURLHandler handler)
Specified by:
setTorrentURLHandler in interface ClientMessageContext

setAutoReloadPending

public void setAutoReloadPending(boolean is_pending,
                                 boolean aborted)

fillWithRetry

public void fillWithRetry(String s,
                          String s2)

addMessageListener

public void addMessageListener(BrowserMessageListener listener)
Accesses the context associated with the given browser.

Specified by:
addMessageListener in interface ClientMessageContext
Overrides:
addMessageListener in class ClientMessageContextImpl
Parameters:
browser - holds the context in its application data map

getBrowserData

public Object getBrowserData(String key)
Specified by:
getBrowserData in interface ClientMessageContext

setBrowserData

public void setBrowserData(String key,
                           Object value)
Specified by:
setBrowserData in interface ClientMessageContext

sendBrowserMessage

public boolean sendBrowserMessage(String key,
                                  String op)
Description copied from interface: ClientMessageContext
Sends a message to the JavaScript message dispatcher in the page.

Specified by:
sendBrowserMessage in interface ClientMessageContext
Parameters:
key - identifies the listener to receive the message
op - identifies the operation to perform

sendBrowserMessage

public boolean sendBrowserMessage(String key,
                                  String op,
                                  Map params)
Description copied from interface: ClientMessageContext
Sends a message to the JavaScript message dispatcher in the page.

Specified by:
sendBrowserMessage in interface ClientMessageContext
Parameters:
key - identifies the listener to receive the message
op - identifies the operation to perform
params - optional message parameters

sendBrowserMessage

public boolean sendBrowserMessage(String key,
                                  String op,
                                  Collection params)
Specified by:
sendBrowserMessage in interface ClientMessageContext
Returns:

maySend

protected boolean maySend(String key,
                          String op,
                          Map params)

executeInBrowser

public boolean executeInBrowser(String javascript)
Specified by:
executeInBrowser in interface ClientMessageContext

mayExecute

protected boolean mayExecute(String javascript)

widgetDisposed

public void widgetDisposed(org.eclipse.swt.events.DisposeEvent event)
Specified by:
widgetDisposed in interface org.eclipse.swt.events.DisposeListener

setWiggleBrowser

public void setWiggleBrowser(boolean wiggleBrowser)

isPageLoading

public boolean isPageLoading()

addListener

public void addListener(BrowserContext.loadingListener l)

getContentNetworkID

public long getContentNetworkID()
Specified by:
getContentNetworkID in interface ClientMessageContext
Returns:

setContentNetworkID

public void setContentNetworkID(long contentNetworkID)
Specified by:
setContentNetworkID in interface ClientMessageContext

setAllowPopups

public void setAllowPopups(boolean allowPopups)

allowPopups

public boolean allowPopups()