public class BrowserFactory extends 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
.
Modifier and Type | Method and Description |
---|---|
static void |
addFontDirectory(File directory)
Add a directory containing TrueType fonts that will be used to render text on webpages.
|
static void |
clearAppletCache()
Clear all files in the Applet JAR Cache.
|
static void |
destroyBrowser(IBrowserCanvas browser)
Destroy an
IBrowserCanvas instance. |
static void |
extractPlatformCoreComponentsJar(JarFile jarFile)
Deprecated.
Use
setMozillaPath(File) instead. This method might
be altered or removed in future releases. |
static void |
extractPlatformJar(JarFile jarFile)
Deprecated.
Use
setLibraryPath(File) instead. This method might
be altered or removed in future releases. |
static Font |
getDefaultFontForCharacterSet(Character.UnicodeBlock characterSet)
Get the default fall-back font for given character encoding.
|
static String |
getHomeDirectory()
Get the workspace directory for WebRenderer.
|
static String |
getLibraryPath()
Get the path from which native Mozilla libraries are loaded.
|
static String |
getWebRendererVersion()
Get a String identifying the version of WebRenderer Swing Edition.
|
static boolean |
refreshProfile()
Refresh the Mozilla profile contents.
|
static void |
setAppletCacheDir(File cacheDir)
Sets the directory to store the Applet JAR Cache.
|
static void |
setAppletCacheSize(long size)
Set the size of the Applet JAR cache.
|
static void |
setAppletLoadingPanelFactory(IAppletLoadingPanelFactory factory)
Set a new
IAppletLoadingPanelFactory that creates the loading panels for applet. |
static void |
setAppletProxyAuthentication(String username,
String password)
Set proxy authentication details for applets.
|
static void |
setAppletProxyBypass(String bypasses)
Set domains to bypass the proxy server for on applets.
|
static void |
setAppletProxySettings(String proxyHost,
String proxyPort)
Set http proxy host and port for applets.
|
static void |
setCorecomponentsExtractOn(String filename)
Sets extraction of corcomponents based on a custom file within.
|
static void |
setDefaultFontForCharacterSet(Character.UnicodeBlock characterSet,
Font font)
Set the default fall-back font for a particular character encoding.
|
static boolean |
setHomeDirectory(File newDirectory)
Set the workspace root directory for WebRenderer.
|
static boolean |
setHomeDirectory(String newDirectory)
Set the workspace root directory for WebRenderer.
|
static void |
setLibraryPath(File directory)
Sets the path from where the WebRenderer Swing Edition library files are loaded.
|
static void |
setLibraryPath(String Path)
Sets the path where the WebRenderer Swing Edition library files are located.
|
static void |
setLicenseData(String username,
String serial)
Set registration/license key.
|
static void |
setMozillaPath(File directory) |
static void |
setMozillaPath(String path)
Setting the Mozilla Path is used to change the directory that contains the WebRenderer Swing
Edition native library and the core components.
|
static void |
setURLStreamHandlerFactory(Class factoryClass)
Set the global
URLStreamHandlerFactory . |
static void |
setUseJavaLookAndFeelColors(boolean aUse)
Set if to use the Java L&F color scheme inside webpages in WebRenderer.
|
static void |
setUseOldJavaScrollbars(boolean aUse)
The scrollbars can cause Java problems when WebRenderer is used in Applets.
|
static boolean |
shutdownMozilla()
Shutdown Mozilla.
|
static IMozillaBrowserCanvas |
spawnMozilla()
Spawns a new instance of WebRenderer Swing Edition.
|
public static String getWebRendererVersion()
public static void setMozillaPath(String path)
You must call this before any other calls are made as they may need to load the native libraries.
path
- relative path from current directory to libraries.public static String getLibraryPath()
public static void setLicenseData(String username, String serial)
username
- username (up to 8 characters).serial
- registration key.public static void setLibraryPath(String Path)
Path
- path from project location to the library files.setLibraryPath(File)
public static void setLibraryPath(File directory)
directory
- Path from project location to the library files.setLibraryPath(String)
public static void setMozillaPath(File directory)
directory
- public static void destroyBrowser(IBrowserCanvas browser)
IBrowserCanvas
instance.browser
- browser to destroy.public static void setCorecomponentsExtractOn(String filename)
filename
- The name of the file in the corecomponents to look for.public static IMozillaBrowserCanvas spawnMozilla()
public static boolean setHomeDirectory(String newDirectory)
newDirectory
- getHomeDirectory()
,
setLicenseData(String, String)
public static boolean setHomeDirectory(File newDirectory)
newDirectory
- getHomeDirectory()
,
setHomeDirectory( String )
public static String getHomeDirectory()
setHomeDirectory(String)
public static void setAppletProxySettings(String proxyHost, String proxyPort)
public static void setAppletProxyBypass(String bypasses)
public static void setAppletProxyAuthentication(String username, String password)
public static void setURLStreamHandlerFactory(Class factoryClass)
URLStreamHandlerFactory
. Pass in a subclass of
CustomStreamHandlerFactory
. If this method will be called, it
must be called before a browser is spawned.public static void setAppletCacheDir(File cacheDir)
cacheDir
- public static void clearAppletCache()
public static void setAppletCacheSize(long size)
size
- size in bytes of the Applet cachepublic static void addFontDirectory(File directory)
directory
- public static void setAppletLoadingPanelFactory(IAppletLoadingPanelFactory factory)
IAppletLoadingPanelFactory
that creates the loading panels for applet.factory
- public static boolean refreshProfile()
public static void setDefaultFontForCharacterSet(Character.UnicodeBlock characterSet, Font font)
BrowserFactory.setDefaultFontForCharacterSet(UnicodeBlock.HANGUL_SYLLABLES,new Font("Arial Unicode MS",0,12));
"Arial Unicode MS"
.characterSet
- - character set to set default fall-back font for.font
- - New font to use as a default for given character set.BrowserFactory#getDefaultFontForCharacterSet(UnicodeBlock)
public static Font getDefaultFontForCharacterSet(Character.UnicodeBlock characterSet)
null
if no user fall-back has been set.characterSet
- BrowserFactory#setDefaultFontForCharacterSet(UnicodeBlock, Font)
public static boolean shutdownMozilla()
shutdownMozilla
is called you can no longer spawn any new browsers.public static void setUseJavaLookAndFeelColors(boolean aUse)
aUse
- True to use the Java L&F color scheme in pages.public static void setUseOldJavaScrollbars(boolean aUse)
aUse
- true to use older Java scrollbars.public static void extractPlatformJar(JarFile jarFile)
setLibraryPath(File)
instead. This method might
be altered or removed in future releases.jarFile
- the platform-specific JAR file to extract, e.g.
<directory>/webrenderer-swing-windows32.jar
setLibraryPath(File)
,
extractPlatformCoreComponentsJar(JarFile)
public static void extractPlatformCoreComponentsJar(JarFile jarFile)
setMozillaPath(File)
instead. This method might
be altered or removed in future releases.jarFile
- the platform-specific CoreComponents JAR file to extract, e.g.
<directory>corecomponents-swing-windows32.jar
setMozillaPath(File)
,
extractPlatformJar(JarFile)