com.teamdev.jxbrowser.ie
Class IEBrowser

java.lang.Object
  extended by com.teamdev.jxbrowser.AbstractBrowser<Browser>
      extended by com.teamdev.jxbrowser.ie.IEBrowser
All Implemented Interfaces:
Browser, ContentLoading, Disposable, Navigation, NavigationHistory, PageHost, Printing, ScriptRunner, Security

public class IEBrowser
extends AbstractBrowser<Browser>

The browser component based on MS Internet Explorer Engine.


Method Summary
 boolean canGoBack()
          Returns true if the backward operation can be invoked.
 boolean canGoForward()
          Returns true if the forward operation can be invoked.
 void dispose()
          Closes and disposes the current Browser instance.
 java.lang.String executeScript(java.lang.String javaScript)
          Executes specified JavaScript code in a currently opened document.
 java.util.List<java.lang.String> getAllHistory()
          Throws UnsupportedOperationException error, because this method is not implemented for this browser type.
 java.awt.Component getComponent()
          Returns a Swing component with embedded web browser control that allows displaying web pages.
 Configurable getConfigurable()
          Returns API enabling or disabling some browser features such as javascript, plug-ins or images etc.
 java.lang.String getContent()
          Returns the string that represents HTML content of a currently loaded document in WebBrowser.
 ContextMenuHandler getContextMenuHandler()
          Returns the registered context menu handler or null if no context menu handler is currently registered.
 int getCurrentIndex()
          Throws UnsupportedOperationException error, because this method is not implemented for this browser type.
 java.lang.String getCurrentLocation()
          Returns the location of a currently loaded web page in Browser component.
 org.w3c.dom.Document getDocument()
          Returns accessor for the document in the currently loaded page.
 HttpSecurityHandler getHttpSecurityHandler()
          Returns http security handler that allows processing any security problems or null if it's not present.
 Browser getPeer()
          Returns JExplorer com.jniwrapper.win32.ie.Browser instance.
 java.lang.String getStatusMessage()
          Convenience method for getting the current page status message.
 java.lang.String getTitle()
          Returns the current page title.
 BrowserType getType()
          Returns the BrowserType.IE type.
 void goBack()
          Navigates browser back.
 void goForward()
          Navigates browser forward.
 boolean isDisposed()
          Returns true if the Browser instance is closed and disposed.
 boolean isNavigationFinished()
          Returns true if there's no navigation activity in this browser.
 boolean isReady()
           
 void navigate(java.lang.String location)
          Navigates to a resource identified by a URL or to a file identified by a full path.
 void navigate(java.lang.String location, java.lang.String postData)
          Navigates to a web resource specified by a HTTP URL with HTTP post data.
 void print(PrintSettings settings, PrintListener listener)
          Throws UnsupportedOperationException error, because this method is not implemented for this browser type.
 void printPreview(PrintSettings settings)
          Throws UnsupportedOperationException error, because this method is not implemented for this browser type.
 void refresh()
          Reloads the web page currently loaded in the Browser component.
 void setContent(java.lang.String htmlContent)
          Sets the specified HTML content to the current Browser document.
 void setContent(java.lang.String htmlContent, java.lang.String baseURL)
          Sets the specified HTML content with the baseURI to the current Browser document.
 void setContextMenuHandler(ContextMenuHandler handler)
          Sets the handler for the context menu requests that will be nvoked every time the user clicks the right mouse button, or control-clicks, on an element to reveal a contextual menu.
 void setHttpSecurityHandler(HttpSecurityHandler h)
          Sets the specified HTTP security handler that allows processing any security problems such as Invalid Certificate error, Invalid Certificate Name, Invalid Certificate Date, Moving from a non-SSL to an SSL connection because of a redirect or The redirection requires user confirmation problems.
 void setUserAgent(java.lang.String userAgent)
          Sets the user-agent string.
 void stop()
          Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations.
 java.awt.Image toImage(boolean wholePage)
          Returns an image in which the currently loaded web page is rendered.
 
Methods inherited from class com.teamdev.jxbrowser.AbstractBrowser
addDisposeListener, addHistoryChangeListener, addNavigationListener, addProgressListener, addStatusListener, addTitleListener, getCookieStorage, getDisposeListeners, getHistoryChangeListeners, getNavigationListeners, getNewWindowManager, getProgressListeners, getServices, getStatusListeners, getTitleListeners, removeDisposeListener, removeHistoryChangeListener, removeNavigationListener, removeProgressListener, removeStatusListener, removeTitleListener, waitReady
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setContent

public void setContent(java.lang.String htmlContent)
Description copied from interface: Browser
Sets the specified HTML content to the current Browser document.

This method is executing asynchronously. To make sure that the new HTML content was applied to the document completely, use the NavigationListener.navigationFinished(NavigationFinishedEvent) event. It may be necessary when the document contains some resources (such as images or JavaScript files) that require some time to download.

Parameters:
htmlContent - a string that represents HTML content to set to the current document.
See Also:
Browser.setContent(String, String), Browser.getContent(), NavigationListener.navigationFinished(NavigationFinishedEvent)

setContent

public void setContent(java.lang.String htmlContent,
                       java.lang.String baseURL)
Description copied from interface: Browser
Sets the specified HTML content with the baseURI to the current Browser document.

This method is executing asynchronously. To make sure that the new HTML content was applied to the document completely, use the NavigationListener.navigationFinished(NavigationFinishedEvent) event.

It may be necessary when the document contains some resources (such as images or JavaScript files) that require some time to download.

Note: This method will not set BaseURL if html string contains some HTML errors.

Parameters:
htmlContent - a string that represents HTML content to be set to the current document.
baseURL - a string that represents a default address or a default target for all links on a page.
See Also:
Browser.setContent(String), Browser.getContent(), NavigationListener.navigationFinished(NavigationFinishedEvent)

getContent

public java.lang.String getContent()
Description copied from interface: Browser
Returns the string that represents HTML content of a currently loaded document in WebBrowser. To make sure that the document is loaded completely use the NavigationListener.navigationFinished(NavigationFinishedEvent) event.

Returns:
the string that contains a combination of text and tags.
See Also:
Browser.setContent(String), Browser.setContent(String, String), NavigationListener.navigationFinished(NavigationFinishedEvent)

getType

public BrowserType getType()
Returns the BrowserType.IE type.

Returns:
the BrowserType.IE type.
See Also:
BrowserType

getComponent

public java.awt.Component getComponent()
Description copied from interface: Browser
Returns a Swing component with embedded web browser control that allows displaying web pages. This component can be used in Java Swing applications as standard Swing component.

The following sample demonstrates how to create a Browser instance and embed it into JFrame:

     Browser browser = BrowserFactory.createBrowser();
     JFrame frame = new JFrame();
     frame.add(browser.getComponent(), BorderLayout.CENTER);
     frame.setVisible(true);
 

Returns:
a Swing component for embedding into Java Swing applications

getDocument

public org.w3c.dom.Document getDocument()
Description copied from interface: Browser
Returns accessor for the document in the currently loaded page.

Before receiving an instance of document make sure that the entire document is loaded completely. For this you can use the NavigationListener.navigationFinished(NavigationFinishedEvent) event.

Returns:
the document of the loaded web page or null if it's not present
See Also:
NavigationListener.navigationFinished(NavigationFinishedEvent)

toImage

public java.awt.Image toImage(boolean wholePage)
Description copied from interface: Browser
Returns an image in which the currently loaded web page is rendered.

Parameters:
wholePage - if true returns the whole page, not just what is visible
Returns:
an image in which the currently loaded web page is rendered

navigate

public void navigate(java.lang.String location)
Description copied from interface: Navigation
Navigates to a resource identified by a URL or to a file identified by a full path. The WebBrowser can browse to any location in the local file system, on the network, or on the World Wide Web.

This method is invoked asynchronously.

Parameters:
location - the URL of the resource to display or the full path to the file location. The parameter cannot be null.
See Also:
Navigation.navigate(String, String), Navigation.stop()

navigate

public void navigate(java.lang.String location,
                     java.lang.String postData)
Description copied from interface: Navigation
Navigates to a web resource specified by a HTTP URL with HTTP post data. The WebBrowser can browse to any location in the local file system, on the network, or on the World Wide Web.

This method is invoked asynchronously.

Parameters:
location - the URL of the resource to display or the full path to the file location. The parameter cannot be null.
postData - the string that represents a HTTP post data (for example, "name=Alex&product=Pizza"), can be null.
See Also:
Navigation.navigate(String), Navigation.stop()

refresh

public void refresh()
Description copied from interface: Navigation
Reloads the web page currently loaded in the Browser component.

This method is invoked asynchronously.

See Also:
Navigation.navigate(String), Navigation.navigate(String, String), Navigation.stop()

stop

public void stop()
Description copied from interface: Navigation
Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations.

See Also:
Navigation.navigate(String), Navigation.navigate(String, String)

goBack

public void goBack()
Description copied from interface: Navigation
Navigates browser back.


goForward

public void goForward()
Description copied from interface: Navigation
Navigates browser forward.


isNavigationFinished

public boolean isNavigationFinished()
Description copied from interface: Navigation
Returns true if there's no navigation activity in this browser.

Returns:
true if there's no navigation activity in this browser.

getAllHistory

public java.util.List<java.lang.String> getAllHistory()
Throws UnsupportedOperationException error, because this method is not implemented for this browser type.

Returns:
a history list that contains all visited locations.

getCurrentLocation

public java.lang.String getCurrentLocation()
Description copied from interface: NavigationHistory
Returns the location of a currently loaded web page in Browser component. The default location is 'about:blank'. So if the history list is empty, then this method always returns 'about:blank' location.

Returns:
the location of a currently loaded web page in Browser component or 'about:blank' if the history list is empty.
See Also:
NavigationHistory.getAllHistory(), NavigationHistory.getCurrentIndex()

getCurrentIndex

public int getCurrentIndex()
Throws UnsupportedOperationException error, because this method is not implemented for this browser type.

Returns:
an index of a currently loaded web page in navigation history list or -1 when the history list is empty.
See Also:
NavigationHistory.getAllHistory()

isDisposed

public boolean isDisposed()
Description copied from interface: Disposable
Returns true if the Browser instance is closed and disposed. Use this method when you need to make sure that the Browser native side instance is alive and you can invoke its methods.

Returns:
true if the Browser native instance is closed and disposed.
See Also:
Disposable.dispose(), Disposable.addDisposeListener(com.teamdev.jxbrowser.events.DisposeListener)

canGoBack

public boolean canGoBack()
Description copied from interface: NavigationHistory
Returns true if the backward operation can be invoked.

Returns:
true if the backward operation can be invoked.
See Also:
NavigationHistory.canGoForward()

canGoForward

public boolean canGoForward()
Description copied from interface: NavigationHistory
Returns true if the forward operation can be invoked.

Returns:
true if the forward operation can be invoked.
See Also:
NavigationHistory.canGoBack()

getConfigurable

public Configurable getConfigurable()
Description copied from interface: Browser
Returns API enabling or disabling some browser features such as javascript, plug-ins or images etc.

Returns:
entry point for configuring the content settings

setUserAgent

public void setUserAgent(java.lang.String userAgent)
Description copied from interface: Browser
Sets the user-agent string.

The user-agent string is used by websites to identify the client browser.

Parameters:
userAgent - the user-agent string.

print

public void print(PrintSettings settings,
                  PrintListener listener)
Throws UnsupportedOperationException error, because this method is not implemented for this browser type.

Parameters:
settings - the print settings that will use to print web page.
listener - a listener to receive print progress events or null if you don't need the progress events.
See Also:
Navigation.waitReady()

printPreview

public void printPreview(PrintSettings settings)
Throws UnsupportedOperationException error, because this method is not implemented for this browser type.

Parameters:
settings - the print settings that will use to display print preview dialog.
See Also:
Navigation.waitReady()

setHttpSecurityHandler

public void setHttpSecurityHandler(HttpSecurityHandler h)
Description copied from interface: Security
Sets the specified HTTP security handler that allows processing any security problems such as Invalid Certificate error, Invalid Certificate Name, Invalid Certificate Date, Moving from a non-SSL to an SSL connection because of a redirect or The redirection requires user confirmation problems.

Parameters:
h - the specified HTTP security handler.
See Also:
Security.getHttpSecurityHandler()

getHttpSecurityHandler

public HttpSecurityHandler getHttpSecurityHandler()
Description copied from interface: Security
Returns http security handler that allows processing any security problems or null if it's not present.

Returns:
the current http security handler that allows processing any security problems or null if it's not present
See Also:
Security.setHttpSecurityHandler(HttpSecurityHandler)

executeScript

public java.lang.String executeScript(java.lang.String javaScript)
Description copied from interface: ScriptRunner
Executes specified JavaScript code in a currently opened document. Note: If javascript code will show JavaScript modal dialogs then this method can not be invoked in Swing UI thread because it will cause to a deadlock. To avoid this issue please invoke this method in a separate thread. During JavaScript execution an error could happen. To listen JavaScript errors you can use the ScriptErrorWatcher.

Parameters:
javaScript - the string that specifies the code to be executed.
Returns:
a string that represents a result of JavaScript execution or null when no return value.

getTitle

public java.lang.String getTitle()
Description copied from interface: PageHost
Returns the current page title. Use TitleListener to track all title changes.

Returns:
the most recent page title set in the current browser.

getStatusMessage

public java.lang.String getStatusMessage()
Description copied from interface: PageHost
Convenience method for getting the current page status message. Use StatusListener to track all status message changes.

Returns:
the most recent status message set in the current browser.

setContextMenuHandler

public void setContextMenuHandler(ContextMenuHandler handler)
Description copied from interface: PageHost
Sets the handler for the context menu requests that will be nvoked every time the user clicks the right mouse button, or control-clicks, on an element to reveal a contextual menu.

Parameters:
handler - the new context menu handler instance.

getContextMenuHandler

public ContextMenuHandler getContextMenuHandler()
Description copied from interface: PageHost
Returns the registered context menu handler or null if no context menu handler is currently registered.

Returns:
the registered context menu handler or null if no context menu handler is currently registered.

dispose

public void dispose()
Description copied from interface: Disposable
Closes and disposes the current Browser instance. Use this method when you don't need the Browser instance anymore.

See Also:
Disposable.isDisposed(), Disposable.addDisposeListener(com.teamdev.jxbrowser.events.DisposeListener)

getPeer

public Browser getPeer()
Returns JExplorer com.jniwrapper.win32.ie.Browser instance. This instance is based on the JExplorer com.jniwrapper.win32.ie.Browser instance which this method returns. You can use this method to get access to the standard JExplorer Browser component.

Specified by:
getPeer in class AbstractBrowser<Browser>
Returns:
the JExplorer com.jniwrapper.win32.ie.Browser instance.

isReady

public boolean isReady()
Specified by:
isReady in class AbstractBrowser<Browser>