Class BrowserFactory
Browser
. This offers several benefits over creating Browser normal
way:
- The same factory can be used many times to create several Browser instances
- The setters on BrowserFactory all return "this", allowing them to be chained
Browser browser = BrowserFactory.newBrowser(SWT.NONE)// .url("http://www.eclipse.org") // .layoutData(gridData) // .create(parent);
The above example creates a Browser for the eclipse website. Finally the Browser is created in "parent".
BrowserFactory browserFactory = BrowserFactory.newGroup(SWT.NONE); browserFactory.url("http://www.eclipse.org").create(parent); browserFactory.url("https://www.eclipse.org/projects/").create(parent); browserFactory.url("https://www.eclipse.org/donate/").create(parent);
The above example creates three browser using the same instance of BrowserFactory.
- Since:
- 3.25
-
Method Summary
Modifier and TypeMethodDescriptionSets that javascript will not be allowed to run in pages subsequently viewed in the receiver.Renders a string containing HTML.Renders a string containing HTML.static BrowserFactory
newBrowser
(int style) Creates a new BrowserFactory with the given style.Begins loading a URL.Begins loading a URL.Methods inherited from class org.eclipse.jface.widgets.AbstractCompositeFactory
layout
Methods inherited from class org.eclipse.jface.widgets.AbstractControlFactory
background, enabled, font, foreground, layoutData, orientation, supplyLayoutData, tooltip
Methods inherited from class org.eclipse.jface.widgets.AbstractWidgetFactory
addProperty, cast, create, data, data
-
Method Details
-
newBrowser
Creates a new BrowserFactory with the given style. Refer toBrowser(Composite, int)
for possible styles.- Returns:
- a new BrowserFactory instance
-
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- Returns:
- this
- See Also:
-
html
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 htmltrusted
-false
if the rendered page should be granted restricted permissions andtrue
otherwise- Returns:
- this
- See Also:
-
url
Begins loading a URL. The loading of its content occurs asynchronously.- Parameters:
url
- the URL to be loaded- Returns:
- this
- See Also:
-
url
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:
- this
- See Also:
-
disableJS
Sets that javascript will not 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.- Returns:
- this
- See Also:
-