Package com.biglybt.pifimpl.local.ui
Class UIManagerImpl
- java.lang.Object
-
- com.biglybt.pifimpl.local.ui.UIManagerImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected static AEMonitor
class_mon
private static java.util.Map<BasicPluginConfigModel,BasicPluginConfigImpl>
config_view_map
protected static boolean
initialisation_complete
private static java.util.ArrayList<UIDataSourceListener>
listDSListeners
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
private static java.util.Map<java.lang.String,BasicPluginViewModel>
view_model_map
-
Fields inherited from interface com.biglybt.pif.ui.UIManager
MB_PARAM_AUTO_CLOSE_MS, MB_PARAM_REMEMBER_BY_DEF, MB_PARAM_REMEMBER_ID, MB_PARAM_REMEMBER_IF_ONLY_BUTTON, MB_PARAM_REMEMBER_RES
-
-
Constructor Summary
Constructors Constructor Description UIManagerImpl(PluginInterface _pi)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDataSourceListener(UIDataSourceListener l, boolean triggerNow)
void
addUIEventListener(UIManagerEventListener listener)
Add a listener that's triggered on when core/plugins need to do an UI-only task, such as display a message to a user, or open an URL in a browser.void
addUIListener(UIManagerListener listener)
Listen forUIManagerListener.UIAttached(UIInstance)
andUIManagerListener.UIDetached(UIInstance)
events.void
attachUI(UIInstanceFactory factory)
attach a new UIvoid
attachUI(UIInstanceFactory factory, IUIIntializer init)
void
copyToClipBoard(java.lang.String data)
BasicPluginConfigModel
createBasicPluginConfigModel(java.lang.String section_name)
Creates a basic plugin view model and places it inside the plugins section of the configuration page.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 aBasicPluginViewModel
object primarily to be used for storing logging output.UIMessage
createMessage()
Retrieves aUIMessage
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 detachingstatic boolean
fireEvent(PluginInterface pi, int type, java.lang.Object data)
static boolean
fireEvent(UIManagerEventAdapter event)
static BasicPluginViewModel
getBasicPluginViewModel(java.lang.String key)
static java.lang.String
getBasicPluginViewModelKey(BasicPluginViewModel model)
java.lang.Object
getDataSource()
UIInputReceiver
getInputReceiver()
Retrieves aUIInputReceiver
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 ManagerUIInstance[]
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)
Remove previously added UIManagerEventListenervoid
removeUIListener(UIManagerListener listener)
Remove an existingUIManagerListener
void
setEverythingHidden(boolean hidden)
boolean
showConfigSection(java.lang.String sectionID)
Open Config View to the section specifiedvoid
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.lang.Object[] params)
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)
void
showTextMessage(java.lang.String title_resource, java.lang.String message_resource, java.lang.String contents)
void
toggleEverythingHidden()
private static void
triggerDataSourceListeners(java.lang.Object ds)
static void
unload(PluginInterface pi)
-
-
-
Field Detail
-
class_mon
protected static final 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
-
config_view_map
private static java.util.Map<BasicPluginConfigModel,BasicPluginConfigImpl> config_view_map
-
view_model_map
private static java.util.Map<java.lang.String,BasicPluginViewModel> view_model_map
-
pi
protected PluginInterface pi
-
table_manager
protected TableManager table_manager
-
menu_manager
protected MenuManager menu_manager
-
listDSListeners
private static java.util.ArrayList<UIDataSourceListener> listDSListeners
-
-
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.- Specified by:
createBasicPluginViewModel
in interfaceUIManager
- 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)
-
getBasicPluginViewModelKey
public static java.lang.String getBasicPluginViewModelKey(BasicPluginViewModel model)
-
getBasicPluginViewModel
public static BasicPluginViewModel getBasicPluginViewModel(java.lang.String key)
-
createBasicPluginConfigModel
public BasicPluginConfigModel createBasicPluginConfigModel(java.lang.String section_name)
Description copied from interface:UIManager
Creates a basic plugin view model and places it inside the plugins section of the configuration page.- Specified by:
createBasicPluginConfigModel
in interfaceUIManager
- Parameters:
section_name
- Message Bundle resource id for the config model. This will be used as the name of the config page, as well as an unique id- 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. view is placed inside the plugins section of the configuration page.- Specified by:
createBasicPluginConfigModel
in interfaceUIManager
- Parameters:
parent_section
- seeConfigSection
.SECTION_*section_name
- Message Bundle resource id for the config model. This will be used as the name of the config page, as well as an unique id- Returns:
- BasicPluginConfigModel
-
destroy
public void destroy(BasicPluginConfigModel model)
-
getPluginConfigModels
public PluginConfigModel[] getPluginConfigModels()
- Specified by:
getPluginConfigModels
in interfaceUIManager
- Returns:
-
copyToClipBoard
public void copyToClipBoard(java.lang.String data) throws UIException
- Specified by:
copyToClipBoard
in interfaceUIManager
- Throws:
UIException
-
openURL
public void openURL(java.net.URL url) throws UIException
- Specified by:
openURL
in interfaceUIManager
- Throws:
UIException
-
getTableManager
public TableManager getTableManager()
Description copied from interface:UIManager
Retrieve the Table Manager- Specified by:
getTableManager
in interfaceUIManager
- Returns:
- Table management functions
-
getMenuManager
public MenuManager getMenuManager()
Description copied from interface:UIManager
Retrieve the menu manager.- Specified by:
getMenuManager
in interfaceUIManager
- 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 interfaceUIManager
- 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 interfaceUIManager
- Throws:
UIException
-
addUIListener
public void addUIListener(UIManagerListener listener)
Description copied from interface:UIManager
Listen forUIManagerListener.UIAttached(UIInstance)
andUIManagerListener.UIDetached(UIInstance)
events. Typically, you hook this listener so you can accessUISWTInstance
when it gets created. Will fire UIAttached for managers already attached- Specified by:
addUIListener
in interfaceUIManager
-
removeUIListener
public void removeUIListener(UIManagerListener listener)
Description copied from interface:UIManager
Remove an existingUIManagerListener
- Specified by:
removeUIListener
in interfaceUIManager
- Parameters:
listener
- Listener to remove
-
addUIEventListener
public void addUIEventListener(UIManagerEventListener listener)
Description copied from interface:UIManager
Add a listener that's triggered on when core/plugins need to do an UI-only task, such as display a message to a user, or open an URL in a browser. SeeUIManagerEvent
for types of events- Specified by:
addUIEventListener
in interfaceUIManager
-
removeUIEventListener
public void removeUIEventListener(UIManagerEventListener listener)
Description copied from interface:UIManager
Remove previously added UIManagerEventListener- Specified by:
removeUIEventListener
in interfaceUIManager
-
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 interfaceUIManager
-
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 interfaceUIManager
-
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 interfaceUIManager
-
showMessageBox
public long showMessageBox(java.lang.String title_resource, java.lang.String message_resource, long message_map)
- Specified by:
showMessageBox
in interfaceUIManager
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 interfaceUIManager
message_map
- - see UIManagerEvent.MT_xparams
- - [ 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 interfaceUIManager
- Returns:
-
openTorrent
public void openTorrent(Torrent torrent)
- Specified by:
openTorrent
in interfaceUIManager
-
openFile
public void openFile(java.io.File file)
Description copied from interface:UIManager
Opens up the file using the associated application.
-
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.
-
showConfigSection
public boolean showConfigSection(java.lang.String sectionID)
Description copied from interface:UIManager
Open Config View to the section specified- Specified by:
showConfigSection
in interfaceUIManager
- 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 aUIInputReceiver
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 interfaceUIManager
- See Also:
UIInstance.getInputReceiver()
-
createMessage
public UIMessage createMessage()
Description copied from interface:UIManager
Retrieves aUIMessage
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 interfaceUIManager
- See Also:
UIInstance.createMessage()
-
createLoggingViewModel
public BasicPluginViewModel createLoggingViewModel(LoggerChannel channel, boolean use_plugin_name)
Description copied from interface:UIManager
Creates aBasicPluginViewModel
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 interfaceUIManager
- Parameters:
channel
- TheLoggerChannel
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 interfaceUIManager
-
toggleEverythingHidden
public void toggleEverythingHidden()
- Specified by:
toggleEverythingHidden
in interfaceUIManager
-
unload
public static void unload(PluginInterface pi)
-
addDataSourceListener
public void addDataSourceListener(UIDataSourceListener l, boolean triggerNow)
- Specified by:
addDataSourceListener
in interfaceUIManager
-
removeDataSourceListener
public void removeDataSourceListener(UIDataSourceListener l)
- Specified by:
removeDataSourceListener
in interfaceUIManager
-
getDataSource
public java.lang.Object getDataSource()
- Specified by:
getDataSource
in interfaceUIManager
-
triggerDataSourceListeners
private static void triggerDataSourceListeners(java.lang.Object ds)
-
-