com.webrenderer
Class BrowserFactory

java.lang.Object
  extended bycom.webrenderer.BrowserFactory

public class BrowserFactory
extends java.lang.Object

BrowserFactory is used to generate new IBrowserCanvas implementations. It follows the factory design pattern, allowing it to spawn off specific implementations. Each implementation implements IBrowserCanvas at a minimum, but probably has browser-specific interfaces as well.

If a browser is not available for the platform (for example, a certain browser not installed), then attempting to spawn such a browser will return null.


Field Summary
static java.lang.String coreComponentsLocation
           
static java.lang.String oldCoreComponentsLocation
           
static int PLATFORM_LINUX
           
static int PLATFORM_OSX
           
static int PLATFORM_OTHER
           
static int PLATFORM_SOLARIS
           
static int PLATFORM_WINDOWS
           
static java.lang.String webRendererLocation
           
 
Method Summary
static void blockMouseInput(boolean bVal)
          Controls the blocking of mouse input events (Windows only).
static void destroyBrowser(IBrowserCanvas browser)
          Destroy an IBrowserCanvas instance.
static java.lang.String getHomeDirectory()
          Get the workspace directory for WebRenderer.
static java.lang.String getIEVersion()
          Get the Internet Explorer version.
static java.lang.String getLibraryPath()
          Get the path from which native Mozilla libraries are loaded.
static java.lang.String getOSLocation()
           
static int getPlatform()
          Return the internal platform identifier.
static java.lang.String getWebrendererVersion()
          Get a String identifying the version of WebRenderer.
static boolean refreshProfile()
          Trigger a refresh of the Mozilla profile contents.
static void setAllowKeyboardInput(boolean bVal)
          Enables or disabled keyboard input into all IBrowserCanvas (Windows only).
static void setAppletProxyAuthentication(java.lang.String username, java.lang.String password)
           
static void setAppletProxyBypass(java.lang.String bypasses)
           
static void setAppletProxySettings(java.lang.String proxyHost, java.lang.String proxyPort)
           
static void setCorecomponentsExtractOn(java.lang.String filename)
          Sets extraction of corcomponents based on a custom file within.
static boolean setHomeDirectory(java.io.File newDirectory)
          Set the workspace root directory for WebRenderer.
static boolean setHomeDirectory(java.lang.String newDirectory)
          Set the workspace root directory for WebRenderer.
static void setLibraryPath(java.io.File directory)
           
static void setLibraryPath(java.lang.String Path)
          Sets the path where the WebRenderer library files are located.
static void setLicenseData(java.lang.String username, java.lang.String serial)
          Set registration/license key.
static void setMozillaPath(java.io.File directory)
           
static void setMozillaPath(java.lang.String path)
          Setting the Mozilla Path is used to change the directory that contains the webrenderer native library and the core components.
static void setProfilePath(java.io.File profilePath)
          Set the mozilla profile directory for WebRenderer.
static void setWebRendererDirectoryName(java.lang.String newName)
          The changes the name of the webrenderer components directory.
static IIEBrowserCanvas spawnInternetExplorer()
          Spawn a new instance of an Internet Explorer canvas (Windows platform only).
static IMozillaBrowserCanvas spawnMozilla()
          Spawn a new instance of a Mozilla canvas.
static ISafariBrowserCanvas spawnSafari()
          Spawn a new instance of a Safari canvas (OSX only).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

webRendererLocation

public static java.lang.String webRendererLocation

coreComponentsLocation

public static final java.lang.String coreComponentsLocation
See Also:
Constant Field Values

oldCoreComponentsLocation

public static java.lang.String oldCoreComponentsLocation

PLATFORM_WINDOWS

public static final int PLATFORM_WINDOWS
See Also:
Constant Field Values

PLATFORM_LINUX

public static final int PLATFORM_LINUX
See Also:
Constant Field Values

PLATFORM_OSX

public static final int PLATFORM_OSX
See Also:
Constant Field Values

PLATFORM_SOLARIS

public static final int PLATFORM_SOLARIS
See Also:
Constant Field Values

PLATFORM_OTHER

public static final int PLATFORM_OTHER
See Also:
Constant Field Values
Method Detail

getOSLocation

public static java.lang.String getOSLocation()

getPlatform

public static int getPlatform()
Return the internal platform identifier.

Returns:
platform Constant identifying platform. PLATFORM_WINDOWS PLATFORM_LINUX PLATFORM_SOLARIS PLATFORM_OTHER PLATFORM_OSX

refreshProfile

public static boolean refreshProfile()
Trigger a refresh of the Mozilla profile contents. Use this to clear the Mozilla profile contents.

Returns:
boolean status of operation. true = succeeded. false = failed.

getWebrendererVersion

public static java.lang.String getWebrendererVersion()
Get a String identifying the version of WebRenderer.

Returns:
the platform-specific version of WebRenderer (example: "2.2.43")

getIEVersion

public static java.lang.String getIEVersion()
Get the Internet Explorer version.

Returns:
the version of Internet Explorer (Windows) or "Not Available" (Linux) or null (OSX).

setMozillaPath

public static void setMozillaPath(java.lang.String path)
Setting the Mozilla Path is used to change the directory that contains the webrenderer native library and the core components. The path given must contain both the webrenderer native library and the core components, and is relative to the current working directory.

You must call this before any other calls are made as they may need to load the native libraries.

Parameters:
path - relative path from current directory to libraries.

getLibraryPath

public static java.lang.String getLibraryPath()
Get the path from which native Mozilla libraries are loaded. Replaces #getDllPath()

Returns:
the path to the native libraries (or empty string if libraries are in current working directory).

spawnMozilla

public static IMozillaBrowserCanvas spawnMozilla()
Spawn a new instance of a Mozilla canvas.

Returns:
IMozillaBrowserCanvas

setLicenseData

public static void setLicenseData(java.lang.String username,
                                  java.lang.String serial)
Set registration/license key. Prevents a registration dialog from being shown when browsing, and unlocks features which are not available in the unregistered version. To prevent feature-locking, the license key must be set via this function before any browser instances are created.

Parameters:
username - username (up to 8 characters).
serial - registration key.

spawnInternetExplorer

public static IIEBrowserCanvas spawnInternetExplorer()
Spawn a new instance of an Internet Explorer canvas (Windows platform only).

Returns:
IIEBrowserCanvas for Windows or null for Linux and OSX

setLibraryPath

public static void setLibraryPath(java.lang.String Path)
Sets the path where the WebRenderer library files are located.

Parameters:
Path - path from project location to the library files.
See Also:
#setDllPath(String)

setLibraryPath

public static void setLibraryPath(java.io.File directory)

setMozillaPath

public static void setMozillaPath(java.io.File directory)

spawnSafari

public static ISafariBrowserCanvas spawnSafari()
Spawn a new instance of a Safari canvas (OSX only).

Returns:
ISafariBrowserCanvas

destroyBrowser

public static void destroyBrowser(IBrowserCanvas browser)
Destroy an IBrowserCanvas instance.

Parameters:
browser - browser to destroy.

blockMouseInput

public static void blockMouseInput(boolean bVal)
Controls the blocking of mouse input events (Windows only). Allows mouse clicks to be disabled on all instances of IBrowserCanvas, including scrollbars.

Parameters:
bVal - true to block all mouse events, false to turn them back on

setAllowKeyboardInput

public static void setAllowKeyboardInput(boolean bVal)
Enables or disabled keyboard input into all IBrowserCanvas (Windows only).

Parameters:
bVal - true enable keyboard input. false disable keyboard input.

setCorecomponentsExtractOn

public static void setCorecomponentsExtractOn(java.lang.String filename)
Sets extraction of corcomponents based on a custom file within. This allows you to change the corecomponents and make sure that your version of the corecomponets extracts if it is not found.
This must be called before any other method on BrowserFactory.
A file with the given name should be added to corecomponets-xxx.zip (where xxx is the platform those corecomponets are for).

Parameters:
filename - The name of the file in the corecomponents to look for.

setHomeDirectory

public static boolean setHomeDirectory(java.lang.String newDirectory)
Set the workspace root directory for WebRenderer. Note, the actual directory used is dependant on the operating system. This allows networked drives to be used with multiple operating systems. This function MUST be called before a browser is spawned, and before setLicenseData, otherwise it will have no effect.

Parameters:
newDirectory -
Returns:
boolean true if the home directory was set OK.
See Also:
getHomeDirectory(), setLicenseData(String, String), spawnMozilla(), spawnSafari(), spawnInternetExplorer()

setHomeDirectory

public static boolean setHomeDirectory(java.io.File newDirectory)
Set the workspace root directory for WebRenderer. Note, the actual directory used is dependant on the operating system. This allows networked drives to be used with multiple operating systems. This function MUST be called before a browser is spawned, and before setLicenseData, otherwise it will have no effect.

Parameters:
newDirectory -
Returns:
boolean true if the home directory was set OK.
See Also:
getHomeDirectory(), setHomeDirectory( String )

getHomeDirectory

public static java.lang.String getHomeDirectory()
Get the workspace directory for WebRenderer. Note, the default is the user's home directory + '.webrenderer' + operating system descriptor.

Returns:
String The user's home directory.
See Also:
setHomeDirectory(String)

setProfilePath

public static void setProfilePath(java.io.File profilePath)
Set the mozilla profile directory for WebRenderer. The profile stores chache, user preferences etc.. This function MUST be called before a browser is spawned, and before setLicenseData, otherwise it will have no effect.

Parameters:
profilePath - directory to store the profile in.

setWebRendererDirectoryName

public static void setWebRendererDirectoryName(java.lang.String newName)
The changes the name of the webrenderer components directory. By default this is ".webrenderer". This function MUST be called before a browser is spawned, and before setLicenseData, otherwise it will have no effect.

Parameters:
newName - new name for the ".webrenderer" directory

setAppletProxySettings

public static void setAppletProxySettings(java.lang.String proxyHost,
                                          java.lang.String proxyPort)

setAppletProxyBypass

public static void setAppletProxyBypass(java.lang.String bypasses)

setAppletProxyAuthentication

public static void setAppletProxyAuthentication(java.lang.String username,
                                                java.lang.String password)