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
This GUIContext 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 final class 
    The clean-up task for closing the browser.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final URL
    The base URL providing the HTML to be displayed in this context.
    protected final Cleanup<RuntimeException>
    The clean-up for closing the parent context and the browser as post-mortem task for this instance.
    protected final SWTContext
    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

    Modifier and Type
    Method
    Description
    void
    Closes the GUI for this context.
    protected org.eclipse.swt.browser.Browser
    Creates and initialises the browser with the base URL of this context.
    Gets the URL of the (remote) HTMLContext which provides the GUI.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • 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 Details

    • 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 Details

    • 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 interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface GUIContext
    • getURL

      public URL getURL()
      Description copied from interface: URLContext
      Gets the URL of the (remote) HTMLContext which provides the GUI.
      Specified by:
      getURL in interface URLContext
      Returns:
      The URL of the (remote) HTMLContext which provides the GUI.