Package com.biglybt.ui.console
Class UI
java.lang.Object
com.biglybt.ui.common.UITemplate
com.biglybt.ui.common.UITemplateHeadless
com.biglybt.ui.console.UI
- All Implemented Interfaces:
UIInstance
,UIInstanceFactory
,UIManagerEventListener
,IUserInterface
,UIInstanceBase
public class UI
extends UITemplateHeadless
implements IUserInterface, UIInstanceFactory, UIInstanceBase, UIManagerEventListener
-
Field Summary
FieldsFields inherited from class com.biglybt.ui.common.UITemplate
core
Fields inherited from interface com.biglybt.pif.ui.UIInstance
UIT_CONSOLE, UIT_SWT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildCommandLine
(org.apache.commons.cli.Options options) void
coreCreated
(Core core) Core has been created, but not fully initialize (No GlobalManager, etc)Creates aUIMessage
instance to allow a plugin to inform or ask the user something.void
detach()
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.void
dispose()
This method will be called by the UI manager after the UIInstance is detached.boolean
eventOccurred
(UIManagerEvent event) Not yet supported.getInstance
(PluginInterface plugin_interface) Some UI instances need to understand which plugin they are associated with.void
init
(boolean first, boolean others) Creates a new instance of Mainvoid
openRemoteTorrent
(String url) void
openTorrent
(String fileName, String save_path) boolean
openView
(BasicPluginViewModel model) String[]
processArgs
(org.apache.commons.cli.CommandLine commands, String[] args) Process arguments coming either from command line, or from startserverint
promptUser
(String title, String text, String[] options, int defaultOption) Prompts the user with a title, text, and a series of options.void
promptUser
(String title, String text, String[] options, int defaultOption, UIMessageListener listener) Prompts the user with a title, text, and a series of options.private void
startUI()
void
PluginInterface is unloading..Methods inherited from class com.biglybt.ui.common.UITemplate
hasOthers, isFirst, takeMainThread
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.biglybt.ui.common.IUserInterface
takeMainThread
-
Field Details
-
console
-
-
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 interfaceIUserInterface
- Overrides:
init
in classUITemplate
- 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 interfaceIUserInterface
-
processArgs
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 interfaceIUserInterface
- Specified by:
processArgs
in classUITemplate
- Parameters:
commands
- query-able list of command line optionsargs
- all the arguments- Returns:
- Unhandled arguments, or null you don't want any other UIs to be triggered
-
getUIType
- Specified by:
getUIType
in interfaceUIInstance
- Specified by:
getUIType
in interfaceUIInstanceFactory
- Returns:
-
coreCreated
Description copied from interface:IUserInterface
Core has been created, but not fully initialize (No GlobalManager, etc) Add yourCore.addLifecycleListener(CoreLifecycleListener)
to get your GlobalManager reference- Specified by:
coreCreated
in interfaceIUserInterface
- Overrides:
coreCreated
in classUITemplate
-
startUI
private void startUI() -
openRemoteTorrent
-
openTorrent
-
getInstance
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 interfaceUIInstanceFactory
-
detach
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 interfaceUIInstanceFactory
- 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 interfaceUIInstanceFactory
-
eventOccurred
- Specified by:
eventOccurred
in interfaceUIManagerEventListener
- Returns:
- true if the event has been handled
-
promptUser
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 useUIInstance.promptUser(String, String, String[], int, UIMessageListener)
instead- Specified by:
promptUser
in interfaceUIInstance
- 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 interfaceUIInstance
options
- List of options to present to the user. Typically shown as buttonslistener
- triggered after user chooses an option
-
openView
- Specified by:
openView
in interfaceUIInstance
-
getInputReceiver
Not yet supported.- Specified by:
getInputReceiver
in interfaceUIInstance
-
createMessage
Description copied from interface:UIInstance
Creates aUIMessage
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 returnnull
for this method.- Specified by:
createMessage
in interfaceUIInstance
-
getToolBarManager
- Specified by:
getToolBarManager
in interfaceUIInstance
-
unload
Description copied from interface:UIInstanceBase
PluginInterface is unloading.. destroy anything related to it- Specified by:
unload
in interfaceUIInstanceBase
-