com.webrenderer
Interface IBrowserCanvas

All Known Subinterfaces:
IIEBrowserCanvas, IMozillaBrowserCanvas, ISafariBrowserCanvas

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.

See Also:
IIEBrowserCanvas, IMozillaBrowserCanvas

Field Summary
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 PRINT_DEFAULT_ACTION
          This flag is for the machine's default printing behaviour.
static int PRINT_ORIENTATION_LANDSCAPE
           
static int PRINT_ORIENTATION_PORTRAIT
           
static int PRINT_SHOW_DIALOG_BOX
          This flag is for showing the default print dialog.
static int PRINT_SILENT
          This flag is to prevent dialogs from showing when printing.
static int PRINT_SILENT_SHOW_HELP
          This flag allows silent printing with hepler dialogs where necessary.
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 addDOMListener(DOMListener listener)
          Adds the DOM listener to receive DOM events from this component.
 void addJavascriptListener(JavascriptListener listener)
          Adds the specified Javascript listener that will receive Javascript events from this component.
 void addKeyListener(KeyListener listener)
          Adds the specified Key listener that will receive network events from this component.
 void addMouseListener(MouseListener listener)
          Adds the specified Mouse listener that will receive network events from this component.
 void addNetworkListener(NetworkListener listener)
          Adds the specified network listener that will receive network events from this component.
 void addPrintListener(PrintListener listener)
          Adds print status listener that will receive print 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 allowPopups(boolean bOnOff)
          Enable or disable popups for this canvas.
 void autoconfigureProxy(java.lang.String url)
          Automatgically configure proxy settings for protocols via a URL.
 void cancelSave()
          Cancel downloading operation.
 boolean canGoBack()
          Indicates whether the browser can navigate backwards in history.
 boolean canGoForward()
          Indicates whether the browser can navigate forwards in history.
 void copy()
          Copy the selected text to the clipboard.
 void cut()
          Cut the selected text to the clipboard.
 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 disableClipping(boolean bDisable)
          Disables clipping to parent swing component's viewable area.
 void disableCookies()
          Disable cookies feature.
 void disableHTTPSDialog(boolean onOff)
          Enables or disables display of security warning dialogs.
 void disableJInternalFrame()
          Disables the JInternalFrame feature.
 void disableProxy()
          Disable the current proxy settings
 void enableCache()
          Enables the cache.
 void enableCookies()
          Enables cookies feature.
 void enableDefaultContextMenu(boolean onOff)
          Enable or disable the default right-click menu.
 void enableImageLoading(boolean enable)
          Allow images to load.
 void enableJInternalFrame(javax.swing.JInternalFrame parent)
          Enables the browser to be viewed in a JInternalFrame.
 void enableProxy()
          Enables the current proxy settings
 void EventsFireStatus(boolean onOff)
          Deprecated. Sets whether to block events. When this is set to false all Events will be blocked
 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 getAllowPopups()
          Gets if this Browser Canvas can spawn popups.
 boolean getBoolPrefProperty(java.lang.String propName)
          Gets the boolean value of a property.
 java.lang.String getBrowserType()
          Get a string representation of the underlying browser.
 java.awt.Canvas getCanvas()
          Get a canvas.
 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.
 boolean getDefaultContextMenuStatus()
          Gets whether the Default context menu is enabled for right mouse clicks.
 boolean getdisableHTTPSDialog()
          Gets status of security warning dialog display setting.
 IDocument getDocument()
          Get 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.
 java.lang.String getHomeDirectory()
          Retrieve the home directory used by WebRenderer.
 boolean getHTMLEditingMode()
          Gets whether the current webpage is in editing mode.
 boolean getHTTPSDialog()
          Deprecated. Gets status of security warning dialog display setting.
 int getIntPrefProperty(java.lang.String propName)
          Gets the integer value of a property.
 boolean getJavascriptEnabled()
          Gets if Javascript is enabled for this canvas.
 java.awt.Dimension getPageSize()
          Get the size in pixels of the whole webpage.
 boolean getPopupParentWindow()
          Gets whether popups will be opened in a new window or the current IBrowserCanvas Default is false
 java.awt.Dimension getPreferredSize()
          Gets the preferred size of WebRenderer.
 java.lang.String[] getPrinterNames()
          Gets a list of the names of the printers currently installed
 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.
 ScrollBarInfo getScrollBarInfo()
          Returns the current scroll state of the outer document.
 java.lang.String getSelectedText()
          Gets the active text selection in the browser.
 boolean getStatusBar()
          Deprecated.  
 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 grabFocus()
          Causes the IBrowserCanvas to become focused.
 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 insertHTML(java.lang.String strHTMLText)
          Insert some HTML source at the current location (active element).
 boolean isCacheDisabled()
          Gets the disabled status of the cache.
 boolean isCookiesEnabled()
          Gets the on/off status of the cookies feature
 boolean isDisableClipping()
          Gets the Enable/disable clipping status
 boolean isPopup()
          Get whether this browser is a popup window or not.
 boolean isProxyEnabled()
          Gets the on/off status of the proxy settings
 boolean isScrollBarsVisible()
          Returns flag that indicates if the scrollbars are visible or not
 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 the content of an Input Stream on the IBrowserCanvas
 void loadHTML(java.lang.String sHTML, 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 openFileWithApp(java.lang.String strLocalPath, java.lang.String strAppPath)
          Deprecated.  
 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(int Options)
          Print Document with options.
 void print(int Options, java.lang.String PrinterName)
          Print with options to a target printer
 int printPreview()
          Displays in the IBrowserCanvas a print preview of the current page To leave print preview mode, call this method again.
 void registerProtocol(java.lang.String protocol, ProtocolListener l)
          Registers a protocol to Mozilla or IE (Not availble on Safari.
 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 removeDOMListener(DOMListener listener)
          Removes a DOM listener so that it no longer receives DOM 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 removeKeyListener(KeyListener listener)
          Removes the specified Keyboard listener so that it no longer receives browser events from this component.
 void removeMouseListener(MouseListener listener)
          Removes the specified Mouse listener so that it no longer receives browser 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 removePrintListener(PrintListener listener)
          Removes a print status listener.
 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 savePageToBitmapImage(java.lang.String strLocalFileName, boolean full)
          Save contents of HTML page to a bitmap image.
 java.awt.image.BufferedImage saveToBufferedImage(boolean bWholePage)
          Saves the current page to a buffered image.
 java.awt.image.BufferedImage saveToBufferedImage(boolean bWholePage, boolean bKeepAlpha)
          Saves the current page to a buffered image.
 void saveToFile(java.lang.String filename)
          Save the currently loaded page to disk.
 void scrollToX(int xPos)
          Scrolls the brower along the x axis to specified position.
 void scrollToY(int yPos)
          Scrolls the brower along the y axis to specified position.
 void selectAll()
          Selects all text on the canvas.
 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.
 boolean setHomeDirectory(java.lang.String newDirectory)
          Set the home directory used by WebRenderer.
 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)
          Enable or disable Javascript for this canvas.
 void setPopupParentWindow(boolean bOnOff)
          Navigate in the same window without popup windows creation.
 void setPreferredSize(int width, int height)
          Sets the preferred size of WebRenderer.
 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 setPrintPageOrientation(int orientation)
          Set the page orientation for printing.
 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 showAboutBox()
          Shows the JadeLiquid Logo and Registration Information.
 void showScrollBars(boolean bShow)
          Shows/Hides scrollbars
 void stopLoad()
          Stop the browser from loading a resource.
 void useDefaultProfile(boolean bTrue)
          Use default mozilla/IE profile yes/no.
 

Field Detail

PRINT_ORIENTATION_PORTRAIT

public static final int PRINT_ORIENTATION_PORTRAIT
See Also:
Constant Field Values

PRINT_ORIENTATION_LANDSCAPE

public static final int PRINT_ORIENTATION_LANDSCAPE
See Also:
Constant Field Values

KEY_MODIFIER_SHIFT_DOWN

public static final int KEY_MODIFIER_SHIFT_DOWN
See Also:
Constant Field Values

KEY_MODIFIER_CTRL_DOWN

public static final int KEY_MODIFIER_CTRL_DOWN
See Also:
Constant Field Values

KEY_CODE_BACKSPACE

public static final int KEY_CODE_BACKSPACE
See Also:
Constant Field Values

KEY_CODE_TAB

public static final int KEY_CODE_TAB
See Also:
Constant Field Values

KEY_CODE_DELETE

public static final int KEY_CODE_DELETE
See Also:
Constant Field Values

RELOAD_NORMAL

public static final int RELOAD_NORMAL
This flag indicates to reload() that it should use the cache and proxy.

See Also:
reload(int), Constant Field Values

RELOAD_BYPASS_CACHE

public static final int RELOAD_BYPASS_CACHE
This flag indicates to reload() that it should skip the cache, but still use the proxy.

See Also:
reload(int), Constant Field Values

RELOAD_BYPASS_PROXY

public static final int RELOAD_BYPASS_PROXY
This flag indicates to reload() that it should use the cache, but skip the proxy.

See Also:
reload(int), Constant Field Values

RELOAD_BYPASS_PROXY_AND_CACHE

public static final int RELOAD_BYPASS_PROXY_AND_CACHE
This flag indicates to reload() that it should skip the cache and proxy.

See Also:
reload(int), Constant Field Values

PRINT_DEFAULT_ACTION

public static final int PRINT_DEFAULT_ACTION
This flag is for the machine's default printing behaviour.

See Also:
Constant Field Values

PRINT_SHOW_DIALOG_BOX

public static final int PRINT_SHOW_DIALOG_BOX
This flag is for showing the default print dialog.

See Also:
Constant Field Values

PRINT_SILENT

public static final int PRINT_SILENT
This flag is to prevent dialogs from showing when printing.

See Also:
Constant Field Values

PRINT_SILENT_SHOW_HELP

public static final int PRINT_SILENT_SHOW_HELP
This flag allows silent printing with hepler dialogs where necessary.

See Also:
Constant Field Values
Method Detail

getBrowserType

public java.lang.String getBrowserType()
Get a string representation of the underlying browser. *

Returns:
String Name of underlying browser
Currently returns...
  • MOZILLA Mozilla or derivatives (for example, Netscape 6.0 or greater)
  • IE Microsoft Internet Explorer
  • SAFARI Apple Safari 1.0

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 and IIEBrowserCanvas and ISafariBrowserCanvas


getCanvas

public java.awt.Canvas getCanvas()
Get a canvas. Casts the IBrowserCanvas down to a java.awt.Canvas This is useful for adding the IBrowserCanvas to AWT Containers.

Returns:
java.awt.Canvas The canvas.

getProductName

public java.lang.String getProductName()
Gets the name of the product. String "Webrenderer".

Returns:
String The product name.

getVersion

public java.lang.String getVersion()
Get the version of the product as a string.

Returns:
String The product version in the format x.y.zv (e.g. 1.0.1b).

getWebRendererVersion

public java.lang.String getWebRendererVersion()
Get a version identification string for components of WebRenderer.

Returns:
String Version

getCompanyName

public java.lang.String getCompanyName()
Gets the name of the company.

Returns:
String The company name (e.g.: String "JadeLiquid Software" ).

copy

public void copy()
Copy the selected text to the clipboard. This can then be accessed by other applications by using the Paste Command (Ctrl+V).


cut

public void cut()
Cut the selected text to the clipboard. 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(boolean) has been enabled on the canvas.


selectAll

public void selectAll()
Selects all text on the canvas.


loadURL

public void loadURL(java.lang.String url)
Loads the resource at the given URL in the browser window.

Parameters:
url - The URL of the resource to load.

loadURL

public void loadURL(java.net.URL url)
Loads the resource at the given URL in the browser window.

Parameters:
url - The URL of the resource to load.

stopLoad

public void stopLoad()
Stop the browser from loading a resource.


reload

public void reload(int flags)
Reload the current resource. The operation of the method can be changed by supplying different flags. Current ability allows reloading a resource by selectively bypassing the browsers cache and/or proxy server.

Parameters:
flags - Defines the operation of reload. Must be one of the RELOAD flags.
See Also:
RELOAD_BYPASS_CACHE, RELOAD_BYPASS_PROXY, RELOAD_BYPASS_PROXY_AND_CACHE, RELOAD_NORMAL

loadHTML

public void loadHTML(java.lang.String sHTML,
                     java.lang.String relativePath)
Renders the content of a string on the IBrowserCanvas.

Parameters:
relativePath - The path, relative to the current working directory, from which images are loaded. This should point to a writable location. The protocol prefix should be file:///, and a / must be the last character (e.g.: file:///E:/htmlresources/). If relativePath is an empty string then the current application path is used as an absolute base path for files.

Example:

String sHTML = "<HTML><BODY>Hello World!</BODY></HTML>";
File file = new File(".");
browser.loadHTML( sHTML, file.toURI().toString());


loadHTML

public void loadHTML(byte[] HTML,
                     java.lang.String relativePath)
Renders the content of a byte array on the IBrowserCanvas.

Parameters:
HTML - A byte array containing the HTML data to display.
relativePath - The path, relative to the current working directory, from which images are loaded. This should point to a writable location. The protocol prefix should be file:///, and a / must be the last character (e.g.: file:///E:/htmlresources/). If relativePath is an empty string then the current application path is used as an absolute base path for files.

Example

File file = new File(".");
byte [] bBody = "<HEAD><BODY>Hello World</BODY></HEAD>".getBytes();
browser.loadHTML( HTML, file.toURI().toString() );


loadHTML

public void loadHTML(java.io.InputStream HTMLStream,
                     java.lang.String relativePath)
Renders the content of an Input Stream on the IBrowserCanvas

Parameters:
HTMLStream - - An InputStream containing the HTML code to display
relativePath - - 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:


 File file = new File(".");
 byte [] bBody = "<HEAD><BODY>Hello World</BODY></HEAD>".getBytes();
 ByteArrayInputStream bStream = new ByteArrayInputStream( bBody );
 browser.loadHTML( bStream, file.toURI().toString() );

canGoBack

public boolean canGoBack()
Indicates whether the browser can navigate backwards in history.

Returns:
boolean true if it can navigate backwards.

canGoForward

public boolean canGoForward()
Indicates whether the browser can navigate forwards in history. This is true if goBack() has been previously called

Returns:
boolean true if it can navigate forwards.

goBack

public void goBack()
Move backwards through resource history.


goForward

public void goForward()
Move forward through resource history.


getTitle

public java.lang.String getTitle()
Get the title of the current resource being displayed. For HTML resources, this will be the text contained within the title tag.

Returns:
String The title of the current resource.

getURL

public java.lang.String getURL()
Get the URL of the current resource being displayed.

Returns:
String The URL of the current resource.

isPopup

public boolean isPopup()
Get whether this browser is a popup window or not.

Returns:
boolean True if the browser is a popup.

showAboutBox

public void showAboutBox()
Shows the JadeLiquid Logo and Registration Information.


enableProxy

public void enableProxy()
Enables the current proxy settings

See Also:
disableProxy()

disableProxy

public void disableProxy()
Disable the current proxy settings

See Also:
enableProxy()

isProxyEnabled

public boolean isProxyEnabled()
Gets the on/off status of the proxy settings

Returns:
boolean true if the proxy settings are active
See Also:
enableProxy(), disableProxy()

disableHTTPSDialog

public void disableHTTPSDialog(boolean onOff)
Enables or disables display of security warning dialogs.

Parameters:
onOff - true Disable security warning dialogs.

getHTTPSDialog

public boolean getHTTPSDialog()
Deprecated. Gets status of security warning dialog display setting.

See Also:
getdisableHTTPSDialog()

getdisableHTTPSDialog

public boolean getdisableHTTPSDialog()
Gets status of security warning dialog display setting.

Returns:
boolean Status of dialog display.

getProxyProtocol

public ProxySetting getProxyProtocol(int protocol)
Retrieves the proxy settings for the given protocol.

Parameters:
protocol - Identify which protocol settings to retrieve. Use the ProxySetting protocol flags.
Returns:
ProxySetting Holds the returned proxy settings
See Also:
ProxySetting.PROTOCOL_ALL, ProxySetting.PROTOCOL_FTP, ProxySetting.PROTOCOL_GOPHER, ProxySetting.PROTOCOL_HTTP, ProxySetting.PROTOCOL_HTTPS, ProxySetting.PROTOCOL_SOCKS

setProxyProtocol

public void setProxyProtocol(ProxySetting proxy)
Sets the proxy settings. The settings contained in the given 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.

Parameters:
proxy - The proxy settings for a single protocol.
See Also:
enableProxy(), disableProxy()

getProxyBypasses

public java.lang.String getProxyBypasses()
Gets a string containing the domain names which bypass the given proxy settings.

Returns:
String Domains bypassing the proxy.

setProxyBypasses

public void setProxyBypasses(java.lang.String urls)
Sets the domain names and URLs which bypass the proxy settings. The URLs are separated by commas.

The following are some examples:
www.jadeliquid.com bypasses for the specified URL.
.jadeliquid.com bypasses the specified domain.
.gnome.org,.kde.org bypasses gnome.org and kde.org domains.

Parameters:
urls - Domains that bypass the proxy, as a comma-separated list.

autoconfigureProxy

public void autoconfigureProxy(java.lang.String url)
Automatgically configure proxy settings for protocols via a URL.

Parameters:
url - URL of proxy automatic configuration setting.

cancelSave

public void cancelSave()
Cancel downloading operation.


getDocument

public IDocument getDocument()
Get access to the DOM of the loaded document. The returned IDocument is only valid while the current page is loaded. This function should not be called until the NetworkEvent onDocumentComplete has fired.

Returns:
The Document currently loaded.

allowPopups

public void allowPopups(boolean bOnOff)
Enable or disable popups for this canvas.

Parameters:
bOnOff - false to disable popups
See Also:
getAllowPopups()

getAllowPopups

public boolean getAllowPopups()
Gets if this Browser Canvas can spawn popups.

Returns:
true if popups are enabled for this canvas.
See Also:
allowPopups(boolean)

getJavascriptEnabled

public boolean getJavascriptEnabled()
Gets if Javascript is enabled for this canvas.

Returns:
true if Javascript is enabled.
See Also:
setJavascriptEnabled(boolean)

setJavascriptEnabled

public void setJavascriptEnabled(boolean bOnOff)
Enable or disable Javascript for this canvas. If this is called on a browser created with BrowserFactory.spawnInternetExplorer(), it must be called directly after spawning the browser. A Mozilla canvas created via BrowserFactory.spawnMozilla() may have Javascript enabled or disabled at anytime, with the effects happening on the next page load.

See Also:
getJavascriptEnabled(), BrowserFactory.spawnInternetExplorer(), BrowserFactory.spawnMozilla()

getHistory

public History getHistory()
Gets the browser history.

Returns:
Object containing browser history.

Example:


 History h = browser.getHistory();
 for ( int i = 0; i < h.length(); i++ )
     System.out.println( "Page " + i + " URL = " + h.getPageAt(i).getURL() );
 

saveToFile

public void saveToFile(java.lang.String filename)
Save the currently loaded page to disk. The URL must be loaded before calling this method.

Parameters:
filename - The path and name of the file to which the document is to be saved.

enableDefaultContextMenu

public void enableDefaultContextMenu(boolean onOff)
Enable or disable the default right-click menu.

Parameters:
onOff - Set to true to display the context menu on right mouse click.
See Also:
getDefaultContextMenuStatus()

getDefaultContextMenuStatus

public boolean getDefaultContextMenuStatus()
Gets whether the Default context menu is enabled for right mouse clicks.

Returns:
true if context menu is enabled.
See Also:
enableDefaultContextMenu(boolean)

getHTMLEditingMode

public boolean getHTMLEditingMode()
Gets whether the current webpage is in editing mode. This can be set with setHTMLEditingMode(boolean) Default is false

Returns:
true if page is in editing mode

getPopupParentWindow

public boolean getPopupParentWindow()
Gets whether popups will be opened in a new window or the current IBrowserCanvas Default is false

Returns:
true if popups open in current IBrowserCanvas

getPrinterNames

public java.lang.String[] getPrinterNames()
Gets a list of the names of the printers currently installed

Returns:
array of printer names

setHTMLEditingMode

public 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. Also text can be added by typing and with paste.

By default this is set to false. This function is currently not available on a ISafariBrowserCanvas

Parameters:
onOff - set to true to enable editing mode

EventsFireStatus

public void EventsFireStatus(boolean onOff)
Deprecated. Sets whether to block events. When this is set to false all Events will be blocked

Parameters:
onOff - true to block events

getStatusBar

public boolean getStatusBar()
Deprecated.  

Check if Statusbar enabled.


isScrollBarsVisible

public boolean isScrollBarsVisible()
Returns flag that indicates if the scrollbars are visible or not

Returns:
true if native scrollbars are shown

loadURL

public 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

Parameters:
NavConstants -
strURL -
POSTData -
TargetFrameName -
Headers -

openFileWithApp

public void openFileWithApp(java.lang.String strLocalPath,
                            java.lang.String strAppPath)
Deprecated.  

Open file on the local fylesystem using specified application.

Parameters:
strLocalPath -
strAppPath -

paste

public 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


print

public void print(int Options)
Print Document with options.

Parameters:
Options - The following values allowed:

To listen printing status use PrintListner and addPrintLisnerer method.

print

public void print(int Options,
                  java.lang.String PrinterName)
Print with options to a target printer

Parameters:
Options - The following values allowed:
PrinterName - Should be a printer name String returned from getPrinterNames()

printPreview

public int printPreview()
Displays in the IBrowserCanvas a print preview of the current page To leave print preview mode, call this method again.


savePageToBitmapImage

public int savePageToBitmapImage(java.lang.String strLocalFileName,
                                 boolean full)
Save contents of HTML page to a bitmap image. Screen depth must be 24 or 32 bits per pixel on Windows

Parameters:
strLocalFileName - Full path to the new image file.
full - -- true - saves whole page -- false - only visible part of page IE specifics: Generates single PNG file Mozilla specifics: Generates single/multiple PNG file(s) If the page being saved contains frames, then for each frame there is generated a separate image file which has a modified filename with an appended suffix _Frame#, with # replaced by the zero-based index of the frame.

setPopupParentWindow

public void setPopupParentWindow(boolean bOnOff)
Navigate in the same window without popup windows creation.

Parameters:
bOnOff -

showScrollBars

public void showScrollBars(boolean bShow)
Shows/Hides scrollbars

Parameters:
bShow - true to display native scrollbars

useDefaultProfile

public void useDefaultProfile(boolean bTrue)
Use default mozilla/IE profile yes/no.

Parameters:
bTrue - Default value: false Note: This is an initialization function that should only be be called before browser widget creation.

setPrefProperty

public void setPrefProperty(java.lang.String pref,
                            boolean onOff)
Sets an optional property of the underlying browser. Available properties are based on the type of browser being used.

Parameters:
pref - The property to set.
onOff - The value to set it to.

setPrefProperty

public void setPrefProperty(java.lang.String pref,
                            int intPref)
Sets an optional property of the underlying browser. Available properties are based on the type of browser being used.

Parameters:
pref - The property to set.
intPref - The value to set it to.

setPrefProperty

public void setPrefProperty(java.lang.String pref,
                            java.lang.String stringPref)
Sets an optional property of the underlying browser. Available properties are based on the type of browser being used.

Parameters:
pref - The property to set.
stringPref - The value to set it to.

addBrowserListener

public void addBrowserListener(BrowserListener listener)
Adds the specified browser listener that will receive browser events from this component. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - The browser listener to add.
See Also:
removeBrowserListener(BrowserListener)

addJavascriptListener

public void addJavascriptListener(JavascriptListener listener)
Adds the specified Javascript listener that will receive Javascript events from this component. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - The Javascript listener to add.
See Also:
removeJavascriptListener(JavascriptListener)

addNetworkListener

public void addNetworkListener(NetworkListener listener)
Adds the specified network listener that will receive network events from this component. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - The network listener to add.
See Also:
removeNetworkListener(NetworkListener)

addMouseListener

public void addMouseListener(MouseListener listener)
Adds the specified Mouse listener that will receive network events from this component. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - The mouse listener to add.
See Also:
removeMouseListener(MouseListener)

addKeyListener

public void addKeyListener(KeyListener listener)
Adds the specified Key listener that will receive network events from this component. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - The Key listener to add.
See Also:
removeKeyListener(KeyListener)

addPrintListener

public void addPrintListener(PrintListener listener)
Adds print status listener that will receive print events from this component. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - The print listener to add.
See Also:
removePrintListener(PrintListener)

addWindowListener

public void addWindowListener(WindowListener listener)
Adds the specified window listener that will receive new Window events from this component. While there is a WindowListener attached, the IBrowserCanvas will no longer automatically spawn popup windows.

Parameters:
listener - The window listener to add.
See Also:
removeWindowListener(WindowListener)

addPromptListener

public void addPromptListener(PromptListener listener)
Adds a PromptListener. This will recieve events when the browser wants to show a dialog box.

Parameters:
listener - the prompt listener to add.
See Also:
removePromptListener(com.webrenderer.event.PromptListener)

removeWindowListener

public void removeWindowListener(WindowListener listener)
Removes a WindowListener.

Parameters:
listener - the listener to remove.
See Also:
addWindowListener(WindowListener)

removePrintListener

public void removePrintListener(PrintListener listener)
Removes a print status listener.

Parameters:
listener - the listener to remove.
See Also:
addPrintListener(PrintListener)

removeBrowserListener

public void removeBrowserListener(BrowserListener listener)
Removes the specified browser listener so that it no longer receives browser events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If either listener is null, or listener has not been previously added as a listener, no exception is thrown and no action is performed.

Parameters:
listener - The browser listener
See Also:
addBrowserListener(BrowserListener)

removeJavascriptListener

public void removeJavascriptListener(JavascriptListener listener)
Removes the specified Javascript listener so that it no longer receives Javascript events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If either listener is null, or listener has not been previously added as a listener, no exception is thrown and no action is performed.

Parameters:
listener - The Javascript listener
See Also:
addJavascriptListener(JavascriptListener)

removeNetworkListener

public void removeNetworkListener(NetworkListener listener)
Removes the specified network listener so that it no longer receives network events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If either listener is null, or listener has not been previously added as a listener, no exception is thrown and no action is performed.

Parameters:
listener - The network listener
See Also:
addNetworkListener(NetworkListener)

removeMouseListener

public void removeMouseListener(MouseListener listener)
Removes the specified Mouse listener so that it no longer receives browser events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If either listener is null, or listener has not been previously added as a listener, no exception is thrown and no action is performed.

Parameters:
listener - The mouse listener
See Also:
addMouseListener(MouseListener)

removeKeyListener

public void removeKeyListener(KeyListener listener)
Removes the specified Keyboard listener so that it no longer receives browser events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If either listener is null, or listener has not been previously added as a listener, no exception is thrown and no action is performed.

Parameters:
listener - The Keyboard listener to remove.
See Also:
addKeyListener(KeyListener)

removePromptListener

public void removePromptListener(PromptListener listener)
Removes the specified Prompt listener so that it no longer receives browser events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If either listener is null, or listener has not been previously added as a listener, no exception is thrown and no action is performed.

Parameters:
listener - The Prompt listener to remove.
See Also:
addPrintListener(PrintListener)

executeScript

public void executeScript(java.lang.String javascriptBody)
Executes the specified script on the currently loaded document. Javascript must be enabled for this to work.
This should not be called until after an onDocumentComplete event is fired (in NewtorkListener).

Parameters:
javascriptBody - The script to run.
See Also:
NetworkListener, addNetworkListener(NetworkListener), setJavascriptEnabled(boolean)

executeScriptWithReturn

public java.lang.String executeScriptWithReturn(java.lang.String javascriptBody)
Executes the specified script on the currently loaded document. Javascript must be enabled for this to work.
This should not be called until after an onDocumentComplete event is fired (in NewtorkListener).

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"

Parameters:
javascriptBody - The script to run
See Also:
NetworkListener, addNetworkListener(NetworkListener), setJavascriptEnabled(boolean)

httpPOST

public void httpPOST(java.lang.String strURL,
                     java.lang.String POSTData)
Load URL with POST String Data

Parameters:
strURL -
POSTData -

httpPOST

public 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

Parameters:
strURL -
file -
fileVariableName -
additionalPOSTData -

httpPOST

public void httpPOST(java.lang.String strURL,
                     java.io.File file,
                     java.lang.String fileVariableName)
Load URL with File which should be uploaded

Parameters:
strURL -
file -
fileVariableName -

getBoolPrefProperty

public boolean getBoolPrefProperty(java.lang.String propName)
Gets the boolean value of a property.

Parameters:
propName - the name of the property to retrieve.
Returns:
the value of the property.

getIntPrefProperty

public int getIntPrefProperty(java.lang.String propName)
Gets the integer value of a property.

Parameters:
propName - the name of the property to retrieve.
Returns:
the value of the property.

getStringPrefProperty

public java.lang.String getStringPrefProperty(java.lang.String propName)
Gets the String value of a property.

Parameters:
propName - the name of the property to retrieve.
Returns:
the value of the property.

setPreferredSize

public void setPreferredSize(int width,
                             int height)
Sets the preferred size of WebRenderer. This is the size the component will be by default when added to a FlowLayout

Parameters:
width - preferred width.
height - preferred height.
See Also:
getPreferredSize()

getPreferredSize

public java.awt.Dimension getPreferredSize()
Gets the preferred size of WebRenderer.

Returns:
the preferred size.
See Also:
setPreferredSize(int, int)

isCacheDisabled

public boolean isCacheDisabled()
Gets the disabled status of the cache.

Returns:
Status of cache disabling. true indicates the cache is disabled.

disableCache

public void disableCache()
Disables the cache. If this is called on a browser created with 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.

See Also:
enableCache()

enableCache

public void enableCache()
Enables the cache. If this is called on a browser created with 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.

See Also:
disableCache()

addBlockedURL

public void addBlockedURL(java.lang.String strURL)
Adds URL to the list of blocked URLs (URLs that are not displayed).

Parameters:
strURL - full URL to add to blocked list.
See Also:
removeBlockedURL(String)

removeBlockedURL

public void removeBlockedURL(java.lang.String strURL)
Removes a URL from the list of blocked URLs.

Parameters:
strURL - full URL to remove from blocked list.
See Also:
addBlockedURL(String)

addDOMListener

public void addDOMListener(DOMListener listener)
Adds the DOM listener to receive DOM events from this component.

Parameters:
listener - The DOM listener to add.
See Also:
removeDOMListener(com.webrenderer.event.DOMListener)

removeDOMListener

public void removeDOMListener(DOMListener listener)
Removes a DOM listener so that it no longer receives DOM events from this component.

Parameters:
listener - the DOM listener to remove.
See Also:
addDOMListener(DOMListener)

getSelectedText

public java.lang.String getSelectedText()
Gets the active text selection in the browser.

Returns:
the selected text.

destroy

public void destroy()
This functions destroys resources allocated by browser canvas. This is function is not necessary for calling when running in java application, but must be called when destroying an applet.

See Also:
BrowserFactory.destroyBrowser(IBrowserCanvas)

highlightSelectedText

public void highlightSelectedText(java.awt.Color colour)
Changes the background color on the current selection to given color.

Parameters:
colour - the colour to use for highlighting.

enableJInternalFrame

public void enableJInternalFrame(javax.swing.JInternalFrame parent)
Enables the browser to be viewed in a JInternalFrame. This will need to be called after the JInternalFrame has been added to the JDesktopPane.

Parameters:
parent - the JInternalFrame that the browser is to be added to.
See Also:
disableJInternalFrame()

disableJInternalFrame

public void disableJInternalFrame()
Disables the JInternalFrame feature. This needs to be called before an IBrowserCanvas is removed from a JInternalFrame if it is to be added back to any component (such as a JInternalFrame or JFrame).

See Also:
enableJInternalFrame(javax.swing.JInternalFrame)

enableCookies

public void enableCookies()
Enables cookies feature.

See Also:
disableCookies()

disableCookies

public void disableCookies()
Disable cookies feature.

See Also:
enableCookies()

isCookiesEnabled

public boolean isCookiesEnabled()
Gets the on/off status of the cookies feature

Returns:
true if cookies feature is enabled.
See Also:
disableCookies(), enableCookies()

makeImageUrl

public java.lang.String makeImageUrl(java.awt.image.BufferedImage img)
Registers this image in wrimage:// protocol.

Parameters:
img - the image.
Returns:
the image URL.
See Also:
removeImage(String)

removeImage

public void removeImage(java.lang.String imageID)
Removes a specified image.

Parameters:
imageID - the image ID.
See Also:
makeImageUrl(java.awt.image.BufferedImage)

saveToBufferedImage

public java.awt.image.BufferedImage saveToBufferedImage(boolean bWholePage)
Saves the current page to a buffered image.

Parameters:
bWholePage - if true returns the whole page not just what is visible
Returns:
the image.

saveToBufferedImage

public java.awt.image.BufferedImage saveToBufferedImage(boolean bWholePage,
                                                        boolean bKeepAlpha)
Saves the current page to a buffered image.

Parameters:
bWholePage - if true returns the whole page not just what is visible
Returns:
the image.

disableClipping

public void disableClipping(boolean bDisable)
Disables clipping to parent swing component's viewable area. Only available in Windows. Default value false (Not disabled)

Parameters:
bDisable - true to turn off clipping.
See Also:
isDisableClipping()

isDisableClipping

public boolean isDisableClipping()
Gets the Enable/disable clipping status

Returns:
boolean True if clipping disabled
See Also:
disableClipping(boolean)

grabFocus

public void grabFocus()
Causes the IBrowserCanvas to become focused.


getCookie

public java.lang.String getCookie(java.lang.String URL)
Gets the specified cookie.

Parameters:
URL -
Returns:
cookie.
See Also:
getCookie(), setCookie(String), setCookie(String, String)

getCookie

public java.lang.String getCookie()
Gets the cookie for the currently loaded domain.

Returns:
cookie.
See Also:
getCookie(String), setCookie(String), setCookie(String, String)

setCookie

public void setCookie(java.lang.String Value)
Sets the cookie for the currently loaded domain.

Parameters:
Value - the cookie value.
See Also:
getCookie(String)

setCookie

public void setCookie(java.lang.String URL,
                      java.lang.String Value)
Sets cookie for a given domain.

Parameters:
URL - the domain for the cookie.
Value - the value for the cookie.
See Also:
getCookie(String)

deleteCookies

public void deleteCookies()
Deletes stored cookies.


sendKeyPressToElement

public void sendKeyPressToElement(int keyCode,
                                  int modifiers)
Sends a key event to the currently focused element with the given key code and character code.

Parameters:
keyCode - A key code, selected from the KEY_CODE constants.
modifiers - A key modifier, selected from the KEY_MODIFIER constants.
See Also:
KEY_CODE_BACKSPACE, KEY_CODE_DELETE, KEY_CODE_TAB, KEY_MODIFIER_CTRL_DOWN, KEY_MODIFIER_SHIFT_DOWN

getElementAtCaretPosition

public IElement getElementAtCaretPosition(boolean returnTextNodes)
Retrieves the element under the cursor when in edit mode.

Parameters:
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.
Returns:
IElement under cursor, or null.
See Also:
setHTMLEditingMode(boolean)

setPrintPageOrientation

public void setPrintPageOrientation(int orientation)
Set the page orientation for printing.

Parameters:
orientation - either portrait or landscape.
See Also:
PRINT_ORIENTATION_PORTRAIT, PRINT_ORIENTATION_LANDSCAPE

increaseTextZoom

public void increaseTextZoom()
Increases the size of text on the page.


decreaseTextZoom

public void decreaseTextZoom()
Decreases the size of text on the page.


setHomeDirectory

public boolean setHomeDirectory(java.lang.String newDirectory)
Set the home directory used by WebRenderer. Note, this can only be done before any browser instances are spawned.

Parameters:
newDirectory - the writeable directory to use for WebRenderer transient storage.
Returns:
true if the home directory has been set. Note: This defaults to the user's home directory + './webrenderer'

getHomeDirectory

public java.lang.String getHomeDirectory()
Retrieve the home directory used by WebRenderer.

Returns:
String The workspace directory, with the OS-specific subdirectory appended.

insertHTML

public void insertHTML(java.lang.String strHTMLText)
Insert some HTML source at the current location (active element). This requires HTML Editing Mode.

Parameters:
strHTMLText -
See Also:
setHTMLEditingMode(boolean)

registerProtocol

public void registerProtocol(java.lang.String protocol,
                             ProtocolListener l)
Registers a protocol to Mozilla or IE (Not availble on Safari. You can create a new protocol or override an existing protocol (e.g. http).

Parameters:
protocol - name of protocol to create or override
l - listener to implement protocol

getPageSize

public java.awt.Dimension getPageSize()
Get the size in pixels of the whole webpage.

Returns:
size of the webpage.

enableImageLoading

public void enableImageLoading(boolean enable)
Allow images to load.

Parameters:
enable - true to load images, false to disable them. This is true by default.

getScrollBarInfo

public ScrollBarInfo getScrollBarInfo()
Returns the current scroll state of the outer document.

Returns:
ScrollBarInfo Current scroll state.

scrollToY

public void scrollToY(int yPos)
Scrolls the brower along the y axis to specified position.

Parameters:
yPos - Y position of the scroll.

scrollToX

public void scrollToX(int xPos)
Scrolls the brower along the x axis to specified position.

Parameters:
xPos - X position of the scroll.