Class UI

    • Constructor Detail

      • UI

        public UI()
    • Method Detail

      • 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 java.lang.String[] processArgs​(org.apache.commons.cli.CommandLine commands,
                                              java.lang.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
      • startUI

        private void startUI()
      • openRemoteTorrent

        public void openRemoteTorrent​(java.lang.String url)
      • openTorrent

        public void openTorrent​(java.lang.String fileName,
                                java.lang.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
      • promptUser

        public int promptUser​(java.lang.String title,
                              java.lang.String text,
                              java.lang.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​(java.lang.String title,
                               java.lang.String text,
                               java.lang.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
      • 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