org.gudy.azureus2.pluginsimpl.local.ui
Class UIManagerImpl

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.local.ui.UIManagerImpl
All Implemented Interfaces:
UIManager

public class UIManagerImpl
extends java.lang.Object
implements UIManager

Author:
parg

Field Summary
protected static AEMonitor class_mon
           
protected static java.util.List<BasicPluginConfigModel> configModels
           
protected static boolean initialisation_complete
           
protected  MenuManager menu_manager
           
protected  PluginInterface pi
           
protected  TableManager table_manager
           
protected static java.util.List<UIManagerEventAdapter> ui_event_history
           
protected static CopyOnWriteList<UIManagerEventListener> ui_event_listeners
           
protected static java.util.List<UIInstanceFactory> ui_factories
           
protected static CopyOnWriteList<java.lang.Object[]> ui_listeners
           
 
Fields inherited from interface org.gudy.azureus2.plugins.ui.UIManager
MB_PARAM_AUTO_CLOSE_MS, MB_PARAM_REMEMBER_BY_DEF, MB_PARAM_REMEMBER_ID, MB_PARAM_REMEMBER_RES
 
Constructor Summary
UIManagerImpl(PluginInterface _pi)
           
 
Method Summary
 void addDataSourceListener(UIDataSourceListener l, boolean triggerNow)
           
 void addUIEventListener(UIManagerEventListener listener)
           
 void addUIListener(UIManagerListener listener)
          Listen for UIManagerListener.UIAttached(UIInstance) and UIManagerListener.UIDetached(UIInstance) events.
 void attachUI(UIInstanceFactory factory)
          attach a new UI
 void attachUI(UIInstanceFactory factory, IUIIntializer init)
           
 void copyToClipBoard(java.lang.String data)
           
 BasicPluginConfigModel createBasicPluginConfigModel(java.lang.String section_name)
           
 BasicPluginConfigModel createBasicPluginConfigModel(java.lang.String parent_section, java.lang.String section_name)
          Creates a basic plugin view model and adds it to the plugin in one step.
 BasicPluginViewModel createBasicPluginViewModel(java.lang.String name)
          Creates a basic plugin view model and adds it to the plugin in one step.
 BasicPluginViewModel createLoggingViewModel(LoggerChannel channel, boolean use_plugin_name)
          Creates a BasicPluginViewModel object primarily to be used for storing logging output.
 UIMessage createMessage()
          Retrieves a UIMessage from any interface available, or returns null if one is not available.
 void destroy(BasicPluginConfigModel model)
           
 void destroy(BasicPluginViewModel model)
           
 void detachUI(UIInstanceFactory factory)
          detach a UI - can fail if the UI doesn't support detaching
static boolean fireEvent(PluginInterface pi, int type, java.lang.Object data)
           
static boolean fireEvent(UIManagerEventAdapter event)
           
 java.lang.Object getDataSource()
           
 UIInputReceiver getInputReceiver()
          Retrieves a UIInputReceiver from any interface available, or returns null if one is not available.
 MenuManager getMenuManager()
          Retrieve the menu manager.
 PluginConfigModel[] getPluginConfigModels()
           
 PluginInterface getPluginInterface()
           
 TableManager getTableManager()
          Retrieve the Table Manager
 UIInstance[] getUIInstances()
          Returns an array of all currently attached user interfaces.
 boolean hasUIInstances()
          Returns true if there any user interfaces currently attached to Azureus.
static void initialisationComplete()
           
 void openFile(java.io.File file)
          Opens up the file using the associated application.
 void openTorrent(Torrent torrent)
           
 void openURL(java.net.URL url)
           
 void removeDataSourceListener(UIDataSourceListener l)
           
 void removeUIEventListener(UIManagerEventListener listener)
           
 void removeUIListener(UIManagerListener listener)
          Remove an existing UIManagerListener
 void setEverythingHidden(boolean hidden)
           
 boolean showConfigSection(java.lang.String sectionID)
          Open Config View to the section specified
 void showFile(java.io.File file)
          Shows the file in a file explorer application in its parent folder.
 long showMessageBox(java.lang.String title_resource, java.lang.String message_resource, long message_map)
           
 long showMessageBox(java.lang.String title_resource, java.lang.String message_resource, long message_map, java.util.Map<java.lang.String,java.lang.Object> params)
           
 long showMessageBox(java.lang.String title_resource, java.lang.String message_resource, long message_map, java.lang.Object[] params)
           
 void showTextMessage(java.lang.String title_resource, java.lang.String message_resource, java.lang.String contents)
           
static void unload(PluginInterface pi)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

class_mon

protected static AEMonitor class_mon

initialisation_complete

protected static boolean initialisation_complete

ui_listeners

protected static CopyOnWriteList<java.lang.Object[]> ui_listeners

ui_event_listeners

protected static CopyOnWriteList<UIManagerEventListener> ui_event_listeners

ui_factories

protected static java.util.List<UIInstanceFactory> ui_factories

ui_event_history

protected static java.util.List<UIManagerEventAdapter> ui_event_history

configModels

protected static java.util.List<BasicPluginConfigModel> configModels

pi

protected PluginInterface pi

table_manager

protected TableManager table_manager

menu_manager

protected MenuManager menu_manager
Constructor Detail

UIManagerImpl

public UIManagerImpl(PluginInterface _pi)
Method Detail

getPluginInterface

public PluginInterface getPluginInterface()

createBasicPluginViewModel

public BasicPluginViewModel createBasicPluginViewModel(java.lang.String name)
Description copied from interface: UIManager
Creates a basic plugin view model and adds it to the plugin in one step. view is placed inside the plugins section of the configuration page.

Specified by:
createBasicPluginViewModel in interface UIManager
Parameters:
name - The name for the view (this should be localised text, rather than a message string).
Returns:
BasicPluginViewModel

destroy

public void destroy(BasicPluginViewModel model)

createBasicPluginConfigModel

public BasicPluginConfigModel createBasicPluginConfigModel(java.lang.String section_name)
Specified by:
createBasicPluginConfigModel in interface UIManager
Returns:
BasicPluginConfigModel

createBasicPluginConfigModel

public BasicPluginConfigModel createBasicPluginConfigModel(java.lang.String parent_section,
                                                           java.lang.String section_name)
Description copied from interface: UIManager
Creates a basic plugin view model and adds it to the plugin in one step.

Specified by:
createBasicPluginConfigModel in interface UIManager
section_name - see ConfigSection.SECTION_*
Returns:
BasicPluginConfigModel

destroy

public void destroy(BasicPluginConfigModel model)

getPluginConfigModels

public PluginConfigModel[] getPluginConfigModels()
Specified by:
getPluginConfigModels in interface UIManager
Returns:

copyToClipBoard

public void copyToClipBoard(java.lang.String data)
                     throws UIException
Specified by:
copyToClipBoard in interface UIManager
Throws:
UIException

openURL

public void openURL(java.net.URL url)
             throws UIException
Specified by:
openURL in interface UIManager
Throws:
UIException

getTableManager

public TableManager getTableManager()
Description copied from interface: UIManager
Retrieve the Table Manager

Specified by:
getTableManager in interface UIManager
Returns:
Table management functions

getMenuManager

public MenuManager getMenuManager()
Description copied from interface: UIManager
Retrieve the menu manager.

Specified by:
getMenuManager in interface UIManager
Returns:
Menu management functions

initialisationComplete

public static void initialisationComplete()

attachUI

public void attachUI(UIInstanceFactory factory)
              throws UIException
Description copied from interface: UIManager
attach a new UI

Specified by:
attachUI in interface UIManager
Throws:
UIException

attachUI

public void attachUI(UIInstanceFactory factory,
                     IUIIntializer init)

detachUI

public void detachUI(UIInstanceFactory factory)
              throws UIException
Description copied from interface: UIManager
detach a UI - can fail if the UI doesn't support detaching

Specified by:
detachUI in interface UIManager
Throws:
UIException

addUIListener

public void addUIListener(UIManagerListener listener)
Description copied from interface: UIManager
Listen for UIManagerListener.UIAttached(UIInstance) and UIManagerListener.UIDetached(UIInstance) events. Typically, you hook this listener so you can access UISWTInstance when it gets created.

Specified by:
addUIListener in interface UIManager

removeUIListener

public void removeUIListener(UIManagerListener listener)
Description copied from interface: UIManager
Remove an existing UIManagerListener

Specified by:
removeUIListener in interface UIManager
Parameters:
listener - Listener to remove

addUIEventListener

public void addUIEventListener(UIManagerEventListener listener)
Specified by:
addUIEventListener in interface UIManager

removeUIEventListener

public void removeUIEventListener(UIManagerEventListener listener)
Specified by:
removeUIEventListener in interface UIManager

hasUIInstances

public boolean hasUIInstances()
Description copied from interface: UIManager
Returns true if there any user interfaces currently attached to Azureus. Note that this value may change over time, and that at the point when a plugin is being initialised, there is no guarantee over whether if the user interfaces will have been created yet or not. If you want to monitor what user interfaces are being attached / detached from Azureus, you should add a UIListener to this object.

Specified by:
hasUIInstances in interface UIManager

getUIInstances

public UIInstance[] getUIInstances()
Description copied from interface: UIManager
Returns an array of all currently attached user interfaces. Note that this value may change over time, and that at the point when a plugin is being initialised, there is no guarantee over whether if the user interfaces will have been created yet or not. If you want to monitor what user interfaces are being attached / detached from Azureus, you should add a UIListener to this object.

Specified by:
getUIInstances in interface UIManager

fireEvent

public static boolean fireEvent(PluginInterface pi,
                                int type,
                                java.lang.Object data)

fireEvent

public static boolean fireEvent(UIManagerEventAdapter event)

showTextMessage

public void showTextMessage(java.lang.String title_resource,
                            java.lang.String message_resource,
                            java.lang.String contents)
Specified by:
showTextMessage in interface UIManager

showMessageBox

public long showMessageBox(java.lang.String title_resource,
                           java.lang.String message_resource,
                           long message_map)
Specified by:
showMessageBox in interface UIManager
message_map - - see UIManagerEvent.MT_x
Returns:
selected value

showMessageBox

public long showMessageBox(java.lang.String title_resource,
                           java.lang.String message_resource,
                           long message_map,
                           java.lang.Object[] params)
Specified by:
showMessageBox in interface UIManager
message_map - - see UIManagerEvent.MT_x
params - - [ remember-id (String), remember-by-default (Boolean), remember-resource (String) ]
Returns:
selected value

showMessageBox

public long showMessageBox(java.lang.String title_resource,
                           java.lang.String message_resource,
                           long message_map,
                           java.util.Map<java.lang.String,java.lang.Object> params)
Specified by:
showMessageBox in interface UIManager
Returns:

openTorrent

public void openTorrent(Torrent torrent)
Specified by:
openTorrent in interface UIManager

openFile

public void openFile(java.io.File file)
Description copied from interface: UIManager
Opens up the file using the associated application.

Specified by:
openFile in interface UIManager
Parameters:
file - The file to open.

showFile

public void showFile(java.io.File file)
Description copied from interface: UIManager
Shows the file in a file explorer application in its parent folder.

Specified by:
showFile in interface UIManager
Parameters:
file - The file to show.

showConfigSection

public boolean showConfigSection(java.lang.String sectionID)
Description copied from interface: UIManager
Open Config View to the section specified

Specified by:
showConfigSection in interface UIManager
Parameters:
sectionID - ID of section to open to. ConfigSection.SECTION_* constants
Returns:
true-Section opened; false-Section invalid or UI does not support config views

getInputReceiver

public UIInputReceiver getInputReceiver()
Description copied from interface: UIManager
Retrieves a UIInputReceiver from any interface available, or returns null if one is not available. This is a convenience method to allow you to grab an instance without having to iterate over any attached interfaces.

Specified by:
getInputReceiver in interface UIManager
See Also:
UIInstance.getInputReceiver()

createMessage

public UIMessage createMessage()
Description copied from interface: UIManager
Retrieves a UIMessage from any interface available, or returns null if one is not available. This is a convenience method to allow you to grab an instance without having to iterate over any attached interfaces.

Specified by:
createMessage in interface UIManager
See Also:
UIInstance.createMessage()

createLoggingViewModel

public BasicPluginViewModel createLoggingViewModel(LoggerChannel channel,
                                                   boolean use_plugin_name)
Description copied from interface: UIManager
Creates a BasicPluginViewModel object primarily to be used for storing logging output. This is just a shortcut way of creating a log view for the logger channel.

Specified by:
createLoggingViewModel in interface UIManager
Parameters:
channel - The LoggerChannel to associate with.
use_plugin_name - If set to true, the log view will be taken from the plugin name, if false, it will be taken from the channel name.

setEverythingHidden

public void setEverythingHidden(boolean hidden)
Specified by:
setEverythingHidden in interface UIManager

unload

public static void unload(PluginInterface pi)

addDataSourceListener

public void addDataSourceListener(UIDataSourceListener l,
                                  boolean triggerNow)
Specified by:
addDataSourceListener in interface UIManager

removeDataSourceListener

public void removeDataSourceListener(UIDataSourceListener l)
Specified by:
removeDataSourceListener in interface UIManager

getDataSource

public java.lang.Object getDataSource()
Specified by:
getDataSource in interface UIManager