|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.jniwrapper.win32.ie.Browser
public class Browser
This component implements the WebBrowser
interface and provides various
capabilities for a Java application, such as Web surfing, documents viewing, etc.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Nested classes/interfaces inherited from interface com.jniwrapper.win32.ie.WebBrowser |
---|
WebBrowser.Properties |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Browser()
Creates a new Browser instance. |
|
Browser(Browser parent)
Creates a child browser instance. |
|
Browser(BrowserOptions options)
Creates a new Browser instance using entire browser options. |
Method Summary | |
---|---|
void |
addBrowserWindowListener(BrowserWindowListener listener)
Adds window listener. |
void |
addDisposeListener(DisposeListener listener)
Registers the listener for the current Browser instance
that will receive events when the current Browser instance
is disposed. |
void |
addNavigationListener(NavigationEventListener listener)
Adds browser navigation event listener. |
void |
addNewWindowListener(NewWindowEventListener listener)
Adds new window listener. |
void |
addStatusListener(StatusEventListener listener)
Adds browser status event listener. |
void |
close()
Closes and disposes the current WebBrowser instance. |
void |
execute(BrowserCommand command)
Executes specified command. |
java.lang.Object |
executeScript(java.lang.String javaScript)
Executes specified JavaScript code in a currently opened document. |
AuthenticationHandler |
getAuthenticationHandler()
Returns the current browser authentication handler or null if it's was not specified. |
java.lang.Object |
getBrowserPeer()
Returns an instance of the native web browser peer. |
java.lang.String |
getContent()
Returns the HTML content of a document, opened in a browser. |
java.lang.String |
getContent(boolean original)
Returns the string that represents HTML content of a currently loaded document in WebBrowser. |
org.w3c.dom.Element |
getContextElement()
Returns element on which the context menu was invoked last time. |
ContextMenuProvider |
getContextMenuProvider()
Returns the context menu provider for the browser. |
java.util.Set<Cookie> |
getCookies(java.lang.String url)
Deprecated. Use the CookieManager.getCookies(URL url) method instead. |
java.util.Set<Cookie> |
getCookies(java.net.URL url)
Returns cookies, that are associated with the specified URL. |
java.lang.String |
getDefaultUserAgent()
Returns the default user-agent string. |
DialogEventHandler |
getDialogEventHandler()
Returns the dialog events handler or null if it's
was not specified. |
DisposeListener[] |
getDisposeListeners()
Returns an array of all registered listeners for the current Browser instance. |
org.w3c.dom.html.HTMLDocument |
getDocument()
Returns an instance of HTMLDocument that
represents the HTML document currently loaded into
the WebBrowser and provides access to the contents of
the HTML Document Object Model (DOM). |
WebBrowserEventsHandler |
getEventHandler()
Returns browser event handler. |
HtmlDialogListener |
getHtmlDialogListener()
Returns the current HTML Dialog listener or null if it's not
registered. |
HttpSecurityHandler |
getHttpSecurityHandler()
Returns http security handler that allows processing any security problems or null if it's not present. |
KeyFilter |
getKeyFilter()
Returns key filter. |
java.lang.String |
getLocationURL()
Returns the string that represents a URL of the resource that WebBrowser component is currently displayed. |
java.awt.Dimension |
getMinimumSize()
|
java.util.List<NavigationEventListener> |
getNavigationListeners()
Returns browser navigation event listeners. |
NewWindowEventHandler |
getNewWindowHandler()
Returns new window handler. |
java.util.List<NewWindowEventListener> |
getNewWindowListeners()
Returns new window listeners. |
com.jniwrapper.win32.automation.OleMessageLoop |
getOleMessageLoop()
Return browser OLE message loop. |
BrowserOptions |
getOptions()
|
WebBrowser |
getParentBrowser()
Returns the parent browser of the current instance. |
WebBrowser.Properties |
getProperties()
Returns extended browser properties. |
ProxyConfiguration |
getProxy()
Returns the proxy settings for the current WebBrowser control and all its children. |
ReadyState |
getReadyState()
Returns the current ReadyState of the browser. |
WebBrowser |
getRecentChild()
Returns recent created child object since last trackChildren() method call. |
java.awt.Image |
getScreenShot(boolean wholePage)
Returns an image that represent screen shot of the page. |
java.awt.Image |
getScreenShot(java.awt.Dimension dimension)
Returns an image that represent screen shot of the page. |
ScriptErrorListener |
getScriptErrorListener()
Returns script error listener for current page. |
java.util.List<StatusEventListener> |
getStatusListeners()
Returns browser status event listeners. |
java.lang.String |
getUserAgent()
Returns the user-agent string. |
int |
getZoomValue()
|
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 current home or start page. |
boolean |
isClosed()
Returns true if the WebBrowser instance is closed and disposed. |
boolean |
isClosing()
|
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 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 |
navigate(java.lang.String location,
java.lang.String targetName,
java.lang.String postData)
Navigates to an entire web resource specified by a HTTP URL with HTTP post data into a specified window defined by targetName. |
void |
navigate(java.lang.String location,
java.lang.String targetName,
java.lang.String postData,
java.lang.String headers)
Navigates to an entire web resource specified by a HTTP URL with HTTP post data into a specified window defined by targetName. |
protected void |
processComponentKeyEvent(java.awt.event.KeyEvent e)
|
void |
refresh()
Reloads the file that is currently displayed in the object. |
void |
registerFunction(java.lang.String functionName,
BrowserFunction function)
Registers a browser function on the currently loaded document. |
void |
removeBrowserWindowListener(BrowserWindowListener listener)
Removes window listener. |
void |
removeDisposeListener(DisposeListener listener)
Removes the listener so that it will not receive events
when the current Browser instance is disposed. |
void |
removeNavigationListener(NavigationEventListener listener)
Removes browser navigation event listener. |
void |
removeNewWindowListener(NewWindowEventListener listener)
Removes new window listener. |
void |
removeNotify()
|
void |
removeStatusListener(StatusEventListener listener)
Removes browser status event listener. |
void |
requestFocus()
|
void |
setAuthenticationHandler(AuthenticationHandler handler)
Sets the specified browser authentication handler. |
void |
setClosing(boolean closing)
|
void |
setContent(java.lang.String htmlContent)
Set new HTML content. |
void |
setContextMenuProvider(ContextMenuProvider contextMenuProvider)
Sets the context menu provider for the browser. |
void |
setCookie(java.lang.String url,
Cookie cookie)
Deprecated. Use the CookieManager.setCookie(URL url, Cookie cookie) or
CookieManager.setCookies(URL url, Set cookies) methods instead. |
void |
setCookies(java.net.URL url,
java.util.Set<Cookie> cookies)
Creates a new cookies for the specified URL using WinINet API. |
void |
setDialogEventHandler(DialogEventHandler handler)
Sets the listener interface for receiving show dialog events. |
void |
setEnabled(boolean enabled)
Sets whether or not this component is enabled. |
void |
setEventHandler(WebBrowserEventsHandler handler)
Sets browser event handler. |
void |
setHtmlDialogListener(HtmlDialogListener listener)
Sets the specified HTML Dialog listener that allows receiving event when the HTML Dialog is shown and its document is loaded completely. |
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 |
setKeyFilter(KeyFilter keyFilter)
Sets key filter. |
void |
setNewWindowHandler(NewWindowEventHandler newWindowHandler)
Sets new window handler. |
void |
setParentBrowser(WebBrowser browser)
Deprecated. Will be removed because WebBrowser instance will receive parent automatically. |
void |
setProxy(ProxyConfiguration conf)
Sets the specified proxy settings for the current WebBrowser control and all its children. |
void |
setScriptErrorListener(ScriptErrorListener listener)
Setups javascript error listener for current page. |
void |
setSilent(boolean isSilent)
Disables or enables alert, confirmation and error dialogs. |
void |
setUserAgent(java.lang.String userAgent)
Sets the user-agent string. |
void |
setZoomValue(int value)
|
void |
stop()
Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations. |
void |
trackChildren()
Starts to collect information about child object creation. |
WebBrowser |
waitChildCreation()
Blocks execution until child is created since last trackChildren()
call and returns this child. |
WebBrowser |
waitChildCreation(java.lang.Runnable operationThatCreatesChild)
Executes operation specified in the parameter and returns when child created by the operation is opened. |
void |
waitReady()
Causes a current thread to wait for the completion of the current operation in the browser. |
void |
waitReady(long timeout)
Deprecated. Use the NavigationEventListener.entireDocumentCompleted event
to make sure that the document is loaded completely. |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.jniwrapper.win32.ie.WebBrowser |
---|
addPropertyChangeListener, removePropertyChangeListener |
Constructor Detail |
---|
public Browser()
Browser(BrowserOptions)
public Browser(BrowserOptions options)
options
- the browser instance options.public Browser(Browser parent)
parent
- the parent for the child browser.
java.lang.NullPointerException
- when parent
is null
.Method Detail |
---|
public void requestFocus()
requestFocus
in class javax.swing.JComponent
public BrowserOptions getOptions()
public void removeNotify()
removeNotify
in class javax.swing.JComponent
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public WebBrowser getParentBrowser()
getParentBrowser
in interface WebBrowser
null
if the browser has no parent.getParentBrowser()
,
HeadlessBrowser.getParentBrowser()
,
IEAutomation.getParentBrowser()
public void setParentBrowser(WebBrowser browser)
setParentBrowser
in interface WebBrowser
browser
- the parent browser.public java.lang.Object executeScript(java.lang.String javaScript)
executeScript
in interface WebBrowser
javaScript
- JavaScript to execute.
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.public void navigate(java.lang.String location)
navigate
in interface WebBrowser
location
- the URL of the resource to display or
the full path to the file location. The
parameter cannot be null
.
java.lang.IllegalArgumentException
- when location parameter is null.
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.navigate(String, String)
,
navigate(String, String, String)
,
NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
public void navigate(java.lang.String location, java.lang.String postData)
navigate
in interface WebBrowser
location
- the URL of the resource to display or
the full path to the file location. The
parameter cannot be null
.postData
- HTTP post data (for example, "name=Alex&product=Pizza"),
can be null
.
java.lang.IllegalArgumentException
- when location parameter is null.
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.navigate(String)
,
navigate(String, String, String)
,
NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
public void navigate(java.lang.String location, java.lang.String targetName, java.lang.String postData)
navigate
in interface WebBrowser
location
- the URL of the resource to display or
the full path to the file location. The
parameter cannot be null
.targetName
- The string that contains the name of the
frame in which to display the resource.
The possible values for this parameter are.
postData
- HTTP post data (for example, "name=Alex&product=Pizza").
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.navigate(String)
,
navigate(String, String)
,
NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
public void navigate(java.lang.String location, java.lang.String targetName, java.lang.String postData, java.lang.String headers)
WebBrowser
navigate
in interface WebBrowser
location
- the URL of the resource to display or
the full path to the file location. The
parameter cannot be null
.targetName
- The string that contains the name of the
frame in which to display the resource.
The possible values for this parameter are.
postData
- HTTP post data (for example, "name=Alex&product=Pizza").headers
- The string that contains additional HTTP headers to send
to the server. These headers are added to the default
Windows Internet Explorer headers. For example, headers
can specify the action required of the server, the type
of data being passed to the server, or a status code.
This parameter is ignored if the URL is not an HTTP
(or HTTPS) URL.WebBrowser.navigate(String)
,
WebBrowser.navigate(String, String)
,
NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
public java.lang.String getLocationURL()
getLocationURL
in interface WebBrowser
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
public void goForward()
StatusEventListener.forwardButtonEnabled
event to check the enabled state of forward navigation.
To manage WebBrowser's history use the BrowserHistory
class.
goForward
in interface WebBrowser
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.WebBrowser.goBack()
,
WebBrowser.goHome()
,
BrowserHistory
public void goBack()
StatusEventListener.backButtonEnabled
event to check the enabled state of back navigation.
To manage WebBrowser's history use the BrowserHistory
class.
goBack
in interface WebBrowser
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.WebBrowser.goForward()
,
WebBrowser.goHome()
,
BrowserHistory
public void goHome()
goHome
in interface WebBrowser
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.WebBrowser.goForward()
,
WebBrowser.goBack()
public void refresh()
refresh
in interface WebBrowser
public void stop()
stop
in interface WebBrowser
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.refresh()
,
navigate(String)
,
NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
public void execute(BrowserCommand command)
execute
in interface WebBrowser
command
- browser command.PrintCommand
,
PrintPreviewCommand
,
SaveAsCommand
public org.w3c.dom.html.HTMLDocument getDocument()
HTMLDocument
that
represents the HTML document currently loaded into
the WebBrowser and provides access to the contents of
the HTML Document Object Model (DOM).
Before receiving an instance of HTMLDocument
make sure that the entire document is loaded completely.
For this you can use the
NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
event.
getDocument
in interface WebBrowser
java.lang.IllegalStateException
- when WebBrowser.waitReady()
method isn't called after last call of
WebBrowser.navigate()
or
WebBrowser.setContent()
methods;
or when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.WebBrowser.waitReady()
,
WebBrowser.navigate(String)
,
WebBrowser.setContent(String)
,
NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
public void setContent(java.lang.String htmlContent)
setContent
in interface WebBrowser
htmlContent
- HTML content to set.WebBrowser.navigate(String)
,
WebBrowser.navigate(String, String)
,
WebBrowser.navigate(String, String, String)
,
WebBrowser.getContent()
,
WebBrowser.getContent(boolean)
,
NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
public java.lang.String getContent()
getContent
in interface WebBrowser
WebBrowser.setContent(String)
,
WebBrowser.getContent(boolean)
,
NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
public java.lang.String getContent(boolean original)
WebBrowser
NavigationEventListener.entireDocumentCompleted
event.
getContent
in interface WebBrowser
original
- if true
then returns the original
HTML content (like View Source command in context
menu of Internet Explorer browser), otherwise this method
returns the actual content of a document according to its DOM.
WebBrowser.getContent()
,
WebBrowser.setContent(String)
,
NavigationEventListener.entireDocumentCompleted(WebBrowser, String)
public void setContextMenuProvider(ContextMenuProvider contextMenuProvider)
If context menu provider for the browser is null then show default context menu.
If the provider isn't null then show custom menu or don't show any menu
(depends from ContextMenuProvider
implementation).
contextMenuProvider
- context menu provider instance or null
.public ContextMenuProvider getContextMenuProvider()
If context menu provider for the browser is null then show default context menu.
If the provider isn't null then show custom menu or don't show any menu
(depends from ContextMenuProvider
implementation).
null
.public ReadyState getReadyState()
ReadyState
of the browser.
getReadyState
in interface WebBrowser
public java.lang.Object getBrowserPeer()
getBrowserPeer
in interface WebBrowser
java.lang.IllegalStateException
- if the passed browser does not have a native peer.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.
waitReady
in interface WebBrowser
WebBrowser.navigate(String)
,
WebBrowser.setContent(String)
,
WebBrowser.getDocument()
public void waitReady(long timeout)
NavigationEventListener.entireDocumentCompleted
event
to make sure that the document is loaded completely.
waitReady
in interface WebBrowser
timeout
- the number of milliseconds to wait.public org.w3c.dom.Element getContextElement()
public void addNavigationListener(NavigationEventListener listener)
addNavigationListener
in interface WebBrowser
listener
- browser event listener.public void removeNavigationListener(NavigationEventListener listener)
removeNavigationListener
in interface WebBrowser
listener
- browser event listener.public java.util.List<NavigationEventListener> getNavigationListeners()
getNavigationListeners
in interface WebBrowser
public void addStatusListener(StatusEventListener listener)
addStatusListener
in interface WebBrowser
listener
- browser event listener.public java.util.List<StatusEventListener> getStatusListeners()
getStatusListeners
in interface WebBrowser
public void removeStatusListener(StatusEventListener listener)
removeStatusListener
in interface WebBrowser
listener
- browser event listener.public void setAuthenticationHandler(AuthenticationHandler handler)
setAuthenticationHandler
in interface WebBrowser
handler
- the authentication handler
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.getAuthenticationHandler()
public AuthenticationHandler getAuthenticationHandler()
null
if it's was not specified. The
authentication handler allows handling the authenticate
events from the browser object. Currently supported the
basic, digest and NTLM authentication schemes.
getAuthenticationHandler
in interface WebBrowser
null
.
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.setAuthenticationHandler(AuthenticationHandler)
public WebBrowserEventsHandler getEventHandler()
getEventHandler
in interface WebBrowser
public void setEventHandler(WebBrowserEventsHandler handler)
setEventHandler
in interface WebBrowser
handler
- event handlerpublic void setScriptErrorListener(ScriptErrorListener listener)
setScriptErrorListener
in interface WebBrowser
listener
- javascript error listenerpublic ScriptErrorListener getScriptErrorListener()
getScriptErrorListener
in interface WebBrowser
public void close()
IllegalStateException
error. Use this method when
you don't need the WebBrowser instance anymore.
close
in interface WebBrowser
isClosed()
public boolean isClosing()
public void setClosing(boolean closing)
public boolean isClosed()
true
if the WebBrowser instance is closed and disposed.
Use this method when you need to make sure that the WebBrowser instance
is alive and can can invoke its methods.
isClosed
in interface WebBrowser
true
if the WebBrowser instance is closed and disposed.close()
public void setSilent(boolean isSilent)
setSilent
in interface WebBrowser
isSilent
- if true then enter to silent mode else leave silent mode.public boolean isSilent()
isSilent
in interface WebBrowser
public com.jniwrapper.win32.automation.OleMessageLoop getOleMessageLoop()
getOleMessageLoop
in interface WebBrowser
public void setProxy(ProxyConfiguration conf)
WebBrowser
Browsers.setProxy(ProxyConfiguration)
method.
setProxy
in interface WebBrowser
conf
- the proxy settings. This parameter cannot be
null
.WebBrowser.getProxy()
,
Browsers.setProxy(ProxyConfiguration)
public ProxyConfiguration getProxy()
WebBrowser
Browsers.getProxy()
method.
getProxy
in interface WebBrowser
WebBrowser.setProxy(ProxyConfiguration)
,
Browsers.getProxy()
public java.util.Set<Cookie> getCookies(java.net.URL url)
WebBrowser
It checks in the windows\cookies directory for persistent cookies that have an expiration date set sometime in the future.
It also searches memory for any session cookies, that is, cookies that do not have an expiration date that were created in the same process by CookieManager.setCookie(), because these cookies are not written to any files. Rules for creating cookie files are internal to the system and can change in the future.
Note: The method does not return cookies that the server marked as non-scriptable with the "HttpOnly" attribute in the Set-Cookie header.
getCookies
in interface WebBrowser
url
- specifies an URL.
public void setCookies(java.net.URL url, java.util.Set<Cookie> cookies)
WebBrowser
Cookies created by this method without an expiration date are stored in memory and are available only in the same process that created them. Cookies that include an expiration date are stored in the windows\cookies directory.
setCookies
in interface WebBrowser
url
- specifies an URL, a new cookie will be associated with.cookies
- the collection of Cookie
objects.public void setHttpSecurityHandler(HttpSecurityHandler h)
setHttpSecurityHandler
in interface WebBrowser
h
- the specified HTTP security handler.
java.lang.IllegalStateException
- when the passed browser does not have
a native peer or WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.getHttpSecurityHandler()
public HttpSecurityHandler getHttpSecurityHandler()
null
if it's not present. By default this
method always returns null
and all security problems are
processing by default Internet Explorer security handler.
getHttpSecurityHandler
in interface WebBrowser
null
if it's not present
java.lang.IllegalStateException
- when the passed browser does not have
a native peer or WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.setHttpSecurityHandler(com.jniwrapper.win32.ie.event.HttpSecurityHandler)
public void addDisposeListener(DisposeListener listener)
listener
for the current Browser instance
that will receive events when the current Browser instance
is disposed.
addDisposeListener
in interface WebBrowser
listener
- the listener to receive browser dispose events.public void removeDisposeListener(DisposeListener listener)
listener
so that it will not receive events
when the current Browser instance is disposed.
removeDisposeListener
in interface WebBrowser
listener
- the listener to remove.public DisposeListener[] getDisposeListeners()
getDisposeListeners
in interface WebBrowser
public void setHtmlDialogListener(HtmlDialogListener listener)
window.showModalDialog
and window.showModelessDialog
JavaScript functions.
listener
- the specified HTML Dialog listener.getHtmlDialogListener()
public HtmlDialogListener getHtmlDialogListener()
null
if it's not
registered.
null
if it's not
registered.setHtmlDialogListener(com.jniwrapper.win32.ie.event.HtmlDialogListener)
public void setDialogEventHandler(DialogEventHandler handler)
setDialogEventHandler
in interface WebBrowser
handler
- dialog event handler
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.getDialogEventHandler()
,
setSilent(boolean)
,
isSilent()
public DialogEventHandler getDialogEventHandler()
null
if it's
was not specified.
By default this method returns the BrowserDialogEventHandler
implementation.
getDialogEventHandler
in interface WebBrowser
null
if it's
was not specified.
java.lang.IllegalStateException
- when WebBrowser component was
disposed by invoking WebBrowser.close()
method or for some unknown reasons.setDialogEventHandler(DialogEventHandler)
,
setSilent(boolean)
,
isSilent()
public void setNewWindowHandler(NewWindowEventHandler newWindowHandler)
setNewWindowHandler
in interface WebBrowser
newWindowHandler
- new window handlerpublic NewWindowEventHandler getNewWindowHandler()
getNewWindowHandler
in interface WebBrowser
public void addNewWindowListener(NewWindowEventListener listener)
addNewWindowListener
in interface WebBrowser
listener
- new window listenerpublic void removeNewWindowListener(NewWindowEventListener listener)
removeNewWindowListener
in interface WebBrowser
listener
- new window listenerpublic java.util.List<NewWindowEventListener> getNewWindowListeners()
getNewWindowListeners
in interface WebBrowser
public void trackChildren()
trackChildren
in interface ParentWindow
public WebBrowser getRecentChild()
trackChildren()
method call.
getRecentChild
in interface ParentWindow
trackChildren()
method call.
If there isn't opened windows after this call then returns null.public WebBrowser waitChildCreation()
trackChildren()
call and returns this child.
In other words, this method waits until getRecentChild()
call
returns non-null object.
waitChildCreation
in interface ParentWindow
public WebBrowser waitChildCreation(java.lang.Runnable operationThatCreatesChild)
waitChildCreation
in interface ParentWindow
operationThatCreatesChild
- operation
public void setCookie(java.lang.String url, Cookie cookie)
CookieManager.setCookie(URL url, Cookie cookie)
or
CookieManager.setCookies(URL url, Set cookies)
methods instead.
InternetSetCookie
native function.
setCookie
in interface WebBrowser
url
- specifies an URL, a new cookie will be associated with.cookie
- specifies a new cookie.public java.util.Set<Cookie> getCookies(java.lang.String url)
CookieManager.getCookies(URL url)
method instead.
InternetGetCookie
native function.
getCookies
in interface WebBrowser
url
- specifies an URL.
public void setKeyFilter(KeyFilter keyFilter)
setKeyFilter
in interface WebBrowser
keyFilter
- key filterpublic KeyFilter getKeyFilter()
getKeyFilter
in interface WebBrowser
public java.awt.Image getScreenShot(boolean wholePage)
wholePage
- if true
returns the whole page not just what is visible
public java.awt.Image getScreenShot(java.awt.Dimension dimension)
dimension
- - dimension of area to render
public WebBrowser.Properties getProperties()
getProperties
in interface WebBrowser
public void addBrowserWindowListener(BrowserWindowListener listener)
addBrowserWindowListener
in interface WebBrowser
listener
- the window listenerpublic void removeBrowserWindowListener(BrowserWindowListener listener)
removeBrowserWindowListener
in interface WebBrowser
listener
- the window listenerpublic void setUserAgent(java.lang.String userAgent)
userAgent
- the user-agent string.getUserAgent()
public java.lang.String getUserAgent()
setUserAgent(String)
public java.lang.String getDefaultUserAgent()
setUserAgent(String)
public void setEnabled(boolean enabled)
setEnabled
in class javax.swing.JComponent
enabled
- true if this component should be enabled, false otherwisepublic void registerFunction(java.lang.String functionName, BrowserFunction function)
functionName
. The browser
function is not available anymore if document is reloaded or other web page
is loaded.
functionName
- function
- public int getZoomValue()
getZoomValue
in interface WebBrowser
public void setZoomValue(int value)
setZoomValue
in interface WebBrowser
protected void processComponentKeyEvent(java.awt.event.KeyEvent e)
processComponentKeyEvent
in class javax.swing.JComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |