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
Fields Modifier and Type Field Description private ConsoleInput
console
-
Fields 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 Constructor Description UI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildCommandLine(org.apache.commons.cli.Options options)
void
coreCreated(Core core)
Core has been created, but not fully initialize (No GlobalManager, etc)UIMessage
createMessage()
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)
UIInputReceiver
getInputReceiver()
Not yet supported.UIInstance
getInstance(PluginInterface plugin_interface)
Some UI instances need to understand which plugin they are associated with.UIToolBarManager
getToolBarManager()
java.lang.String
getUIType()
void
init(boolean first, boolean others)
Creates a new instance of Mainvoid
openRemoteTorrent(java.lang.String url)
void
openTorrent(java.lang.String fileName, java.lang.String save_path)
boolean
openView(BasicPluginViewModel model)
java.lang.String[]
processArgs(org.apache.commons.cli.CommandLine commands, java.lang.String[] args)
Process arguments coming either from command line, or from startserverint
promptUser(java.lang.String title, java.lang.String text, java.lang.String[] options, int defaultOption)
Prompts the user with a title, text, and a series of options.void
promptUser(java.lang.String title, java.lang.String text, java.lang.String[] options, int defaultOption, UIMessageListener listener)
Prompts the user with a title, text, and a series of options.private void
startUI()
void
unload(PluginInterface pi)
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 Detail
-
console
private ConsoleInput console
-
-
Method Detail
-
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
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 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
public java.lang.String getUIType()
- Specified by:
getUIType
in interfaceUIInstance
- Specified by:
getUIType
in interfaceUIInstanceFactory
- Returns:
-
coreCreated
public void coreCreated(Core core)
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
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 interfaceUIInstanceFactory
-
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 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
public boolean eventOccurred(UIManagerEvent event)
- Specified by:
eventOccurred
in interfaceUIManagerEventListener
- Returns:
- true if the event has been handled
-
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 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(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 interfaceUIInstance
options
- List of options to present to the user. Typically shown as buttonslistener
- triggered after user chooses an option
-
openView
public boolean openView(BasicPluginViewModel model)
- Specified by:
openView
in interfaceUIInstance
-
getInputReceiver
public UIInputReceiver getInputReceiver()
Not yet supported.- Specified by:
getInputReceiver
in interfaceUIInstance
-
createMessage
public UIMessage 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
public UIToolBarManager getToolBarManager()
- Specified by:
getToolBarManager
in interfaceUIInstance
-
unload
public void unload(PluginInterface pi)
Description copied from interface:UIInstanceBase
PluginInterface is unloading.. destroy anything related to it- Specified by:
unload
in interfaceUIInstanceBase
-
-