org.gudy.azureus2.ui.console
Class UI

java.lang.Object
  extended by org.gudy.azureus2.ui.common.UITemplate
      extended by org.gudy.azureus2.ui.common.UITemplateHeadless
          extended by org.gudy.azureus2.ui.console.UI
All Implemented Interfaces:
UIInstance, UIInstanceFactory, UIManagerEventListener, IUserInterface, UIInstanceBase

public class UI
extends UITemplateHeadless
implements IUserInterface, UIInstanceFactory, UIInstanceBase, UIManagerEventListener

Author:
Tobias Minich

Field Summary
 
Fields inherited from interface org.gudy.azureus2.plugins.ui.UIInstance
UIT_CONSOLE, UIT_SWT
 
Constructor Summary
UI()
           
 
Method Summary
 UIMessage createMessage()
          Creates a UIMessage 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.
 boolean eventOccurred(UIManagerEvent event)
          Return true if the event has been handled
 UIInputReceiver getInputReceiver()
          Not yet supported.
 UIInstance getInstance(PluginInterface plugin_interface)
          Some UI instances need to understand which plugin they are associated with.
 UIToolBarManager getToolBarManager()
           
 int getUIType()
           
 void init(boolean first, boolean others)
          Creates a new instance of Main
 void openRemoteTorrent(String url)
           
 void openTorrent(String fileName)
          Open a torrent file.
 boolean openView(BasicPluginViewModel model)
           
 String[] processArgs(String[] args)
          Process UI specific command line arguments.
 int promptUser(String title, String text, String[] options, int defaultOption)
          Prompts the user with a title, text, and a series of options.
 void startUI()
          Start the UI.
 void unload(PluginInterface pi)
          PluginInterface is unloading..
 
Methods inherited from class org.gudy.azureus2.ui.common.UITemplate
isStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gudy.azureus2.ui.common.IUserInterface
isStarted
 

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 UITemplateHeadless
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 wether other UIs run along.

processArgs

public String[] processArgs(String[] args)
Description copied from interface: IUserInterface
Process UI specific command line arguments.

Specified by:
processArgs in interface IUserInterface
Specified by:
processArgs in class UITemplate
Returns:
Unprocessed Args

getUIType

public int getUIType()
Specified by:
getUIType in interface UIInstance
Returns:

startUI

public void startUI()
Description copied from interface: IUserInterface
Start the UI. Now the GlobalManager is initialized.

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

openRemoteTorrent

public void openRemoteTorrent(String url)

openTorrent

public void openTorrent(String fileName)
Description copied from interface: IUserInterface
Open a torrent file. This is for torrents passed in the command line. Only called for the first UI.

Specified by:
openTorrent in interface IUserInterface
Specified by:
openTorrent in class UITemplate

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

eventOccurred

public boolean eventOccurred(UIManagerEvent event)
Description copied from interface: UIManagerEventListener
Return true if the event has been handled

Specified by:
eventOccurred in interface UIManagerEventListener
Returns:

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.

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

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