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 Object
implements UIManager

Author:
parg

Field Summary
protected static AEMonitor class_mon
           
protected static List<BasicPluginConfigModel> configModels
           
protected static boolean initialisation_complete
           
protected  MenuManager menu_manager
           
protected  PluginInterface pi
           
protected  TableManager table_manager
           
protected static List<UIManagerEventAdapter> ui_event_history
           
protected static CopyOnWriteList<UIManagerEventListener> ui_event_listeners
           
protected static List<UIInstanceFactory> ui_factories
           
protected static CopyOnWriteList<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(String data)
           
 BasicPluginConfigModel createBasicPluginConfigModel(String section_name)
           
 BasicPluginConfigModel createBasicPluginConfigModel(String parent_section, String section_name)
          Creates a basic plugin view model and adds it to the plugin in one step.
 BasicPluginViewModel createBasicPluginViewModel(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, Object data)
           
static boolean fireEvent(UIManagerEventAdapter event)
           
 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(File file)
          Opens up the file using the associated application.
 void openTorrent(Torrent torrent)
           
 void openURL(URL url)
           
 void removeDataSourceListener(UIDataSourceListener l)
           
 void removeUIEventListener(UIManagerEventListener listener)
           
 void removeUIListener(UIManagerListener listener)
          Remove an existing UIManagerListener
 void setEverythingHidden(boolean hidden)
           
 boolean showConfigSection(String sectionID)
          Open Config View to the section specified
 void showFile(File file)
          Shows the file in a file explorer application in its parent folder.
 long showMessageBox(String title_resource, String message_resource, long message_map)
           
 long showMessageBox(String title_resource, String message_resource, long message_map, Map<String,Object> params)
           
 long showMessageBox(String title_resource, String message_resource, long message_map, Object[] params)
           
 void showTextMessage(String title_resource, String message_resource, 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<Object[]> ui_listeners

ui_event_listeners

protected static CopyOnWriteList<UIManagerEventListener> ui_event_listeners

ui_factories

protected static List<UIInstanceFactory> ui_factories

ui_event_history

protected static List<UIManagerEventAdapter> ui_event_history

configModels

protected static 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(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(String section_name)
Specified by:
createBasicPluginConfigModel in interface UIManager
Returns:
BasicPluginConfigModel

createBasicPluginConfigModel

public BasicPluginConfigModel createBasicPluginConfigModel(String parent_section,
                                                           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(String data)
                     throws UIException
Specified by:
copyToClipBoard in interface UIManager
Throws:
UIException

openURL

public void openURL(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,
                                Object data)

fireEvent

public static boolean fireEvent(UIManagerEventAdapter event)

showTextMessage

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

showMessageBox

public long showMessageBox(String title_resource,
                           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(String title_resource,
                           String message_resource,
                           long message_map,
                           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(String title_resource,
                           String message_resource,
                           long message_map,
                           Map<String,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(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(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(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 Object getDataSource()
Specified by:
getDataSource in interface UIManager