Package de.aristaflow.adept2.ui.swtgui
Class SwtUrlContext
- java.lang.Object
-
- de.aristaflow.adept2.ui.swtgui.SwtUrlContext
-
- All Implemented Interfaces:
GUIContext
,URLContext
,Closeable
,AutoCloseable
public class SwtUrlContext extends Object implements URLContext
ThisGUIContext
provides a browser widget in SWT for a specific URL based on a parent context. Closing will be forwarded to the parent context.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SwtUrlContext.BrowserCloseTask
The clean-up task for closing the browser.
-
Field Summary
Fields Modifier and Type Field Description protected URL
baseUrl
The base URL providing the HTML to be displayed in this context.protected Cleanup<RuntimeException>
cleanup
The clean-up for closing the parent context and the browser as post-mortem task for this instance.protected SWTContext
parentSwtContext
The parent SWT-context containing the Eclipse-Editor.
-
Constructor Summary
Constructors Constructor Description SwtUrlContext(URL baseURL, SWTContext parentSWTContext)
Creates a new URL context based on the Eclipse-Browser-widget.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the GUI for this context.protected org.eclipse.swt.browser.Browser
createBrowser(SWTContext parent)
Creates and initialises the browser with the base URL of this context.URL
getURL()
Gets the URL of the (remote)HTMLContext
which provides the GUI.
-
-
-
Field Detail
-
baseUrl
protected final URL baseUrl
The base URL providing the HTML to be displayed in this context.
-
parentSwtContext
protected final SWTContext parentSwtContext
The parent SWT-context containing the Eclipse-Editor.
-
cleanup
protected final Cleanup<RuntimeException> cleanup
The clean-up for closing the parent context and the browser as post-mortem task for this instance.
-
-
Constructor Detail
-
SwtUrlContext
public SwtUrlContext(URL baseURL, SWTContext parentSWTContext)
Creates a new URL context based on the Eclipse-Browser-widget.- Parameters:
baseURL
- The base URL providing the HTML to be displayed in the created context.parentSWTContext
- The parent SWT-context containing the Eclipse-Editor.
-
-
Method Detail
-
createBrowser
protected org.eclipse.swt.browser.Browser createBrowser(SWTContext parent)
Creates and initialises the browser with the base URL of this context.
-
close
public void close()
Description copied from interface:GUIContext
Closes the GUI for this context. This method has to be called by the runtime manager whenever an application has terminated (finished, failed, aborted, killed,...).
It must be possible to call this method more than once, even if the GUIContext has already shut down. This especially applies to the disposal of SWT-widgets, that is, it is allowed to call this method after the disposal of the corresponding widgets.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceGUIContext
-
getURL
public URL getURL()
Description copied from interface:URLContext
Gets the URL of the (remote)HTMLContext
which provides the GUI.- Specified by:
getURL
in interfaceURLContext
- Returns:
- The URL of the (remote)
HTMLContext
which provides the GUI.
-
-