Class UISWTInstanceImpl.instanceWrapper

java.lang.Object
com.biglybt.ui.swt.pifimpl.UISWTInstanceImpl.instanceWrapper
All Implemented Interfaces:
UIToolBarManager, UIInstance, UIInstanceBase, UISWTInstance
Enclosing class:
UISWTInstanceImpl

protected static class UISWTInstanceImpl.instanceWrapper extends Object implements UISWTInstance, UIToolBarManager, UIInstanceBase
  • Field Details

  • Constructor Details

  • Method Details

    • getToolBarItem

      public UIToolBarItem getToolBarItem(String id)
      Specified by:
      getToolBarItem in interface UIToolBarManager
    • getAllToolBarItems

      public UIToolBarItem[] getAllToolBarItems()
      Specified by:
      getAllToolBarItems in interface UIToolBarManager
    • createToolBarItem

      public UIToolBarItem createToolBarItem(String id)
      Description copied from interface: UIToolBarManager
      Create a new UIToolBarItem. You will still need to add it via UIToolBarManager.addToolBarItem(UIToolBarItem), after setting the item's properties
      Specified by:
      createToolBarItem in interface UIToolBarManager
      Parameters:
      id - unique id
      Returns:
      newly created toolbar
    • addToolBarItem

      public void addToolBarItem(UIToolBarItem item)
      Description copied from interface: UIToolBarManager
      Adds a UIToolBarItem to the UI. Make sure you at least set the icon before adding
      Specified by:
      addToolBarItem in interface UIToolBarManager
    • removeToolBarItem

      public void removeToolBarItem(String id)
      Specified by:
      removeToolBarItem in interface UIToolBarManager
    • detach

      public void detach() throws UIException
      Throws:
      UIException
    • getUIType

      public String getUIType()
      Specified by:
      getUIType in interface UIInstance
      Returns:
    • getDisplay

      public org.eclipse.swt.widgets.Display getDisplay()
      Description copied from interface: UISWTInstance
      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);
      Specified by:
      getDisplay in interface UISWTInstance
      Returns:
      SWT Display object that Azureus uses
    • loadImage

      public org.eclipse.swt.graphics.Image loadImage(String resource)
      Specified by:
      loadImage in interface UISWTInstance
    • createGraphic

      public UISWTGraphic createGraphic(org.eclipse.swt.graphics.Image img)
      Description copied from interface: UISWTInstance
      Creates an UISWTGraphic object with the supplied SWT Image
      Specified by:
      createGraphic in interface UISWTInstance
      Parameters:
      img - Image to assign to the object
      Returns:
      a new UISWTGraphic object
    • addView

      @Deprecated public void addView(String sParentViewID, String sViewID, UISWTViewEventListener l)
      Deprecated.
      Description copied from interface: UISWTInstance
      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.
      Specified by:
      addView in interface UISWTInstance
      Parameters:
      sParentViewID - 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
    • addView

      public void addView(String sParentViewID, String sViewID, Class<? extends UISWTViewEventListener> cla, Object datasource)
      Description copied from interface: UISWTInstance
      Add a view to an Apps parent view. For views added to the UISWTInstance.VIEW_MAIN window, this adds a menu option.

      In comparison to UISWTInstance.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.

      Specified by:
      addView in interface UISWTInstance
      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
    • openMainView

      public void openMainView(String sViewID, UISWTViewEventListener l, Object dataSource)
      Description copied from interface: UISWTInstance
      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

      Specified by:
      openMainView in interface UISWTInstance
      Parameters:
      sViewID - ID to give your view
      l - Listener to be triggered when View Events occur
      dataSource - objects to set UISWTView.getDataSource() with
    • openMainView

      public void openMainView(String sViewID, UISWTViewEventListener l, Object dataSource, boolean setfocus)
      Description copied from interface: UISWTInstance
      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

      Specified by:
      openMainView in interface UISWTInstance
      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.
    • removeViews

      public void removeViews(String sParentID, String sViewID)
      Description copied from interface: UISWTInstance
      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()
      Specified by:
      removeViews in interface UISWTInstance
      Parameters:
      sParentID - One of VIEW_* constants
      sViewID - View ID to remove
    • getOpenViews

      public UISWTView[] getOpenViews(String sParentID)
      Description copied from interface: UISWTInstance
      Get a list of views currently open on the specified VIEW_* view
      Specified by:
      getOpenViews in interface UISWTInstance
      Parameters:
      sParentID - VIEW_* constant
      Returns:
      list of views currently open
    • promptUser

      public int promptUser(String title, String text, String[] options, int defaultOption)
      Description copied from interface: UIInstance
      Prompts the user with a title, text, and a series of options. The options are typically displayed as buttons.

      This method returns blocks the UI until the user makes a choice. It's recommended to use UIInstance.promptUser(String, String, String[], int, UIMessageListener) instead

      Specified by:
      promptUser in interface UIInstance
      Returns:
      Index of option chosen, -1 if cancelled or error
    • promptUser

      public void promptUser(String title, String text, String[] options, int defaultOption, UIMessageListener listener)
      Description copied from interface: UIInstance
      Prompts the user with a title, text, and a series of options. The options are typically displayed as buttons.

      This method returns immediately.

      Specified by:
      promptUser in interface UIInstance
      options - List of options to present to the user. Typically shown as buttons
      listener - triggered after user chooses an option
    • openView

      public boolean openView(String sParentID, String sViewID, Object dataSource)
      Description copied from interface: UISWTInstance
      Open a previously added view
      Specified by:
      openView in interface UISWTInstance
      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
    • openView

      public boolean openView(String forViewID, String sViewID, Object dataSource, boolean setfocus)
      Description copied from interface: UISWTInstance
      Open a previously added view
      Specified by:
      openView in interface UISWTInstance
      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
    • getInputReceiver

      public UIInputReceiver getInputReceiver()
      Description copied from interface: UIInstance
      Creates a UIInputReceiver instance to allow a plugin to request text input from the user. Some interfaces may not allow or support the ability for a plugin to request text input from a user, in which case they will return null for this method.
      Specified by:
      getInputReceiver in interface UIInstance
    • createMessage

      public UIMessage createMessage()
      Description copied from interface: UIInstance
      Creates a UIMessage instance to allow a plugin to inform or ask the user something. Some interfaces may not allow or support the ability for a plugin to ask a user in this manner, in which case they will return null for this method.
      Specified by:
      createMessage in interface UIInstance
    • showDownloadBar

      public void showDownloadBar(Download download, boolean display)
      Description copied from interface: UISWTInstance
      Shows or hides a download bar for a given download.
      Specified by:
      showDownloadBar in interface UISWTInstance
      Parameters:
      download - Download to use.
      display - true to show a download bar, false to hide it.
    • showTransfersBar

      public void showTransfersBar(boolean display)
      Description copied from interface: UISWTInstance
      Shows or hides the transfers bar.
      Specified by:
      showTransfersBar in interface UISWTInstance
      Parameters:
      display - true to show the bar, false to hide it.
    • createStatusEntry

      public UISWTStatusEntry createStatusEntry()
      Description copied from interface: UISWTInstance
      Creates an entry in the status bar to display custom status information.
      Specified by:
      createStatusEntry in interface UISWTInstance
      See Also:
    • openView

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

      public void openConfig(BasicPluginConfigModel model)
      Description copied from interface: UISWTInstance
      Opens the window linked to a given BasicPluginViewModel object.
      Specified by:
      openConfig in interface UISWTInstance
    • createShell

      public org.eclipse.swt.widgets.Shell createShell(int style)
      Description copied from interface: UISWTInstance
      Creates a SWT Shell, ensuring Vuze knows about it (ie. Icon, "Window" menu)
      Specified by:
      createShell in interface UISWTInstance
      Returns:
    • getToolBarManager

      public UIToolBarManager getToolBarManager()
      Specified by:
      getToolBarManager in interface UIInstance
    • unload

      public void unload(PluginInterface pi)
      Description copied from interface: UIInstanceBase
      PluginInterface is unloading.. destroy anything related to it
      Specified by:
      unload in interface UIInstanceBase
    • createViewBuilder

      public UISWTViewBuilder createViewBuilder(String viewID, Class<? extends UISWTViewEventListener> cla)
      Description copied from interface: UISWTInstance
      Creates an object representing how your view is to be created
      Specified by:
      createViewBuilder in interface UISWTInstance
      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
    • createViewBuilder

      public UISWTViewBuilder createViewBuilder(String viewID)
      Description copied from interface: UISWTInstance
      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)
    • Specified by:
      createViewBuilder in interface UISWTInstance
      Parameters:
      viewID - Unique ID of your view
      Returns:
      UISWTViewBuilder which has additional values you can set, such as initial datasource
    • registerView

      public void registerView(Class forDataSourceType, UISWTViewBuilder viewBuilder)
      Description copied from interface: UISWTInstance
      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

      Specified by:
      registerView in interface UISWTInstance
      Parameters:
      forDataSourceType - Class of datasource you want to add a view to, such as Download, DownloadTypeComplete, DownloadTypeIncomplete
      viewBuilder - use UISWTInstance.createViewBuilder(String, Class)
    • registerView

      public void registerView(String forViewID, UISWTViewBuilder viewBuilder)
      Description copied from interface: UISWTInstance
      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

      Specified by:
      registerView in interface UISWTInstance
      Parameters:
      forViewID - VIEW_ Constant
      viewBuilder - use UISWTInstance.createViewBuilder(String, Class)
    • unregisterView

      public void unregisterView(String forViewID, String viewID)
      Description copied from interface: UISWTInstance
      Unregister and dispose of any previously created views of this viewID
      Specified by:
      unregisterView in interface UISWTInstance
    • unregisterView

      public void unregisterView(Class forDataSourceType, String viewID)
      Description copied from interface: UISWTInstance
      Unregister and dispose of any previously created views of this viewID
      Specified by:
      unregisterView in interface UISWTInstance