|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IBrowserCanvas
IBrowserCanvas
provides native browsing facilities inside a
standard java.awt.Canvas
. This interface provides a platform and
browser independant mechanism to access these native resources.
Some extra browser-specific functionality can be accessed via other supplied
interfaces. For example, Mozilla browsers can access the
IMozillaBrowserCanavas
interface which allows the user to save a
HTML page to a local drive.
IMozillaBrowserCanvas
Field Summary | |
---|---|
static int |
IMAGE_FORMAT_JPEG
|
static int |
IMAGE_FORMAT_PNG
|
static int |
KEY_CODE_BACKSPACE
|
static int |
KEY_CODE_DELETE
|
static int |
KEY_CODE_TAB
|
static int |
KEY_MODIFIER_CTRL_DOWN
|
static int |
KEY_MODIFIER_SHIFT_DOWN
|
static int |
RELOAD_BYPASS_CACHE
This flag indicates to reload() that it should skip the
cache, but still use the proxy. |
static int |
RELOAD_BYPASS_PROXY
This flag indicates to reload() that it should use the
cache, but skip the proxy. |
static int |
RELOAD_BYPASS_PROXY_AND_CACHE
This flag indicates to reload() that it should skip the
cache and proxy. |
static int |
RELOAD_NORMAL
This flag indicates to reload() that it should use
the cache and proxy. |
Method Summary | |
---|---|
void |
addBlockedURL(java.lang.String strURL)
Adds URL to the list of blocked URLs (URLs that are not displayed). |
void |
addBrowserListener(BrowserListener listener)
Adds the specified browser listener that will receive browser events from this component. |
void |
addJavascriptListener(JavascriptListener listener)
Adds the specified Javascript listener that will receive Javascript events from this component. |
void |
addNetworkListener(NetworkListener listener)
Adds the specified network listener that will receive network events from this component. |
void |
addPromptListener(PromptListener listener)
Adds a PromptListener. |
void |
addWindowListener(WindowListener listener)
Adds the specified window listener that will receive new Window events from this component. |
void |
autoconfigureProxy(java.lang.String url)
Indicate a URL which automatically configures the proxy settings for all the protocols. |
boolean |
canGoBack()
Indicates whether the browser can navigate backwards in history. |
boolean |
canGoForward()
Indicates whether the browser can navigate forwards in history. |
void |
copy()
Copies the selected text to the Clipboard This can then be accessed by other applications by using the Paste Command (Ctrl+V) |
void |
cut()
Cuts the selected text, removing the selection and adding it to the Clipboard This can then be accessed by other applications by using the Paste Command (Ctrl+V) This command can only be used when setHTMLEditingMode(true) has been
called on the IBrowserCanvas |
void |
decreaseTextZoom()
Decreases the size of text on the page. |
void |
deleteCookies()
Deletes stored cookies. |
void |
destroy()
This functions destroys resources allocated by browser canvas. |
void |
disableCache()
Disables the cache. |
void |
disableCookies()
Disable cookies feature. |
void |
disableProxy()
Disable the current proxy settings |
void |
emptyCache()
Removes all cache entries. |
void |
enableCache()
Enables the cache. |
void |
enableCookies()
Enables cookies feature. |
void |
enableImageLoading(boolean enable)
Allow images to load. |
void |
enableProxy()
Enables the current proxy settings |
void |
executeScript(java.lang.String javascriptBody)
Executes the specified script on the currently loaded document. |
java.lang.String |
executeScriptWithReturn(java.lang.String javascriptBody)
Executes the specified script on the currently loaded document. |
boolean |
getBoolPrefProperty(java.lang.String propName)
Gets the boolean value of a property. |
java.lang.String |
getBrowserType()
Returns a string indicating the underlying browser. |
java.lang.String |
getCompanyName()
Gets the name of the company. |
java.lang.String |
getCookie()
Gets the cookie for the currently loaded domain. |
java.lang.String |
getCookie(java.lang.String URL)
Gets the specified cookie. |
java.lang.String |
getCookieFromHttp(java.lang.String URL)
|
IDocument |
getDocument()
This gives access to the DOM of the loaded document. |
IElement |
getElementAtCaretPosition(boolean returnTextNodes)
Retrieves the element under the cursor when in edit mode. |
History |
getHistory()
Gets the browser history. |
boolean |
getHTMLEditingMode()
Gets whether the current webpage is in editing mode. |
int |
getIntPrefProperty(java.lang.String propName)
Gets the integer value of a property. |
boolean |
getJavascriptEnabled()
Gets the status of Javascript. |
java.awt.Dimension |
getMaxRenderSize()
Gets the current maximum buffer size that pages can render to. |
java.awt.Dimension |
getPageSize()
Get the total size in pixels of the current loaded page. |
java.awt.print.Printable |
getPrintable(boolean scaled)
Get a Printable object that is used with Java printing. |
java.lang.String |
getProductName()
Gets the name of the product. |
java.lang.String |
getProxyBypasses()
Gets a string containing the domain names which bypass the given proxy settings. |
ProxySetting |
getProxyProtocol(int protocol)
Retrieves the proxy settings for the given protocol. |
java.lang.String |
getSelectedText()
Gets the active text selection in the browser. |
java.lang.String |
getStringPrefProperty(java.lang.String propName)
Gets the String value of a property. |
java.lang.String |
getTitle()
Get the title of the current resource being displayed. |
java.lang.String |
getURL()
Get the URL of the current resource being displayed. |
java.lang.String |
getVersion()
Get the version of the product as a string. |
java.lang.String |
getWebRendererVersion()
Get a version identification string for components of WebRenderer |
void |
goBack()
Move backwards through resource history. |
void |
goForward()
Move forward through resource history. |
void |
highlightSelectedText(java.awt.Color colour)
Changes the background color on the current selection to given color. |
void |
httpPOST(java.lang.String strURL,
java.io.File file,
java.lang.String fileVariableName)
Load URL with File which should be uploaded |
void |
httpPOST(java.lang.String strURL,
java.io.File file,
java.lang.String fileVariableName,
java.lang.String additionalPOSTData)
Load URL with POST String Data and File which should be uploaded Format of additionPOSTData parameter: name=Parameter_name\r\n\r\nParamter_value\r\n where Paramter_name is a form field name and Paramter_value is form field value |
void |
httpPOST(java.lang.String strURL,
java.lang.String POSTData)
Load URL with POST String Data |
void |
increaseTextZoom()
Increases the size of text on the page. |
void |
invokeAndWait(java.lang.Runnable r)
Runs the given Runnable on the WebRenderer thread and waits until completion. |
void |
invokeLater(java.lang.Runnable r)
Runs the given Runnable on the WebRenderer thread. |
boolean |
isCacheDisabled()
Gets the disabled status of the cache. |
boolean |
isCookiesEnabled()
Gets the on/off status of the cookies feature |
boolean |
isPopup()
Get whether this browser is a popup window or not. |
boolean |
isProxyEnabled()
Gets the on/off status of the proxy settings |
void |
loadHTML(byte[] HTML,
java.lang.String relativePath)
Renders the content of a byte array on the IBrowserCanvas |
void |
loadHTML(java.io.InputStream HTMLStream,
java.lang.String relativePath)
Renders's the content of an Input Stream on the IBrowserCanvas |
void |
loadHTML(java.lang.String html,
java.lang.String relativePath)
Renders the content of a string on the IBrowserCanvas |
void |
loadURL(int NavConstants,
java.lang.String strURL,
byte[] POSTData,
java.lang.String TargetFrameName,
java.lang.String Headers)
Load URL with POST Byte Data, Headers data and TargetFrameName |
void |
loadURL(java.lang.String url)
Loads the resource at the given URL in the browser window. |
void |
loadURL(java.net.URL url)
Loads the resource at the given URL in the browser window. |
java.lang.String |
makeImageUrl(java.awt.image.BufferedImage img)
Registers this image in wrimage:// protocol. |
void |
paste()
Pastes the text from the clipboard to the current document This command can only be used when setHTMLEditingMode(true) has been
called on the IBrowserCanvas |
void |
print()
Print the current rendered document/web-page to the default printer. |
void |
print(boolean scaleWidth,
java.awt.print.PageFormat pf)
Print the current rendered document/web-page to the default printer, using scaling and page format data. |
void |
reload(int flags)
Reload the current resource. |
void |
removeBlockedURL(java.lang.String strURL)
Removes a URL from the list of blocked URLs. |
void |
removeBrowserListener(BrowserListener listener)
Removes the specified browser listener so that it no longer receives browser events from this component. |
void |
removeImage(java.lang.String imageID)
Removes a specified image. |
void |
removeJavascriptListener(JavascriptListener listener)
Removes the specified Javascript listener so that it no longer receives Javascript events from this component. |
void |
removeNetworkListener(NetworkListener listener)
Removes the specified network listener so that it no longer receives network events from this component. |
void |
removePromptListener(PromptListener listener)
Removes the specified Prompt listener so that it no longer receives browser events from this component. |
void |
removeWindowListener(WindowListener listener)
Removes a WindowListener. |
int |
savePageImageToDisk(java.io.File fileName,
int imageFormat)
Save contents of HTML page to an image on disk. |
int |
savePageImageToDisk(java.io.File fileName,
int imageFormat,
boolean waitForPendingRequests)
Save contents of HTML page to an image on disk. |
int |
savePageImageToDiskScaled(java.io.File fileName,
int imageFormat,
double scalefactor)
Save contents of HTML page to a scaled image on disk. |
int |
savePageImageToDiskScaled(java.io.File fileName,
int imageFormat,
double scalefactor,
boolean waitForPendingRequests)
Save contents of HTML page to a scaled image on disk. |
int |
savePageImageToDiskScaled(java.io.File fileName,
int imageFormat,
int width,
int height,
boolean scaleHeight)
Save contents of HTML page to a scaled image on disk. |
int |
savePageImageToDiskScaled(java.io.File fileName,
int imageFormat,
int width,
int height,
boolean scaleHeight,
boolean waitForPendingRequests)
Save contents of HTML page to a scaled image on disk. |
java.awt.image.BufferedImage |
savePageSectionToBufferedImage(int x,
int y,
int width,
int height,
boolean breakText)
Grabs a section of the webpage and returns a BufferedImage. |
java.awt.image.BufferedImage |
savePageSectionToBufferedImage(int x,
int y,
int width,
int height,
boolean breakText,
boolean waitForPendingRequests)
Grabs a section of the webpage and returns a BufferedImage. |
java.awt.image.BufferedImage |
saveToBufferedImage()
Saves the current page to a buffered image. |
java.awt.image.BufferedImage |
saveToBufferedImage(boolean waitForPendingRequests)
Saves the current page to a buffered image. |
java.awt.image.BufferedImage |
saveToBufferedImageNoAlpha()
Saves the current page to a buffered image without an alpha channel. |
java.awt.image.BufferedImage |
saveToBufferedImageNoAlpha(boolean waitForPendingRequests)
Saves the current page to a buffered image without an alpha channel. |
java.awt.image.BufferedImage |
saveToBufferedImageScaled(double scalefactor)
Saves the current page and scales it to a buffered image. |
java.awt.image.BufferedImage |
saveToBufferedImageScaled(double scalefactor,
boolean waitForPendingRequests)
Saves the current page and scales it to a buffered image. |
java.awt.image.BufferedImage |
saveToBufferedImageScaled(int width,
int height,
boolean scaleheight)
Saves the current page to specified size and returns a BufferedImage. |
java.awt.image.BufferedImage |
saveToBufferedImageScaled(int width,
int height,
boolean scaleheight,
boolean waitForPendingRequests)
Saves the current page to specified size and returns a BufferedImage. |
java.awt.image.BufferedImage |
saveToBufferedImageScaledNoAlpha(double scalefactor)
Saves the current page and scales it to a buffered image without an alpha channel. |
java.awt.image.BufferedImage |
saveToBufferedImageScaledNoAlpha(double scalefactor,
boolean waitForPendingRequests)
Saves the current page and scales it to a buffered image without an alpha channel. |
java.awt.image.BufferedImage |
saveToBufferedImageScaledNoAlpha(int width,
int height,
boolean scaleheight)
Saves the current page to specified size and returns a BufferedImage without an alpha channel. |
java.awt.image.BufferedImage |
saveToBufferedImageScaledNoAlpha(int width,
int height,
boolean scaleheight,
boolean waitForPendingRequests)
Saves the current page to specified size and returns a BufferedImage without an alpha channel. |
void |
saveToFile(java.lang.String filename)
Saves the currently loaded webpage to disk. |
void |
selectAll()
Selects all text on the IBrowserCanvas |
void |
sendKeyPressToElement(int keyCode,
int modifiers)
Sends a key event to the currently focused element with the given key code and character code. |
void |
setCookie(java.lang.String Value)
Sets the cookie for the currently loaded domain. |
void |
setCookie(java.lang.String URL,
java.lang.String Value)
Sets cookie for a given domain. |
void |
setHTMLEditingMode(boolean onOff)
Sets whether the page is in editing mode or not When a page is in editing mode, text can be dragged, and contents can be cut. |
void |
setJavascriptEnabled(boolean bOnOff)
Turns javascript on/off If this is called on a browser created with BrowserFactory.spawnInternetExplorer()
it must be called directly after spawning the browser. |
void |
setMaxRenderSize(int width,
int height)
Sets the maximum size of the buffer that the page can render to. |
void |
setMinimumWidth(int width)
Change the minimum width of subsequently rendered pages. |
void |
setPrefProperty(java.lang.String pref,
boolean onOff)
Sets an optional property of the underlying browser. |
void |
setPrefProperty(java.lang.String pref,
int intPref)
Sets an optional property of the underlying browser. |
void |
setPrefProperty(java.lang.String pref,
java.lang.String stringPref)
Sets an optional property of the underlying browser. |
void |
setPrintFooters(java.lang.String leftFooter,
java.lang.String rightFooter)
Set the format of the page footer for print output. |
void |
setPrintHeaders(java.lang.String leftHeader,
java.lang.String rightHeader)
Set the format of the page header for print output. |
void |
setProxyBypasses(java.lang.String urls)
Sets the domain names and URLs which bypass the proxy settings. |
void |
setProxyProtocol(ProxySetting proxy)
Sets the proxy settings. |
void |
setSize(int width,
int height)
Sets the page to a set size. |
void |
stopLoad()
Stop the browser from loading a resource. |
void |
writePageImage(java.io.OutputStream out,
int imageFormat)
Save contents of HTML page to an image. |
void |
writePageImage(java.io.OutputStream out,
int imageFormat,
boolean waitForPendingRequests)
Save contents of HTML page to an image. |
void |
writePageImageScaled(java.io.OutputStream out,
int imageFormat,
double scalefactor)
Save contents of HTML page to a scaled image. |
void |
writePageImageScaled(java.io.OutputStream out,
int imageFormat,
double scalefactor,
boolean waitForPendingRequests)
Save contents of HTML page to a scaled image. |
void |
writePageImageScaled(java.io.OutputStream out,
int imageFormat,
int width,
int height,
boolean scaleHeight)
Save contents of HTML page to a scaled image. |
void |
writePageImageScaled(java.io.OutputStream out,
int imageFormat,
int width,
int height,
boolean scaleHeight,
boolean waitForPendingRequests)
Save contents of HTML page to a scaled image. |
Field Detail |
---|
static final int KEY_MODIFIER_SHIFT_DOWN
static final int KEY_MODIFIER_CTRL_DOWN
static final int KEY_CODE_BACKSPACE
static final int KEY_CODE_TAB
static final int KEY_CODE_DELETE
static final int RELOAD_NORMAL
reload()
that it should use
the cache and proxy.
reload(int)
,
Constant Field Valuesstatic final int RELOAD_BYPASS_CACHE
reload()
that it should skip the
cache, but still use the proxy.
reload(int)
,
Constant Field Valuesstatic final int RELOAD_BYPASS_PROXY
reload()
that it should use the
cache, but skip the proxy.
reload(int)
,
Constant Field Valuesstatic final int RELOAD_BYPASS_PROXY_AND_CACHE
reload()
that it should skip the
cache and proxy.
reload(int)
,
Constant Field Valuesstatic final int IMAGE_FORMAT_PNG
static final int IMAGE_FORMAT_JPEG
Method Detail |
---|
java.lang.String getBrowserType()
These values can be used to cast a IBrowserCanvas
interface
to a more platform specific interface in order to access added
functionality. Examples of this are given at
IMozillaBrowserCanvas
java.lang.String getProductName()
java.lang.String getVersion()
java.lang.String getWebRendererVersion()
java.lang.String getCompanyName()
void copy()
void cut()
setHTMLEditingMode(true)
has been
called on the IBrowserCanvas
void selectAll()
IBrowserCanvas
void loadURL(java.lang.String url)
url
- The URL of the resource to load.void loadURL(java.net.URL url)
url
- The URL of the resource to load.void stopLoad()
void reload(int flags)
flags
- Defines the operation of reload using the RELOAD_* variables.RELOAD_NORMAL
,
RELOAD_BYPASS_CACHE
,
RELOAD_BYPASS_PROXY
,
RELOAD_BYPASS_PROXY_AND_CACHE
boolean canGoBack()
void loadHTML(java.lang.String html, java.lang.String relativePath)
IBrowserCanvas
html
- - A string containing the HTML code to displayrelativePath
- - The relative path from the current working directory to load images from
note: localPath should point to writable location. with set protocol prefix like file:/// and / as last character is essential
example file:///E:/htmlresources/
If localPath is an empty string then current application path used as an absolute base path for files.
Example Usage:
//Relative file
File file = new File("mypages");
browser.loadHTML(htmlString, file.toURL().toString());
void loadHTML(byte[] HTML, java.lang.String relativePath)
IBrowserCanvas
HTML
- - A byte array containing the HTML code to displayrelativePath
- - The relative path from the current working directory to load images from
note: localPath should point to writable location. with set protocol prefix like file:/// and / as last character is essential
example file:///E:/htmlresources/
If localPath is an empty string then current application path used as an absolute base path for files.
Example Usage:
//Relative file
File file = new File("mypages");
browser.loadHTML(htmlString, file.toURL().toString());
void loadHTML(java.io.InputStream HTMLStream, java.lang.String relativePath)
IBrowserCanvas
HTMLStream
- - An InputStream containing the HTML code to displayrelativePath
- - The relative path from the current working directory to load images from
note: localPath should point to writable location. with set protocol prefix like file:/// and / as last character is essential
example file:///E:/htmlresources/
If localPath is an empty string then current application path used as an absolute base path for files.
Example Usage:
//Relative file
File file = new File("mypages");
browser.loadHTML(htmlString, file.toURL().toString());
boolean canGoForward()
true
if goBack()
has been previously called
void goBack()
void goForward()
java.lang.String getTitle()
title
tag.
java.lang.String getURL()
boolean isPopup()
void enableProxy()
disableProxy()
void disableProxy()
enableProxy()
boolean isProxyEnabled()
enableProxy()
,
disableProxy()
ProxySetting getProxyProtocol(int protocol)
ProxySetting
protocol
- Identify which protocol settings to retrieve
void setProxyProtocol(ProxySetting proxy)
ProxySetting
define a single protocol at a time.
This function only sets the proxy protocol. The proxy needs to be explicitly enabled for it to be active.
proxy
- The proxy settings for a single protocol.enableProxy()
,
disableProxy()
java.lang.String getProxyBypasses()
void setProxyBypasses(java.lang.String urls)
www.jadeliquid.com
bypasses for that specific URL
.jadeliquid.com
bypass jadeliquid domain
.gnome.org, .kde.org
bypass gnome.org and kde.org
domains
urls
- Domains to bypass the proxy.void autoconfigureProxy(java.lang.String url)
url
- URL of proxy automatic configuration settingIDocument getDocument()
IDocument
is only valid while the current page is loaded.
This function should not be called until the NetworkEvent onDocumentComplete has fired.
boolean getJavascriptEnabled()
true
if Javascript is enabled.setJavascriptEnabled(boolean)
void setJavascriptEnabled(boolean bOnOff)
BrowserFactory.spawnInternetExplorer()
it must be called directly after spawning the browser. The spawnMozilla version of the method can be
called anytime with the effects happening on the next page load
getJavascriptEnabled()
History getHistory()
void saveToFile(java.lang.String filename)
filename
- The path and name of the file to save the document asboolean getHTMLEditingMode()
setHTMLEditingMode(boolean)
Default is false
void setHTMLEditingMode(boolean onOff)
By default this is set to false.
This function is currently not available on a ISafariBrowserCanvas
onOff
- set to true to enable editing modevoid loadURL(int NavConstants, java.lang.String strURL, byte[] POSTData, java.lang.String TargetFrameName, java.lang.String Headers)
NavConstants
- strURL
- POSTData
- TargetFrameName
- Headers
- void paste()
setHTMLEditingMode(true)
has been
called on the IBrowserCanvas
int savePageImageToDisk(java.io.File fileName, int imageFormat)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)int savePageImageToDisk(java.io.File fileName, int imageFormat, boolean waitForPendingRequests)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.int savePageImageToDiskScaled(java.io.File fileName, int imageFormat, double scalefactor)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)scalefactor
- Less than 1.0 and greater than 0.0 to scale down, bigger than 1.0 to scale up.int savePageImageToDiskScaled(java.io.File fileName, int imageFormat, double scalefactor, boolean waitForPendingRequests)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)scalefactor
- Less than 1.0 and greater than 0.0 to scale down, bigger than 1.0 to scale up.waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.int savePageImageToDiskScaled(java.io.File fileName, int imageFormat, int width, int height, boolean scaleHeight)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)width
- Width to scale the page down to.height
- Height of the thumbnailscaleHeight
- If true, scales the entire page into the thumbnail, otherwise scales according to width and clips height.int savePageImageToDiskScaled(java.io.File fileName, int imageFormat, int width, int height, boolean scaleHeight, boolean waitForPendingRequests)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)width
- Width to scale the page down to.height
- Height of the thumbnailscaleHeight
- If true, scales the entire page into the thumbnail, otherwise scales according to width and clips height.waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.void setPrefProperty(java.lang.String pref, boolean onOff)
pref
- The property to set.onOff
- The value to set it to.void setPrefProperty(java.lang.String pref, int intPref)
pref
- The property to set.intPref
- The value to set it to.void setPrefProperty(java.lang.String pref, java.lang.String stringPref)
pref
- The property to set.stringPref
- The value to set it to.void addBrowserListener(BrowserListener listener)
listener
is null
, no exception is
thrown and no action is performed.
listener
- The browser listener to add.removeBrowserListener(BrowserListener)
void addJavascriptListener(JavascriptListener listener)
listener
is null
, no
exception is thrown and no action is performed.
listener
- The Javascript listener to add.removeJavascriptListener(JavascriptListener)
void addNetworkListener(NetworkListener listener)
listener
is null
, no
exception is thrown and no action is performed.
listener
- The network listener to add.removeNetworkListener(NetworkListener)
void addWindowListener(WindowListener listener)
listener
- The window listener to add.removeWindowListener(WindowListener)
void addPromptListener(PromptListener listener)
listener
- the prompt listener to add.removePromptListener(PromptListener)
void removeWindowListener(WindowListener listener)
listener
- the listener to remove.void removeBrowserListener(BrowserListener listener)
listener
is null
, or listener
has not been previously added as
a listener, no exception is thrown and no action is performed.
listener
- The browser listeneraddBrowserListener(BrowserListener)
void removeJavascriptListener(JavascriptListener listener)
listener
is null
, or listener
has not been previously added as
a listener, no exception is thrown and no action is performed.
listener
- The Javascript listeneraddJavascriptListener(JavascriptListener)
void removeNetworkListener(NetworkListener listener)
listener
is null
, or listener
has not
been previously added as a listener, no exception is thrown and no action
is performed.
listener
- The network listeneraddNetworkListener(NetworkListener)
void removePromptListener(PromptListener listener)
listener
is null
, or listener
has not been previously added as
a listener, no exception is thrown and no action is performed.
listener
- The Prompt listener to remove.void executeScript(java.lang.String javascriptBody)
javascriptBody
- The script to run.NetworkListener
,
addNetworkListener(NetworkListener)
,
setJavascriptEnabled(boolean)
java.lang.String executeScriptWithReturn(java.lang.String javascriptBody)
Returns the result of executing this script as a string
e.g: executing the following script:
" var myVariable='hello';myVariable;"
Will return the string "hello"
javascriptBody
- The script to runNetworkListener
,
addNetworkListener(NetworkListener)
,
setJavascriptEnabled(boolean)
void httpPOST(java.lang.String strURL, java.lang.String POSTData)
strURL
- POSTData
- void httpPOST(java.lang.String strURL, java.io.File file, java.lang.String fileVariableName, java.lang.String additionalPOSTData)
strURL
- file
- fileVariableName
- additionalPOSTData
- void httpPOST(java.lang.String strURL, java.io.File file, java.lang.String fileVariableName)
strURL
- file
- fileVariableName
- boolean getBoolPrefProperty(java.lang.String propName)
propName
- the name of the property to retrieve.
int getIntPrefProperty(java.lang.String propName)
propName
- the name of the property to retrieve.
java.lang.String getStringPrefProperty(java.lang.String propName)
propName
- the name of the property to retrieve.
boolean isCacheDisabled()
true
indicates the cache is disabled.void disableCache()
BrowserFactory.spawnInternetExplorer()
it must be called directly after spawning the browser. The spawnMozilla version of the method can be
called anytime with the effects happening on the next page load.
enableCache()
void enableCache()
BrowserFactory.spawnInternetExplorer()
it must be called directly after spawning the browser. The spawnMozilla version of the method can be
called anytime with the effects happening on the next page load.
disableCache()
void emptyCache()
void addBlockedURL(java.lang.String strURL)
strURL
- full URL to add to blocked list.removeBlockedURL(String)
void removeBlockedURL(java.lang.String strURL)
strURL
- full URL to remove from blocked list.addBlockedURL(String)
java.lang.String getSelectedText()
void destroy()
BrowserFactory.destroyBrowser(IBrowserCanvas)
void highlightSelectedText(java.awt.Color colour)
colour
- the colour to use for highlighting.void enableCookies()
disableCookies()
void disableCookies()
enableCookies()
boolean isCookiesEnabled()
true
if cookies feature is enabled.disableCookies()
,
enableCookies()
java.lang.String makeImageUrl(java.awt.image.BufferedImage img)
img
- the image.
removeImage(String)
void removeImage(java.lang.String imageID)
imageID
- the image ID.makeImageUrl(java.awt.image.BufferedImage)
java.awt.image.BufferedImage saveToBufferedImage()
java.awt.image.BufferedImage saveToBufferedImageNoAlpha()
java.awt.image.BufferedImage saveToBufferedImage(boolean waitForPendingRequests)
waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.
java.awt.image.BufferedImage saveToBufferedImageNoAlpha(boolean waitForPendingRequests)
waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.
java.lang.String getCookie(java.lang.String URL)
URL
-
getCookie()
,
setCookie(String)
,
setCookie(String, String)
java.lang.String getCookie()
getCookie(String)
,
setCookie(String)
,
setCookie(String, String)
java.lang.String getCookieFromHttp(java.lang.String URL)
URL
-
void setCookie(java.lang.String Value)
Value
- the cookie value.getCookie(String)
void setCookie(java.lang.String URL, java.lang.String Value)
URL
- the domain for the cookie.Value
- the value for the cookie.getCookie(String)
void deleteCookies()
void sendKeyPressToElement(int keyCode, int modifiers)
keyCode
- A key code, selected from the KEY_CODE constants.modifiers
- A key modifier, selected from the KEY_MODIFIER constants.KEY_CODE_BACKSPACE
,
KEY_CODE_DELETE
,
KEY_CODE_TAB
,
KEY_MODIFIER_CTRL_DOWN
,
KEY_MODIFIER_SHIFT_DOWN
IElement getElementAtCaretPosition(boolean returnTextNodes)
returnTextNodes
- When called on an IMozillaBrowserCanvas
setting this to true will return the text node the cursor is on,
otherwise the parent tag.
This parameter is ignored if not called on an IMozillaBrowserCanvas
.
null
.setHTMLEditingMode(boolean)
void increaseTextZoom()
void decreaseTextZoom()
void setSize(int width, int height)
width
- height
- void setMinimumWidth(int width)
width
- The width in pixels.java.awt.image.BufferedImage saveToBufferedImageScaled(double scalefactor)
scalefactor
- Less than 1.0 and greater than 0.0 to scale down, bigger than 1.0 to scale up.
java.awt.image.BufferedImage saveToBufferedImageScaled(double scalefactor, boolean waitForPendingRequests)
scalefactor
- Less than 1.0 and greater than 0.0 to scale down, bigger than 1.0 to scale up.waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.
java.awt.image.BufferedImage saveToBufferedImageScaled(int width, int height, boolean scaleheight)
width
- Width to scale the page down to.height
- Height of the thumbnailscaleheight
- If true, scales the entire page into the thumbnail, otherwise scales according to width and clips height.
java.awt.image.BufferedImage saveToBufferedImageScaledNoAlpha(double scalefactor)
scalefactor
- Less than 1.0 and greater than 0.0 to scale down, bigger than 1.0 to scale up.
java.awt.image.BufferedImage saveToBufferedImageScaledNoAlpha(double scalefactor, boolean waitForPendingRequests)
scalefactor
- Less than 1.0 and greater than 0.0 to scale down, bigger than 1.0 to scale up.waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.
java.awt.image.BufferedImage saveToBufferedImageScaledNoAlpha(int width, int height, boolean scaleheight)
width
- Width to scale the page down to.height
- Height of the thumbnailscaleheight
- If true, scales the entire page into the thumbnail, otherwise scales according to width and clips height.
java.awt.image.BufferedImage saveToBufferedImageScaled(int width, int height, boolean scaleheight, boolean waitForPendingRequests)
width
- Width to scale the page down to.height
- Height of the thumbnailscaleheight
- If true, scales the entire page into the thumbnail, otherwise scales according to width and clips height.waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.
java.awt.image.BufferedImage saveToBufferedImageScaledNoAlpha(int width, int height, boolean scaleheight, boolean waitForPendingRequests)
width
- Width to scale the page down to.height
- Height of the thumbnailscaleheight
- If true, scales the entire page into the thumbnail, otherwise scales according to width and clips height.waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.
void print() throws java.awt.print.PrinterException
java.awt.print.PrinterException
setPrintFooters(String, String)
,
setPrintHeaders(String, String)
void print(boolean scaleWidth, java.awt.print.PageFormat pf) throws java.awt.print.PrinterException
PageFormat
parameter. If the rendered page is deeper than a single printer page, multiple
pages are printed with a subsection of the rendered document/page on each. Page number, date,
document/web-page title and name are printed in the header/footer sections of each page. Header
and footer information may be adjusted. Note that this method throws a PrinterException for various printer-specific reasons such as printer out of
paper, ink, etc.
scaleWidth
- true
to scale the image to fit the paper width.pf
- a java PageFormat object with details about the page format.
If null
, the PageFormat object for the default printer is used.
java.awt.print.PrinterException
setPrintFooters(String, String)
,
setPrintHeaders(String, String)
java.awt.print.Printable getPrintable(boolean scaled)
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable( getPrintable( true ) ); // use a printable object that scales the page
pj.print();
scaled
- true
if the document/web-page is to be scaled to the paper width when printing.
void setPrintHeaders(java.lang.String leftHeader, java.lang.String rightHeader)
&p
page number.&t
page title.&u
page url.&d
date and time.
leftHeader
- String with optional special codes, specifying the header left hand section. May be null
.rightHeader
- String with optional special codes, specifying the header right hand section. May be null
.print()
,
print(boolean, PageFormat)
,
setPrintFooters(String, String)
void setPrintFooters(java.lang.String leftFooter, java.lang.String rightFooter)
&p
page number.&t
page title.&u
page url.&d
date and time.
leftHeader
- String with optional special codes, specifying the footer left hand section. May be null
.rightHeader
- String with optional special codes, specifying the footer right hand section. May be null
.print()
,
print(boolean, PageFormat)
,
setPrintFooters(String, String)
java.awt.image.BufferedImage savePageSectionToBufferedImage(int x, int y, int width, int height, boolean breakText)
x
- y
- width
- height
- breakText
- will not return a section with horizontally cut off text if this is false.
setPrintHeaders(String, String)
java.awt.image.BufferedImage savePageSectionToBufferedImage(int x, int y, int width, int height, boolean breakText, boolean waitForPendingRequests)
x
- y
- width
- height
- breakText
- will not return a section with horizontally cut off text if this is false.waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.
setPrintHeaders(String, String)
java.awt.Dimension getPageSize()
void writePageImage(java.io.OutputStream out, int imageFormat)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)void writePageImage(java.io.OutputStream out, int imageFormat, boolean waitForPendingRequests)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.void writePageImageScaled(java.io.OutputStream out, int imageFormat, double scalefactor)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)scalefactor
- Less than 1.0 and greater than 0.0 to scale down, bigger than 1.0 to scale up.void writePageImageScaled(java.io.OutputStream out, int imageFormat, double scalefactor, boolean waitForPendingRequests)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)scalefactor
- Less than 1.0 and greater than 0.0 to scale down, bigger than 1.0 to scale up.waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.void writePageImageScaled(java.io.OutputStream out, int imageFormat, int width, int height, boolean scaleHeight)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)width
- Width to scale the page down to.height
- Height of the thumbnailscaleHeight
- If true, scales the entire page into the thumbnail, otherwise scales according to width and clips height.void writePageImageScaled(java.io.OutputStream out, int imageFormat, int width, int height, boolean scaleHeight, boolean waitForPendingRequests)
fileName
- File to output.imageFormat
- Output format of the file. (IMAGE_FORMAT_PNG or IMAGE_FORMAT_JPG)width
- Width to scale the page down to.height
- Height of the thumbnailscaleHeight
- If true, scales the entire page into the thumbnail, otherwise scales according to width and clips height.waitForPendingRequests
- if set to true will wait for all pending requests to complete before saving.void enableImageLoading(boolean enable)
enable
- true to load images, false to disable them. This is true by default.void setMaxRenderSize(int width, int height)
width
- maximum width.height
- maximum height.java.awt.Dimension getMaxRenderSize()
void invokeLater(java.lang.Runnable r)
Runnable
on the WebRenderer thread.
By running a group of browser commands (such as DOM) at once you can speed up execution speed significantly.
r
- void invokeAndWait(java.lang.Runnable r)
Runnable
on the WebRenderer thread and waits until completion.
By running a group of browser commands (such as DOM) at once you can speed up execution speed significantly.
r
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |