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, java.util.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(java.lang.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(java.lang.String javascript)
           
 void fillWithRetry(java.lang.String s, java.lang.String s2)
           
 java.lang.Object getBrowserData(java.lang.String key)
           
 long getContentNetworkID()
           
protected  java.lang.String[] getContentTypes(java.lang.String event_location, java.lang.String _referer)
           
 boolean isPageLoading()
           
protected  boolean mayExecute(java.lang.String javascript)
           
protected  boolean maySend(java.lang.String key, java.lang.String op, java.util.Map params)
           
protected  boolean openTorrent(BrowserWrapper browser, org.eclipse.swt.browser.LocationEvent event)
           
 boolean sendBrowserMessage(java.lang.String key, java.lang.String op)
          Sends a message to the JavaScript message dispatcher in the page.
 boolean sendBrowserMessage(java.lang.String key, java.lang.String op, java.util.Collection params)
           
 boolean sendBrowserMessage(java.lang.String key, java.lang.String op, java.util.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(java.lang.String key, java.lang.Object value)
           
 void setContentNetworkID(long contentNetworkID)
           
protected  void setPageLoading(boolean b, java.lang.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(java.lang.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 java.lang.String[] getContentTypes(java.lang.String event_location,
                                             java.lang.String _referer)

setPageLoading

protected void setPageLoading(boolean b,
                              java.lang.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(java.lang.String s,
                          java.lang.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 java.lang.Object getBrowserData(java.lang.String key)
Specified by:
getBrowserData in interface ClientMessageContext

setBrowserData

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

sendBrowserMessage

public boolean sendBrowserMessage(java.lang.String key,
                                  java.lang.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(java.lang.String key,
                                  java.lang.String op,
                                  java.util.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(java.lang.String key,
                                  java.lang.String op,
                                  java.util.Collection params)
Specified by:
sendBrowserMessage in interface ClientMessageContext
Returns:

maySend

protected boolean maySend(java.lang.String key,
                          java.lang.String op,
                          java.util.Map params)

executeInBrowser

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

mayExecute

protected boolean mayExecute(java.lang.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()