Class UISWTInstanceImpl
java.lang.Object
com.biglybt.ui.swt.pifimpl.UISWTInstanceImpl
- All Implemented Interfaces:
UIInstance, UIInstanceFactory, UIManagerEventListener, UIInstanceBase, UISWTInstance
public class UISWTInstanceImpl
extends Object
implements UIInstanceFactory, UISWTInstance, UIManagerEventListener, UIInstanceBase
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final Map<PluginInterface, UISWTInstance> private final UIFunctionsSWTFields inherited from interface UIInstance
UIT_CONSOLE, UIT_SWTFields inherited from interface UISWTInstance
VIEW_INTERNAL, VIEW_MAIN, VIEW_MYTORRENTS, VIEW_RIGHTBAR, VIEW_RIGHTBAR_AREA, VIEW_SIDEBAR_AREA, VIEW_STATISTICS, VIEW_TOPBAR, VIEW_TORRENT_DETAILS, VIEW_TORRENT_PEERS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddView(String sParentID, String sViewID, UISWTViewEventListener l) Add a detail view to an Azureus parent view.voidaddView(String sParentViewID, String sViewID, Class<? extends UISWTViewEventListener> cla, Object datasource) Add a view to an Apps parent view.createGraphic(org.eclipse.swt.graphics.Image img) Creates an UISWTGraphic object with the supplied SWT ImageCreates aUIMessageinstance to allow a plugin to inform or ask the user something.org.eclipse.swt.widgets.ShellcreateShell(int style) Creates a SWT Shell, ensuring Vuze knows about it (ie.Creates an entry in the status bar to display custom status information.createViewBuilder(String viewID) Creates an object representing how your view is to be created.createViewBuilder(String viewID, Class<? extends UISWTViewEventListener> cla) Creates an object representing how your view is to be createdvoiddetach()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.voiddispose()This method will be called by the UI manager after the UIInstance is detached.booleaneventOccurred(UIManagerEvent event) org.eclipse.swt.widgets.DisplayRetrieve the SWT Display object that Azureus uses (when in SWT mode).Creates aUIInputReceiverinstance to allow a plugin to request text input from the user.getInstance(PluginInterface plugin_interface) Some UI instances need to understand which plugin they are associated with.getOpenViews(String sParentID) Get a list of views currently open on the specified VIEW_* viewvoidinit(IUIIntializer init) org.eclipse.swt.graphics.ImagevoidopenConfig(BasicPluginConfigModel model) Opens the window linked to a given BasicPluginViewModel object.voidopenMainView(PluginInterface pi, String sViewID, UISWTViewEventListener _l, Object dataSource, boolean setfocus) voidopenMainView(String sViewID, UISWTViewEventListener l, Object dataSource) Create and open a view in the main window immediately.voidopenMainView(String sViewID, UISWTViewEventListener l, Object dataSource, boolean setfocus) Create and open a view in the main window immediately.booleanopenView(BasicPluginViewModel model) Opens the window linked to a given BasicPluginViewModel object.booleanOpen a previously added viewbooleanOpen a previously added viewintpromptUser(String title, String text, String[] options, int defaultOption) Prompts the user with a title, text, and a series of options.voidpromptUser(String title, String text, String[] options, int defaultOption, UIMessageListener listener) Prompts the user with a title, text, and a series of options.voidregisterView(Class forDataSourceType, UISWTViewBuilder viewBuilder) Register a view that will be created when a certain datasource type is displayedvoidregisterView(String forViewID, UISWTViewBuilder viewBuilder) Register a view that will be created when the specified view is displayedvoidremoveViews(String sParentID, String sViewID) Remove all views that belong to a specific parent and of a specific View ID.voidshowDownloadBar(Download download, boolean display) Shows or hides a download bar for a given download.voidshowTransfersBar(boolean display) Shows or hides the transfers bar.voidPluginInterface is unloading..voidunregisterView(Class forDataSourceType, String viewID) Unregister and dispose of any previously created views of this viewIDvoidunregisterView(String forViewID, String viewID) Unregister and dispose of any previously created views of this viewID
-
Field Details
-
plugin_map
-
bUIAttaching
private boolean bUIAttaching -
uiFunctions
-
-
Constructor Details
-
UISWTInstanceImpl
public UISWTInstanceImpl()
-
-
Method Details
-
getUIType
- Specified by:
getUITypein interfaceUIInstance- Specified by:
getUITypein interfaceUIInstanceFactory- Returns:
-
init
-
getInstance
Description copied from interface:UIInstanceFactorySome 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:
getInstancein interfaceUIInstanceFactory
-
eventOccurred
- Specified by:
eventOccurredin interfaceUIManagerEventListener- Parameters:
event-- Returns:
- true if the event has been handled
-
getDisplay
public org.eclipse.swt.widgets.Display getDisplay()Description copied from interface:UISWTInstanceRetrieve the SWT Display object that Azureus uses (when in SWT mode). If you have a thread that does some periodic/asynchronous stuff, Azureus will crashes with and 'InvalidThreadAccess' exception unless you embed your calls in a Runnable, and use getDisplay().aSyncExec(Runnable r);- Specified by:
getDisplayin interfaceUISWTInstance- Returns:
- SWT Display object that Azureus uses
-
loadImage
- Specified by:
loadImagein interfaceUISWTInstance
-
createGraphic
Description copied from interface:UISWTInstanceCreates an UISWTGraphic object with the supplied SWT Image- Specified by:
createGraphicin interfaceUISWTInstance- Parameters:
img- Image to assign to the object- Returns:
- a new UISWTGraphic object
-
createShell
public org.eclipse.swt.widgets.Shell createShell(int style) Description copied from interface:UISWTInstanceCreates a SWT Shell, ensuring Vuze knows about it (ie. Icon, "Window" menu)- Specified by:
createShellin interfaceUISWTInstance- Parameters:
style-- Returns:
-
detach
Description copied from interface:UIInstanceFactoryThis 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:
detachin interfaceUIInstanceFactory- Throws:
UIException
-
dispose
public void dispose()Description copied from interface:UIInstanceFactoryThis method will be called by the UI manager after the UIInstance is detached.- Specified by:
disposein interfaceUIInstanceFactory
-
addView
public void addView(String sParentViewID, String sViewID, Class<? extends UISWTViewEventListener> cla, Object datasource) Description copied from interface:UISWTInstanceAdd a view to an Apps parent view. For views added to theUISWTInstance.VIEW_MAINwindow, this adds a menu option.In comparison to
UISWTInstance.addView(String, String, UISWTViewEventListener), this method saves memory by not creating theUISWTViewEventListeneruntil it is needed. It also ensures that only oneUISWTViewEvent.TYPE_CREATEevent is triggered per instance.- Specified by:
addViewin interfaceUISWTInstance- Parameters:
sParentViewID- VIEW_* constantsViewID- of your view. Used as part of the resource id.
"Views.plugins." + ID + ".title" = title of your viewcla- Class of the Listener to be created and triggered
-
addView
Description copied from interface:UISWTInstanceAdd a detail view to an Azureus parent view. For views added to the Main window, this adds a menu option. For the other parent views, this adds a new tab within Azureus' own detail view.- Specified by:
addViewin interfaceUISWTInstance- Parameters:
sParentID- VIEW_* constantsViewID- of your view. Used as part of the resource id.
"Views.plugins." + ID + ".title" = title of your viewl- Listener to be triggered when parent view wants to tell you an event has happened
-
registerView
Description copied from interface:UISWTInstanceRegister a view that will be created when a certain datasource type is displayed For example, you can register an image rendering view forDiskManagerFileInfoWhen plugin is unloaded, any registrations will be automatically unregistered, and any views created from the builder will be automatically disposed- Specified by:
registerViewin interfaceUISWTInstance- Parameters:
forDataSourceType- Class of datasource you want to add a view to, such asDownload,DownloadTypeComplete,DownloadTypeIncompleteviewBuilder- useUISWTInstance.createViewBuilder(String, Class)
-
registerView
Description copied from interface:UISWTInstanceRegister a view that will be created when the specified view is displayed When plugin is unloaded, any registrations will be automatically unregistered, and any views created from the builder will be automatically disposed- Specified by:
registerViewin interfaceUISWTInstance- Parameters:
forViewID- VIEW_ ConstantviewBuilder- useUISWTInstance.createViewBuilder(String, Class)
-
createViewBuilder
public UISWTViewBuilder createViewBuilder(String viewID, Class<? extends UISWTViewEventListener> cla) Description copied from interface:UISWTInstanceCreates an object representing how your view is to be created- Specified by:
createViewBuilderin interfaceUISWTInstance- Parameters:
viewID- Unique ID of your viewcla- AUISWTViewEventListenerclass that will be created when the UI shows the view.
Since this class will be instantiated with cla.newInstance(), the class must be a top-level class, and not a local or non-static nested class.- Returns:
- UISWTViewBuilder which has additional values you can set, such as initial datasource
-
createViewBuilder
Description copied from interface:UISWTInstanceCreates an object representing how your view is to be created. At minimum, you will need to specify a way to instanatiate your listener, with one of the following methods:UISWTViewBuilder.setListenerClass(Class)invalid reference
UISWTViewBuilder#setListenerInstantiator(boolean, UISWTViewBuilder.UISWTViewEventListenerInstantiator)- Specified by:
createViewBuilderin interfaceUISWTInstance- Parameters:
viewID- Unique ID of your view- Returns:
- UISWTViewBuilder which has additional values you can set, such as initial datasource
-
unregisterView
Description copied from interface:UISWTInstanceUnregister and dispose of any previously created views of this viewID- Specified by:
unregisterViewin interfaceUISWTInstance
-
unregisterView
Description copied from interface:UISWTInstanceUnregister and dispose of any previously created views of this viewID- Specified by:
unregisterViewin interfaceUISWTInstance
-
removeViews
Description copied from interface:UISWTInstanceRemove all views that belong to a specific parent and of a specific View ID. If the parent is the main window, the menu item will be removed.
If you wish to remove (close) just one view, useUIPluginView.closeView()- Specified by:
removeViewsin interfaceUISWTInstance- Parameters:
sParentID- One of VIEW_* constantssViewID- View ID to remove
-
openView
Description copied from interface:UISWTInstanceOpen a previously added view- Specified by:
openViewin interfaceUISWTInstance- Parameters:
sParentID- ParentID of the view to be shownsViewID- id of the view to be showndataSource- any data you need to pass the view- Returns:
- success level
-
openView
Description copied from interface:UISWTInstanceOpen a previously added view- Specified by:
openViewin interfaceUISWTInstance- Parameters:
forViewID- View that the opened view belongs tosViewID- id of the view to be showndataSource- any data you need to pass the viewsetfocus- true if you want to display the view immediately, false if you want to display it in the background.- Returns:
- success level
-
openMainView
Description copied from interface:UISWTInstanceCreate and open a view in the main window immediately. If you are calling this fromUIManagerListener.UIAttached(UIInstance), the view will not gain focus.Tip: You can add a menu item to a table view, and when triggered, have it open a new window, passing the datasources that were selected
- Specified by:
openMainViewin interfaceUISWTInstance- Parameters:
sViewID- ID to give your viewl- Listener to be triggered when View Events occurdataSource- objects to setUISWTView.getDataSource()with
-
openMainView
public void openMainView(String sViewID, UISWTViewEventListener l, Object dataSource, boolean setfocus) Description copied from interface:UISWTInstanceCreate and open a view in the main window immediately. If you are calling this fromUIManagerListener.UIAttached(UIInstance), the view will not gain focus.Tip: You can add a menu item to a table view, and when triggered, have it open a new window, passing the datasources that were selected
- Specified by:
openMainViewin interfaceUISWTInstance- Parameters:
sViewID- ID to give your viewl- Listener to be triggered when View Events occurdataSource- objects to setUISWTView.getDataSource()withsetfocus- true if you want to display the view immediately, false if you want to display it in the background.
-
openMainView
public void openMainView(PluginInterface pi, String sViewID, UISWTViewEventListener _l, Object dataSource, boolean setfocus) -
getOpenViews
Description copied from interface:UISWTInstanceGet a list of views currently open on the specified VIEW_* view- Specified by:
getOpenViewsin interfaceUISWTInstance- Parameters:
sParentID- VIEW_* constant- Returns:
- list of views currently open
-
promptUser
Description copied from interface:UIInstancePrompts 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:
promptUserin interfaceUIInstance- Parameters:
title-text-options-- Returns:
- Index of option chosen, -1 if cancelled or error
-
promptUser
public void promptUser(String title, String text, String[] options, int defaultOption, UIMessageListener listener) Description copied from interface:UIInstancePrompts the user with a title, text, and a series of options. The options are typically displayed as buttons. This method returns immediately.- Specified by:
promptUserin interfaceUIInstance- Parameters:
options- List of options to present to the user. Typically shown as buttonslistener- triggered after user chooses an option
-
showDownloadBar
Description copied from interface:UISWTInstanceShows or hides a download bar for a given download.- Specified by:
showDownloadBarin interfaceUISWTInstance- Parameters:
download- Download to use.display- true to show a download bar, false to hide it.
-
showTransfersBar
public void showTransfersBar(boolean display) Description copied from interface:UISWTInstanceShows or hides the transfers bar.- Specified by:
showTransfersBarin interfaceUISWTInstance- Parameters:
display- true to show the bar, false to hide it.
-
getInputReceiver
Description copied from interface:UIInstanceCreates aUIInputReceiverinstance to allow a plugin to request text input from the user. Some interfaces may not allow or support the ability for a plugin to request text input from a user, in which case they will returnnullfor this method.- Specified by:
getInputReceiverin interfaceUIInstance
-
createMessage
Description copied from interface:UIInstanceCreates aUIMessageinstance 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 returnnullfor this method.- Specified by:
createMessagein interfaceUIInstance
-
createStatusEntry
Description copied from interface:UISWTInstanceCreates an entry in the status bar to display custom status information.- Specified by:
createStatusEntryin interfaceUISWTInstance- See Also:
-
openView
Description copied from interface:UISWTInstanceOpens the window linked to a given BasicPluginViewModel object.- Specified by:
openViewin interfaceUIInstance- Specified by:
openViewin interfaceUISWTInstance- Returns:
- true if the view was opened successfully.
-
openConfig
Description copied from interface:UISWTInstanceOpens the window linked to a given BasicPluginViewModel object.- Specified by:
openConfigin interfaceUISWTInstance
-
getToolBarManager
- Specified by:
getToolBarManagerin interfaceUIInstance
-
unload
Description copied from interface:UIInstanceBasePluginInterface is unloading.. destroy anything related to it- Specified by:
unloadin interfaceUIInstanceBase
-