Class UI

All Implemented Interfaces:
UIInstance, UIInstanceFactory, UIManagerEventListener, IUserInterface, UIInstanceBase

  • Field Details

  • Constructor Details

    • UI

      public UI()
  • Method Details

    • init

      public void init(boolean first, boolean others)
      Creates a new instance of Main
      Specified by:
      init in interface IUserInterface
      Overrides:
      init in class UITemplate
      Parameters:
      first - This UI Instance is the first on the command line and should take control of singular stuff (LocaleUtil and torrents added via Command Line).
      others - Indicates whether other UIs run along.
    • buildCommandLine

      public void buildCommandLine(org.apache.commons.cli.Options options)
      Specified by:
      buildCommandLine in interface IUserInterface
    • processArgs

      public String[] processArgs(org.apache.commons.cli.CommandLine commands, String[] args)
      Description copied from interface: IUserInterface
      Process arguments coming either from command line, or from startserver

      may be called before core is started

      Specified by:
      processArgs in interface IUserInterface
      Specified by:
      processArgs in class UITemplate
      Parameters:
      commands - query-able list of command line options
      args - all the arguments
      Returns:
      Unhandled arguments, or null you don't want any other UIs to be triggered
    • getUIType

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

      public void coreCreated(Core core)
      Description copied from interface: IUserInterface
      Core has been created, but not fully initialize (No GlobalManager, etc)

      Add your Core.addLifecycleListener(CoreLifecycleListener) to get your GlobalManager reference

      Specified by:
      coreCreated in interface IUserInterface
      Overrides:
      coreCreated in class UITemplate
    • startUI

      private void startUI()
    • openRemoteTorrent

      public void openRemoteTorrent(String url)
    • openTorrent

      public void openTorrent(String fileName, String save_path)
    • getInstance

      public UIInstance getInstance(PluginInterface plugin_interface)
      Description copied from interface: UIInstanceFactory
      Some UI instances need to understand which plugin they are associated with. This method gives the opportunity to customise the UIInstance returned to a plugin so that operations on it can take the appropriate actions
      Specified by:
      getInstance in interface UIInstanceFactory
    • detach

      public void detach() throws UIException
      Description copied from interface: UIInstanceFactory
      This method will be called by the UI manager when detaching the UI to permit the action to be vetoed/any detach logic to occur. It should not be directly called by the plugin code
      Specified by:
      detach in interface UIInstanceFactory
      Throws:
      UIException
    • dispose

      public void dispose()
      Description copied from interface: UIInstanceFactory
      This method will be called by the UI manager after the UIInstance is detached.
      Specified by:
      dispose in interface UIInstanceFactory
    • eventOccurred

      public boolean eventOccurred(UIManagerEvent event)
      Specified by:
      eventOccurred in interface UIManagerEventListener
      Parameters:
      event -
      Returns:
      true if the event has been handled
    • 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
      Parameters:
      title -
      text -
      options -
      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
      Parameters:
      options - List of options to present to the user. Typically shown as buttons
      listener - triggered after user chooses an option
    • openView

      public boolean openView(BasicPluginViewModel model)
      Specified by:
      openView in interface UIInstance
    • getInputReceiver

      public UIInputReceiver getInputReceiver()
      Not yet supported.
      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
    • 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