|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
The WebBrowser defines the base web browser interface and its various capabilities.
- Java component that implements this interface,
- UI-less implementation of this interface| Nested Class Summary | |
static class |
WebBrowser.Properties
Represents a set of event names that can be handled in the PropertyChangeListener listener. |
| Method Summary | |
void |
addBrowserWindowListener(BrowserWindowListener listener)
Adds window listener. |
void |
addNavigationListener(NavigationEventListener listener)
Adds browser navigation event listener. |
void |
addNewWindowListener(NewWindowEventListener listener)
Adds new window listener. |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a new property change listener. |
void |
addStatusListener(StatusEventListener listener)
Adds browser status event listener. |
void |
close()
Closes browser. |
void |
execute(BrowserCommand command)
Executes specified command. |
java.lang.Object |
executeScript(java.lang.String javaScript)
Executes specified JavaScript code in a currently opened document. |
AuthenticateHandler |
getAuthenticateHandler()
Returns browser authenticate handler. |
java.lang.Object |
getBrowserPeer()
Returns an instance of the native web browser peer. |
BrowserWindowListener[] |
getBrowserWindowListeners()
Returns an array of window listeners. |
java.lang.String |
getContent()
Returns the HTML content of a document, opened in a browser. |
java.util.Set |
getCookies(java.lang.String url)
Returns cookies, that are associated with the specified URL. |
DialogEventHandler |
getDialogEventHandler()
Gets dialog event handler. |
HTMLDocument |
getDocument()
Returns DOM document for page loaded into the browser. |
WebBrowserEventsHandler |
getEventHandler()
Returns browser event handler. |
KeyFilter |
getKeyFilter()
Returns key filter. |
java.lang.String |
getLocationURL()
Returns the URL of the resource that Internet Explorer is currently displaying. |
java.util.List |
getNavigationListeners()
Returns browser navigation event listeners. |
NewWindowEventHandler |
getNewWindowHandler()
Returns new window handler. |
java.util.List |
getNewWindowListeners()
Returns new window listeners. |
WebBrowser |
getParentBrowser()
Returns the parent of the browser. |
WebBrowser.Properties |
getProperties()
Returns extended browser properties. |
ReadyState |
getReadyState()
Returns the current ReadyState of the browser. |
ScriptErrorListener |
getScriptErrorListener()
Returns script error listener for current page. |
java.util.List |
getStatusListeners()
Returns browser status event listeners. |
java.lang.String |
getStatusText()
Returns the status text of the browser. |
void |
goBack()
Navigates backward one item in the history list. |
void |
goForward()
Navigates forward one item in the history list. |
void |
goHome()
Navigates to the home page. |
boolean |
isSilent()
Return true if alert, confirmation and error dialogs are disabled else returns false. |
void |
navigate(java.lang.String location)
Navigates to a resource specified by a URL or to the file identified by a full path. |
void |
navigate(java.lang.String location,
java.lang.String postData)
Navigates to a resource specified by a HTTP URL. |
void |
navigate(java.lang.String location,
java.lang.String targetName,
java.lang.String postData)
Navigates the browser to a location that might not be able to be expressed as a URL, such as a pointer to an item identifier list (PIDL) for an entity in the Microsoft Windows shell namespace. |
void |
refresh()
Reloads the file that is currently displayed in the object. |
void |
removeBrowserWindowListener(BrowserWindowListener listener)
Removes window listener. |
void |
removeNavigationListener(NavigationEventListener listener)
Removes browser navigation event listener. |
void |
removeNewWindowListener(NewWindowEventListener listener)
Removes new window listener. |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Removes a specified property change listener. |
void |
removeStatusListener(StatusEventListener listener)
Removes browser status event listener. |
void |
setAuthenticateHandler(AuthenticateHandler handler)
Sets browser authenticate handler. |
void |
setContent(java.lang.String htmlContent)
Set new HTML content. |
void |
setCookie(java.lang.String url,
Cookie cookie)
Creates a new cookie for the specified URL using WinINet API. |
void |
setDialogEventHandler(DialogEventHandler handler)
Sets dialog event handler. |
void |
setEventHandler(WebBrowserEventsHandler handler)
Sets browser event handler. |
void |
setKeyFilter(KeyFilter keyFilter)
Sets key filter. |
void |
setNewWindowHandler(NewWindowEventHandler newWindowHandler)
Sets new window handler. |
void |
setParentBrowser(WebBrowser webBrowser)
Sets the parent of the browser. |
void |
setScriptErrorListener(ScriptErrorListener listener)
Setups javascript error listener for current page. |
void |
setSilent(boolean isSilent)
Disables or enables alert, confirmation and error dialogs. |
void |
stop()
Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations. |
void |
waitReady()
Causes a current thread to wait for the completion of the current operation in the browser. |
void |
waitReady(long timeout)
Causes a current thread to wait for the completion of a current operation in the browser for a specified amount of milliseconds. |
| Methods inherited from interface com.jniwrapper.win32.ie.SingleThreadedComponent |
getOleMessageLoop |
| Methods inherited from interface com.jniwrapper.win32.ie.ParentWindow |
getRecentChild, trackChildren, waitChildCreation, waitChildCreation |
| Method Detail |
public void navigate(java.lang.String location)
location - URL to navigate to.
public void navigate(java.lang.String location,
java.lang.String postData)
location - URL to navigate to.postData - HTTP post data (for example, "name=Alex&product=Pizza")
public void navigate(java.lang.String location,
java.lang.String targetName,
java.lang.String postData)
location - URL to navigate to.targetName - string that contains the name of the frame in which to display the resource.postData - HTTP post data (for example, "name=Alex&product=Pizza").public java.lang.String getLocationURL()
public HTMLDocument getDocument()
java.lang.IllegalStateException - if WebBrowser.waitReady() method isn't called after last call of WebBrowser.navigate() or
WebBrowser.setContent() methods.waitReady(),
navigate(String),
setContent(String)public WebBrowser getParentBrowser()
null if the browser not has the parent.public void setParentBrowser(WebBrowser webBrowser)
webBrowser - the parent of the browser.public void goForward()
public void goBack()
public void goHome()
public void stop()
public void refresh()
public void execute(BrowserCommand command)
command - browser command.public void setContent(java.lang.String htmlContent)
htmlContent - HTML content to set.public java.lang.String getContent()
public java.lang.Object executeScript(java.lang.String javaScript)
javaScript - JavaScript to execute.
public ReadyState getReadyState()
ReadyState of the browser.
public java.lang.String getStatusText()
public void addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
WebBrowser.Properties class.
propertyName - property name.listener - listener instance.
public void removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
WebBrowser.Properties class.
propertyName - property name.listener - listener instance.public void waitReady()
Important: successful call of this method guaranties that you can get DOM document of loaded page.
Please see typical usage of this method in the code below:
// navigate to Google page
browser.navigate("google.com");
// wait until page completely loaded
browser.waitReady();
// DOM document is available
Document document = browser.getDocument();
WebBrowser.waitReady() call after navigation call
then IllegalStateException is thrown in WebBrowser.getDocument() call.
navigate(String),
setContent(String),
getDocument()public void waitReady(long timeout)
timeout - the number of milliseconds to wait.public java.lang.Object getBrowserPeer()
java.lang.IllegalStateException - if the passed browser does not have a native peer.public void addNavigationListener(NavigationEventListener listener)
listener - browser event listener.public void removeNavigationListener(NavigationEventListener listener)
listener - browser event listener.public java.util.List getNavigationListeners()
public void addStatusListener(StatusEventListener listener)
listener - browser event listener.public void removeStatusListener(StatusEventListener listener)
listener - browser event listener.public java.util.List getStatusListeners()
public void setEventHandler(WebBrowserEventsHandler handler)
handler - event handlerpublic WebBrowserEventsHandler getEventHandler()
public void setAuthenticateHandler(AuthenticateHandler handler)
handler - authenticate handlerpublic AuthenticateHandler getAuthenticateHandler()
public void setDialogEventHandler(DialogEventHandler handler)
The setSilent() method call modifies dialog event handler.
handler - dialog event handlerpublic DialogEventHandler getDialogEventHandler()
public void setScriptErrorListener(ScriptErrorListener listener)
listener - javascript error listenerpublic ScriptErrorListener getScriptErrorListener()
public void close()
public void setSilent(boolean isSilent)
This method call modifies dialog event handler through setDialogEventHandler() call.
isSilent - if true then enter to silent mode else leave silent mode.public boolean isSilent()
public void setCookie(java.lang.String url,
Cookie cookie)
InternetSetCookie native function.
url - specifies an URL, a new cookie will be associated with.cookie - specifies a new cookie.public java.util.Set getCookies(java.lang.String url)
InternetGetCookie native function.
url - specifies an URL.
public void setNewWindowHandler(NewWindowEventHandler newWindowHandler)
newWindowHandler - new window handlerpublic NewWindowEventHandler getNewWindowHandler()
public void addNewWindowListener(NewWindowEventListener listener)
listener - new window listenerpublic void removeNewWindowListener(NewWindowEventListener listener)
listener - new window listenerpublic java.util.List getNewWindowListeners()
public void setKeyFilter(KeyFilter keyFilter)
keyFilter - key filterpublic KeyFilter getKeyFilter()
public WebBrowser.Properties getProperties()
public void addBrowserWindowListener(BrowserWindowListener listener)
listener - the window listenerpublic void removeBrowserWindowListener(BrowserWindowListener listener)
listener - the window listenerpublic BrowserWindowListener[] getBrowserWindowListeners()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||