Interface UISWTInstance

All Superinterfaces:
UIInstance
All Known Implementing Classes:
UISWTInstanceImpl, UISWTInstanceImpl.instanceWrapper

public interface UISWTInstance extends UIInstance
Tools to manage a SWT Instance
See Also:
  • Field Details

  • Method Details

    • getDisplay

      org.eclipse.swt.widgets.Display getDisplay()
      Retrieve the SWT Display object that Azureus uses (when in SWT mode). If you have a thread that does some periodic/asynchronous stuff, Azureus will crashes with and 'InvalidThreadAccess' exception unless you embed your calls in a Runnable, and use getDisplay().aSyncExec(Runnable r);
      Returns:
      SWT Display object that Azureus uses
      Since:
      2.3.0.5
    • loadImage

      org.eclipse.swt.graphics.Image loadImage(String resource)
    • createGraphic

      UISWTGraphic createGraphic(org.eclipse.swt.graphics.Image img)
      Creates an UISWTGraphic object with the supplied SWT Image
      Parameters:
      img - Image to assign to the object
      Returns:
      a new UISWTGraphic object
      Since:
      2.3.0.5
    • registerView

      void registerView(Class forDataSourceType, UISWTViewBuilder viewBuilder)
      Register a view that will be created when a certain datasource type is displayed

      For example, you can register an image rendering view for DiskManagerFileInfo

      When plugin is unloaded, any registrations will be automatically unregistered, and any views created from the builder will be automatically disposed

      Parameters:
      forDataSourceType - Class of datasource you want to add a view to, such as Download, DownloadTypeComplete, DownloadTypeIncomplete
      viewBuilder - use createViewBuilder(String, Class)
      Since:
      BiglyBT 2.1.0.1
    • registerView

      void registerView(String forViewID, UISWTViewBuilder viewBuilder)
      Register a view that will be created when the specified view is displayed

      When plugin is unloaded, any registrations will be automatically unregistered, and any views created from the builder will be automatically disposed

      Parameters:
      forViewID - VIEW_ Constant
      viewBuilder - use createViewBuilder(String, Class)
      Since:
      BiglyBT 2.1.0.1
    • createViewBuilder

      UISWTViewBuilder createViewBuilder(String viewID, Class<? extends UISWTViewEventListener> cla)
      Creates an object representing how your view is to be created
      Parameters:
      viewID - Unique ID of your view
      cla - A UISWTViewEventListener class that will be created when the UI shows the view.
      Since this class will be instantiated with cla.newInstance(), the class must be a top-level class, and not a local or non-static nested class.
      Returns:
      UISWTViewBuilder which has additional values you can set, such as initial datasource
      Since:
      BiglyBT 2.1.0.1
    • createViewBuilder

      UISWTViewBuilder createViewBuilder(String viewID)
      Creates an object representing how your view is to be created.

      At minimum, you will need to specify a way to instanatiate your listener, with one of the following methods:

    • UISWTViewBuilder.setListenerClass(Class)
    • UISWTViewBuilder#setListenerInstantiator(boolean, UISWTViewBuilder.UISWTViewEventListenerInstantiator)
    • Parameters:
      viewID - Unique ID of your view
      Returns:
      UISWTViewBuilder which has additional values you can set, such as initial datasource
      Since:
      BiglyBT 2.1.0.1
    • unregisterView

      void unregisterView(Class forDataSourceType, String viewID)
      Unregister and dispose of any previously created views of this viewID
      Since:
      BiglyBT 2.1.0.1
    • unregisterView

      void unregisterView(String forViewID, String viewID)
      Unregister and dispose of any previously created views of this viewID
      Since:
      BiglyBT 2.1.0.1
    • addView

      void addView(String sParentID, String sViewID, UISWTViewEventListener l)
      Add a detail view to an Azureus parent view. For views added to the Main window, this adds a menu option. For the other parent views, this adds a new tab within Azureus' own detail view.
      Parameters:
      sParentID - VIEW_* constant
      sViewID - of your view. Used as part of the resource id.
      "Views.plugins." + ID + ".title" = title of your view
      l - Listener to be triggered when parent view wants to tell you an event has happened
      Since:
      Azureus 2.3.0.6
    • addView

      void addView(String sParentViewID, String sViewID, Class<? extends UISWTViewEventListener> cla, Object initalDatasource)
      Deprecated.
      Add a view to an Apps parent view. For views added to the VIEW_MAIN window, this adds a menu option.

      In comparison to addView(String, String, UISWTViewEventListener), this method saves memory by not creating the UISWTViewEventListener until it is needed. It also ensures that only one UISWTViewEvent.TYPE_CREATE event is triggered per instance.

      Parameters:
      sParentViewID - VIEW_* constant
      sViewID - of your view. Used as part of the resource id.
      "Views.plugins." + ID + ".title" = title of your view
      cla - Class of the Listener to be created and triggered
      Since:
      Vuze 4.6.0.5
    • openView

      boolean openView(String sParentID, String sViewID, Object dataSource)
      Open a previously added view
      Parameters:
      sParentID - ParentID of the view to be shown
      sViewID - id of the view to be shown
      dataSource - any data you need to pass the view
      Returns:
      success level
      Since:
      2.5.0.1
    • openView

      boolean openView(String forViewID, String sViewID, Object dataSource, boolean setfocus)
      Open a previously added view
      Parameters:
      forViewID - View that the opened view belongs to
      sViewID - id of the view to be shown
      dataSource - any data you need to pass the view
      setfocus - true if you want to display the view immediately, false if you want to display it in the background.
      Returns:
      success level
      Since:
      3.0.5.3
    • openMainView

      void openMainView(String sViewID, UISWTViewEventListener l, Object dataSource)
      Create and open a view in the main window immediately. If you are calling this from UIManagerListener.UIAttached(UIInstance), the view will not gain focus.

      Tip: You can add a menu item to a table view, and when triggered, have it open a new window, passing the datasources that were selected

      Parameters:
      sViewID - ID to give your view
      l - Listener to be triggered when View Events occur
      dataSource - objects to set UISWTView.getDataSource() with
      Since:
      Azureus 2.3.0.6
    • openMainView

      void openMainView(String sViewID, UISWTViewEventListener l, Object dataSource, boolean setfocus)
      Create and open a view in the main window immediately. If you are calling this from UIManagerListener.UIAttached(UIInstance), the view will not gain focus.

      Tip: You can add a menu item to a table view, and when triggered, have it open a new window, passing the datasources that were selected

      Parameters:
      sViewID - ID to give your view
      l - Listener to be triggered when View Events occur
      dataSource - objects to set UISWTView.getDataSource() with
      setfocus - true if you want to display the view immediately, false if you want to display it in the background.
      Since:
      Vuze 3.0.5.3
    • removeViews

      void removeViews(String sParentID, String sViewID)
      Remove all views that belong to a specific parent and of a specific View ID. If the parent is the main window, the menu item will be removed.
      If you wish to remove (close) just one view, use UIPluginView.closeView()
      Parameters:
      sParentID - One of VIEW_* constants
      sViewID - View ID to remove
      Since:
      2.3.0.6
    • getOpenViews

      UISWTView[] getOpenViews(String sParentID)
      Get a list of views currently open on the specified VIEW_* view
      Parameters:
      sParentID - VIEW_* constant
      Returns:
      list of views currently open
      Since:
      2.3.0.6
    • showDownloadBar

      void showDownloadBar(Download download, boolean display)
      Shows or hides a download bar for a given download.
      Parameters:
      download - Download to use.
      display - true to show a download bar, false to hide it.
      Since:
      3.0.0.5
    • showTransfersBar

      void showTransfersBar(boolean display)
      Shows or hides the transfers bar.
      Parameters:
      display - true to show the bar, false to hide it.
      Since:
      3.0.1.3
    • createStatusEntry

      UISWTStatusEntry createStatusEntry()
      Creates an entry in the status bar to display custom status information.
      Since:
      3.0.0.7
      See Also:
    • openView

      boolean openView(BasicPluginViewModel model)
      Opens the window linked to a given BasicPluginViewModel object.
      Specified by:
      openView in interface UIInstance
      Returns:
      true if the view was opened successfully.
      Since:
      3.0.5.3
    • openConfig

      void openConfig(BasicPluginConfigModel model)
      Opens the window linked to a given BasicPluginViewModel object.
      Since:
      3.0.5.3
    • createShell

      org.eclipse.swt.widgets.Shell createShell(int style)
      Creates a SWT Shell, ensuring Vuze knows about it (ie. Icon, "Window" menu)
      Parameters:
      style -
      Returns:
      Since:
      4.2.0.9