Class Browser
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- com.equo.chromium.swt.Browser
-
- All Implemented Interfaces:
- org.eclipse.swt.graphics.Drawable
public class Browser extends org.eclipse.swt.widgets.Composite
Instances of this class implement the browser user interface. This class replaces org.eclipse.swt.browser.Browser to use the Equo Chromium browser.
-
-
Constructor Summary
Constructors Constructor and Description Browser(org.eclipse.swt.widgets.Composite parent, int style)
Browser(Object composite, int style)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addAuthenticationListener(org.eclipse.swt.browser.AuthenticationListener listener)
Adds the listener to the collection of listeners who will be notified when authentication is required.void
addCloseWindowListener(org.eclipse.swt.browser.CloseWindowListener listener)
Adds the listener to the collection of listeners who will be notified when the window hosting the receiver should be closed.void
addLocationListener(org.eclipse.swt.browser.LocationListener listener)
Adds the listener to the collection of listeners who will be notified when the current location has changed or is about to change.void
addOpenWindowListener(OpenWindowListener listener)
Adds the listener to the collection of listeners who will be notified when a new window needs to be created.void
addProgressListener(org.eclipse.swt.browser.ProgressListener listener)
Adds the listener to the collection of listeners who will be notified when a progress is made during the loading of the current URL or when the loading of the current URL has been completed.void
addStatusTextListener(org.eclipse.swt.browser.StatusTextListener listener)
Adds the listener to the collection of listeners who will be notified when the status text is changed.void
addTitleListener(org.eclipse.swt.browser.TitleListener listener)
Adds the listener to the collection of listeners who will be notified when the title of the current document is available or has changed.void
addVisibilityWindowListener(org.eclipse.swt.browser.VisibilityWindowListener listener)
Adds the listener to the collection of listeners who will be notified when a window hosting the receiver needs to be displayed or hidden.boolean
back()
Navigate to the previous session history item.static void
clearSessions()
Clears all session cookies from all current Browser instances.boolean
close()
Attempts to dispose the receiver, but allows the dispose to be vetoed by the user in response to anonbeforeunload
listener in the Browser's current page.void
dispose()
Disposes of the operating system resources associated with the receiver and all its descendants.Object
evaluate(String script)
Returns the result, if any, of executing the specified script.Object
evaluate(String script, boolean trusted)
Returns the result, if any, of executing the specified script.boolean
execute(String script)
Executes the specified script.boolean
forward()
Navigate to the next session history item.String
getBrowserType()
Returns the type of native browser being used by this instance.static String
getCookie(String name, String url)
Returns the value of a cookie that is associated with a URL.boolean
getJavascriptEnabled()
Returnstrue
if javascript will be allowed to run in pages subsequently viewed in the receiver, andfalse
otherwise.int
getStyle()
Returns the receiver's style information.String
getText()
Returns a string with HTML that represents the content of the current page.String
getUrl()
Returns the current URL.Object
getWebBrowser()
Gets a ChromiumBrowser API instance for the current browser.boolean
isBackEnabled()
Returnstrue
if the receiver can navigate to the previous session history item, andfalse
otherwise.boolean
isFocusControl()
Returnstrue
if the receiver has the user-interface focus, andfalse
otherwise.boolean
isForwardEnabled()
Returnstrue
if the receiver can navigate to the next session history item, andfalse
otherwise.void
refresh()
Refresh the current page.void
removeAuthenticationListener(org.eclipse.swt.browser.AuthenticationListener listener)
Removes the listener from the collection of listeners who will be notified when authentication is required.void
removeCloseWindowListener(org.eclipse.swt.browser.CloseWindowListener listener)
Removes the listener from the collection of listeners who will be notified when the window hosting the receiver should be closed.void
removeLocationListener(org.eclipse.swt.browser.LocationListener listener)
Removes the listener from the collection of listeners who will be notified when the current location is changed or about to be changed.void
removeOpenWindowListener(OpenWindowListener listener)
Removes the listener from the collection of listeners who will be notified when a new window needs to be created.void
removeProgressListener(org.eclipse.swt.browser.ProgressListener listener)
Removes the listener from the collection of listeners who will be notified when a progress is made during the loading of the current URL or when the loading of the current URL has been completed.void
removeStatusTextListener(org.eclipse.swt.browser.StatusTextListener listener)
Removes the listener from the collection of listeners who will be notified when the status text is changed.void
removeTitleListener(org.eclipse.swt.browser.TitleListener listener)
Removes the listener from the collection of listeners who will be notified when the title of the current document is available or has changed.void
removeVisibilityWindowListener(org.eclipse.swt.browser.VisibilityWindowListener listener)
Removes the listener from the collection of listeners who will be notified when a window hosting the receiver needs to be displayed or hidden.static boolean
setCookie(String value, String url)
Sets a cookie on a URL.void
setJavascriptEnabled(boolean enabled)
Sets whether javascript will be allowed to run in pages subsequently viewed in the receiver.boolean
setText(String html)
Renders a string containing HTML.boolean
setText(String html, boolean trusted)
Renders a string containing HTML.boolean
setUrl(String url)
Begins loading a URL.boolean
setUrl(String url, String postData, String[] headers)
Begins loading a URL.void
stop()
Stop any loading and rendering activity.-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, computeSize, drawBackground, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getBorderWidth, getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
-
-
-
Constructor Detail
-
Browser
public Browser(Object composite, int style)
-
Browser
public Browser(org.eclipse.swt.widgets.Composite parent, int style)
-
-
Method Detail
-
clearSessions
public static void clearSessions()
Clears all session cookies from all current Browser instances.- Since:
- 3.2
-
getCookie
public static String getCookie(String name, String url)
Returns the value of a cookie that is associated with a URL. Note that cookies are shared amongst all Browser instances.- Parameters:
name
- the cookie nameurl
- the URL that the cookie is associated with- Returns:
- the cookie value, or
null
if no such cookie exists - Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the name is null
- ERROR_NULL_ARGUMENT - if the url is null
- Since:
- 3.5
-
setCookie
public static boolean setCookie(String value, String url)
Sets a cookie on a URL. Note that cookies are shared amongst all Browser instances. Thevalue
parameter must be a cookie header string that complies with RFC 2109. The value is passed through to the native browser unchanged.Example value strings:
foo=bar
(basic session cookie)foo=bar; path=/; domain=.eclipse.org
(session cookie)foo=bar; expires=Thu, 01-Jan-2030 00:00:01 GMT
(persistent cookie)foo=; expires=Thu, 01-Jan-1970 00:00:01 GMT
(deletes cookiefoo
)- Parameters:
value
- the cookie valueurl
- the URL to associate the cookie with- Returns:
true
if the cookie was successfully set andfalse
otherwise- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the value is null
- ERROR_NULL_ARGUMENT - if the url is null
- Since:
- 3.5
-
addAuthenticationListener
public void addAuthenticationListener(org.eclipse.swt.browser.AuthenticationListener listener)
Adds the listener to the collection of listeners who will be notified when authentication is required.This notification occurs when a page requiring authentication is encountered.
- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.5
-
addCloseWindowListener
public void addCloseWindowListener(org.eclipse.swt.browser.CloseWindowListener listener)
Adds the listener to the collection of listeners who will be notified when the window hosting the receiver should be closed.This notification occurs when a javascript command such as
window.close
gets executed by aBrowser
.- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
addLocationListener
public void addLocationListener(org.eclipse.swt.browser.LocationListener listener)
Adds the listener to the collection of listeners who will be notified when the current location has changed or is about to change.This notification typically occurs when the application navigates to a new location with
setUrl(String)
or when the user activates a hyperlink.- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
addOpenWindowListener
public void addOpenWindowListener(OpenWindowListener listener)
Adds the listener to the collection of listeners who will be notified when a new window needs to be created.This notification occurs when a javascript command such as
window.open
gets executed by aBrowser
.- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
addProgressListener
public void addProgressListener(org.eclipse.swt.browser.ProgressListener listener)
Adds the listener to the collection of listeners who will be notified when a progress is made during the loading of the current URL or when the loading of the current URL has been completed.- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
addStatusTextListener
public void addStatusTextListener(org.eclipse.swt.browser.StatusTextListener listener)
Adds the listener to the collection of listeners who will be notified when the status text is changed.The status text is typically displayed in the status bar of a browser application.
- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
addTitleListener
public void addTitleListener(org.eclipse.swt.browser.TitleListener listener)
Adds the listener to the collection of listeners who will be notified when the title of the current document is available or has changed.- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
addVisibilityWindowListener
public void addVisibilityWindowListener(org.eclipse.swt.browser.VisibilityWindowListener listener)
Adds the listener to the collection of listeners who will be notified when a window hosting the receiver needs to be displayed or hidden.- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
back
public boolean back()
Navigate to the previous session history item.- Returns:
true
if the operation was successful andfalse
otherwise- Throws:
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
- See Also:
forward()
-
execute
public boolean execute(String script)
Executes the specified script.Executes a script containing javascript commands in the context of the current document. If document-defined functions or properties are accessed by the script then this method should not be invoked until the document has finished loading (
ProgressListener.completed()
gives notification of this).- Parameters:
script
- the script with javascript commands- Returns:
true
if the operation was successful andfalse
otherwise- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the script is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.1
- See Also:
ProgressListener.completed(ProgressEvent)
-
close
public boolean close()
Attempts to dispose the receiver, but allows the dispose to be vetoed by the user in response to anonbeforeunload
listener in the Browser's current page.- Returns:
true
if the receiver was disposed, andfalse
otherwise- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.6
- See Also:
dispose()
-
evaluate
public Object evaluate(String script) throws org.eclipse.swt.SWTException
Returns the result, if any, of executing the specified script.Evaluates a script containing javascript commands in the context of the current document. If document-defined functions or properties are accessed by the script then this method should not be invoked until the document has finished loading (
ProgressListener.completed()
gives notification of this).If the script returns a value with a supported type then a java representation of the value is returned. The supported javascript -> java mappings are:
- javascript null or undefined ->
null
- javascript number ->
java.lang.Double
- javascript string ->
java.lang.String
- javascript boolean ->
java.lang.Boolean
- javascript array whose elements are all of supported types ->
java.lang.Object[]
SWTException
is thrown if the return value has an unsupported type, or if evaluating the script causes a javascript error to be thrown.- Parameters:
script
- the script with javascript commands- Returns:
- the return value, if any, of executing the script
- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the script is null
org.eclipse.swt.SWTException
-- ERROR_FAILED_EVALUATE when the script evaluation causes a javascript error to be thrown
- ERROR_INVALID_RETURN_VALUE when the script returns a value of unsupported type
- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.5
- See Also:
evaluate(String,boolean)
,ProgressListener.completed(ProgressEvent)
- javascript null or undefined ->
-
evaluate
public Object evaluate(String script, boolean trusted) throws org.eclipse.swt.SWTException
Returns the result, if any, of executing the specified script.Evaluates a script containing javascript commands. When
trusted
istrue
script is executed in the context of Chrome with Chrome security privileges. Whentrusted
isfalse
script is executed in the context of the current document with normal privileges.If document-defined functions or properties are accessed by the script then this method should not be invoked until the document has finished loading (
ProgressListener.completed()
gives notification of this).If the script returns a value with a supported type then a java representation of the value is returned. The supported javascript -> java mappings are:
- javascript null or undefined ->
null
- javascript number ->
java.lang.Double
- javascript string ->
java.lang.String
- javascript boolean ->
java.lang.Boolean
- javascript array whose elements are all of supported types ->
java.lang.Object[]
SWTException
is thrown if the return value has an unsupported type, or if evaluating the script causes a javascript error to be thrown.Note: Chrome security context is applicable only to Browsers with style
SWT.Mozilla
.- Parameters:
script
- the script with javascript commandstrusted
-true> or
false
depending on the security context to be used- Returns:
- the return value, if any, of executing the script
- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the script is null
org.eclipse.swt.SWTException
-- ERROR_FAILED_EVALUATE when the script evaluation causes a javascript error to be thrown
- ERROR_INVALID_RETURN_VALUE when the script returns a value of unsupported type
- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- See Also:
ProgressListener.completed(ProgressEvent)
- javascript null or undefined ->
-
forward
public boolean forward()
Navigate to the next session history item.- Returns:
true
if the operation was successful andfalse
otherwise- Throws:
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
- See Also:
back()
-
getBrowserType
public String getBrowserType()
Returns the type of native browser being used by this instance. Examples: "ie", "mozilla", "voyager", "webkit"- Returns:
- the type of the native browser
- Since:
- 3.5
-
getJavascriptEnabled
public boolean getJavascriptEnabled()
Returnstrue
if javascript will be allowed to run in pages subsequently viewed in the receiver, andfalse
otherwise. Note that this may not reflect the javascript enablement on the currently- viewed page ifsetJavascriptEnabled()
has been invoked during its lifetime.- Returns:
- the receiver's javascript enabled state
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.5
- See Also:
setJavascriptEnabled(boolean)
-
getStyle
public int getStyle()
Returns the receiver's style information.Note that the value which is returned by this method may not match the value which was provided to the constructor when the receiver was created. This can occur when the underlying operating system does not support a particular combination of requested styles. For example, if the platform widget used to implement a particular SWT widget always has scroll bars, the result of calling this method would always have the
SWT.H_SCROLL
andSWT.V_SCROLL
bits set.- Overrides:
getStyle
in classorg.eclipse.swt.widgets.Widget
- Returns:
- the style bits
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getText
public String getText()
Returns a string with HTML that represents the content of the current page.- Returns:
- HTML representing the current page or an empty
String
if this is empty.
Note, the exact return value is platform dependent. For example on Windows, the returned string is the proccessed webpage with javascript executed and missing html tags added. On Linux and OS X, this returns the original HTML before the browser has processed it.
- Throws:
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.4
-
getUrl
public String getUrl()
Returns the current URL.- Returns:
- the current URL or an empty
String
if there is no current URL - Throws:
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
- See Also:
setUrl(java.lang.String)
-
isBackEnabled
public boolean isBackEnabled()
Returnstrue
if the receiver can navigate to the previous session history item, andfalse
otherwise.- Returns:
- the receiver's back command enabled state
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
back()
-
isFocusControl
public boolean isFocusControl()
Returnstrue
if the receiver has the user-interface focus, andfalse
otherwise.- Overrides:
isFocusControl
in classorg.eclipse.swt.widgets.Control
- Returns:
- the receiver's focus state
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
isForwardEnabled
public boolean isForwardEnabled()
Returnstrue
if the receiver can navigate to the next session history item, andfalse
otherwise.- Returns:
- the receiver's forward command enabled state
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
forward()
-
refresh
public void refresh()
Refresh the current page.- Throws:
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
removeAuthenticationListener
public void removeAuthenticationListener(org.eclipse.swt.browser.AuthenticationListener listener)
Removes the listener from the collection of listeners who will be notified when authentication is required.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.5
-
removeCloseWindowListener
public void removeCloseWindowListener(org.eclipse.swt.browser.CloseWindowListener listener)
Removes the listener from the collection of listeners who will be notified when the window hosting the receiver should be closed.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
removeLocationListener
public void removeLocationListener(org.eclipse.swt.browser.LocationListener listener)
Removes the listener from the collection of listeners who will be notified when the current location is changed or about to be changed.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
removeOpenWindowListener
public void removeOpenWindowListener(OpenWindowListener listener)
Removes the listener from the collection of listeners who will be notified when a new window needs to be created.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
removeProgressListener
public void removeProgressListener(org.eclipse.swt.browser.ProgressListener listener)
Removes the listener from the collection of listeners who will be notified when a progress is made during the loading of the current URL or when the loading of the current URL has been completed.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
removeStatusTextListener
public void removeStatusTextListener(org.eclipse.swt.browser.StatusTextListener listener)
Removes the listener from the collection of listeners who will be notified when the status text is changed.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
removeTitleListener
public void removeTitleListener(org.eclipse.swt.browser.TitleListener listener)
Removes the listener from the collection of listeners who will be notified when the title of the current document is available or has changed.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
removeVisibilityWindowListener
public void removeVisibilityWindowListener(org.eclipse.swt.browser.VisibilityWindowListener listener)
Removes the listener from the collection of listeners who will be notified when a window hosting the receiver needs to be displayed or hidden.- Parameters:
listener
- the listener which should no longer be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
setJavascriptEnabled
public void setJavascriptEnabled(boolean enabled)
Sets whether javascript will be allowed to run in pages subsequently viewed in the receiver. Note that setting this value does not affect the running of javascript in the current page.- Parameters:
enabled
- the receiver's new javascript enabled state- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.5
-
setText
public boolean setText(String html)
Renders a string containing HTML. The rendering of the content occurs asynchronously. The rendered page will be given trusted permissions; to render the page with untrusted permissions usesetText(String html, boolean trusted)
instead.The html parameter is Unicode-encoded since it is a java
String
. As a result, the HTML meta tag charset should not be set. The charset is implied by theString
itself.- Parameters:
html
- the HTML content to be rendered- Returns:
- true if the operation was successful and false otherwise.
- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the html is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
- See Also:
setText(String,boolean)
,setUrl(java.lang.String)
-
setText
public boolean setText(String html, boolean trusted)
Renders a string containing HTML. The rendering of the content occurs asynchronously. The rendered page can be given either trusted or untrusted permissions.The
html
parameter is Unicode-encoded since it is a javaString
. As a result, the HTML meta tag charset should not be set. The charset is implied by theString
itself.The
trusted
parameter affects the permissions that will be granted to the rendered page. Specifyingtrue
for trusted gives the page permissions equivalent to a page on the local file system, while specifyingfalse
for trusted gives the page permissions equivalent to a page from the internet. Page content should be specified as trusted if the invoker created it or trusts its source, since this would allow (for instance) style sheets on the local file system to be referenced. Page content should be specified as untrusted if its source is not trusted or is not known.- Parameters:
html
- the HTML content to be renderedtrusted
-false
if the rendered page should be granted restricted permissions andtrue
otherwise- Returns:
true
if the operation was successful andfalse
otherwise.- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the html is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.6
- See Also:
setText(String)
,setUrl(java.lang.String)
-
setUrl
public boolean setUrl(String url)
Begins loading a URL. The loading of its content occurs asynchronously.- Parameters:
url
- the URL to be loaded- Returns:
- true if the operation was successful and false otherwise.
- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the url is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
- See Also:
getUrl()
,setUrl(String,String,String[])
-
setUrl
public boolean setUrl(String url, String postData, String[] headers)
Begins loading a URL. The loading of its content occurs asynchronously.If the URL causes an HTTP request to be initiated then the provided
postData
andheader
arguments, if any, are sent with the request. A value in theheaders
argument must be a name-value pair with a colon separator in order to be sent (for example: "user-agent: custom
").- Parameters:
url
- the URL to be loadedpostData
- post data to be sent with the request, ornull
headers
- header lines to be sent with the request, ornull
- Returns:
true
if the operation was successful andfalse
otherwise.- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the url is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.6
-
stop
public void stop()
Stop any loading and rendering activity.- Throws:
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- ERROR_WIDGET_DISPOSED when the widget has been disposed
- Since:
- 3.0
-
dispose
public void dispose()
Disposes of the operating system resources associated with the receiver and all its descendants. After this method has been invoked, the receiver and all descendants will answertrue
when sent the messageisDisposed()
. Any internal connections between the widgets in the tree will have been removed to facilitate garbage collection. This method does nothing if the widget is already disposed.NOTE: This method is not called recursively on the descendants of the receiver. This means that, widget implementers can not detect when a widget is being disposed of by re-implementing this method, but should instead listen for the
Dispose
event.- Overrides:
dispose
in classorg.eclipse.swt.widgets.Widget
- Throws:
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getWebBrowser
public Object getWebBrowser()
Gets a ChromiumBrowser API instance for the current browser.- Returns:
- Returns a ChromiumBrowser API instance for the current browser.
-
-
Copyright © 2024. All rights reserved.