org.mozilla.webclient
Class BrowserControlFactory

java.lang.Object
  extended by org.mozilla.webclient.BrowserControlFactory

public class BrowserControlFactory
extends java.lang.Object

The factory from which BrowserControl instances are created.

BrowserControlFactory uses Utilities.getImplFromServices(java.lang.String) to find an implementation of WebclientFactory. All of the public static methods in this class simply call through to this implementation instance.

Version:
$Id: BrowserControlFactory.html,v 1.5 2007/03/15 00:34:03 edburns%acm.org Exp $

Method Summary
static void appTerminate()
          This method must be called when the application no longer needs to use the Webclient API for the rest of its lifetime.
static void deleteBrowserControl(BrowserControl toDelete)
          Delete a BrowserControl instance created with newBrowserControl().
protected static org.mozilla.webclient.WebclientFactory getInstance()
          This method enables separating the webclient interface from its implementation via the Utilities.getImplFromServices(java.lang.String) method.
static BrowserControl newBrowserControl()
          Create, initialize, and return a new BrowserControl instance.
static void setAppData(java.lang.String absolutePathToNativeBrowserBinDir)
          Initialize the webclient API passing in the path to the browser binary, if necessary.
static void setAppData(java.lang.String notUsed, java.lang.String absolutePathToNativeBrowserBinDir)
          Deprecated. Use setAppData(java.lang.String) instead.
static void setProfile(java.lang.String profileName)
          If called before the first BrowserControl has been created, set the name of the profile to use for this browser session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setProfile

public static void setProfile(java.lang.String profileName)

If called before the first BrowserControl has been created, set the name of the profile to use for this browser session. If the underlying browser does not support the concept of profiles, this method is a no-op.

Parameters:
profileName - the name of the profile

setAppData

public static void setAppData(java.lang.String absolutePathToNativeBrowserBinDir)
                       throws java.io.FileNotFoundException,
                              java.lang.ClassNotFoundException

Initialize the webclient API passing in the path to the browser binary, if necessary. This must be the first method called in the Webclient API, and it must be called once and only once.

If we are embedding a native browser, calling this method will cause the native libraries to be loaded into the JVM.

Parameters:
absolutePathToNativeBrowserBinDir - if non-null this must be the path to the bin dir of the native browser, including the bin. ie: "D:\\Projects\\mozilla\\dist\\win32_d.obj\\bin". When embedding a non-native browser, this may be null.
Throws:
java.io.FileNotFoundException
java.lang.ClassNotFoundException

setAppData

public static void setAppData(java.lang.String notUsed,
                              java.lang.String absolutePathToNativeBrowserBinDir)
                       throws java.io.FileNotFoundException,
                              java.lang.ClassNotFoundException
Deprecated. Use setAppData(java.lang.String) instead.

Throws:
java.io.FileNotFoundException
java.lang.ClassNotFoundException

appTerminate

public static void appTerminate()
                         throws java.lang.Exception

This method must be called when the application no longer needs to use the Webclient API for the rest of its lifetime.

Throws:
java.lang.Exception

newBrowserControl

public static BrowserControl newBrowserControl()
                                        throws java.lang.InstantiationException,
                                               java.lang.IllegalAccessException,
                                               java.lang.IllegalStateException

Create, initialize, and return a new BrowserControl instance. There is one BrowserControl instance per browser window. For example, in a tabbed browser application with three browser tabs open, there will be three BrowserControl instances, one for each tab. Also, any pop-up windows that are created during the course of a user session also correspond to a BrowserControl instance.

Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.IllegalStateException

deleteBrowserControl

public static void deleteBrowserControl(BrowserControl toDelete)

Delete a BrowserControl instance created with newBrowserControl(). This method must be called when the user no longer needs a BrowserControl instance. For example, when a browser tab closes. After returning from this call, any extant references to that BrowserControl are completely useless.

Parameters:
toDelete - the BrowserControl instance to delete.

getInstance

protected static org.mozilla.webclient.WebclientFactory getInstance()

This method enables separating the webclient interface from its implementation via the Utilities.getImplFromServices(java.lang.String) method.



Copyright © 2002-2007 Mozilla.org All Rights Reserved.