com.aelitis.azureus.ui.swt.shells.main
Class UIFunctionsImpl

java.lang.Object
  extended by com.aelitis.azureus.ui.swt.shells.main.UIFunctionsImpl
All Implemented Interfaces:
AzureusCoreComponent, UIFunctionsSWT, UIFunctions

public class UIFunctionsImpl
extends Object
implements UIFunctionsSWT

Author:
TuxPaper

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.aelitis.azureus.ui.UIFunctions
UIFunctions.actionListener, UIFunctions.TagReturner
 
Field Summary
protected  boolean isTorrentMenuVisible
           
 
Fields inherited from interface com.aelitis.azureus.ui.UIFunctions
ACTION_FULL_UPDATE, ACTION_UPDATE_RESTART_REQUEST, MAIN_WINDOW_NAME, MAIN_WINDOW_NAME_PLUS, OTO_DEFAULT_TO_STOPPED, OTO_DEFAULT_TO_STOPPED_DEFAULT, OTO_FORCE_OPEN, OTO_FORCE_OPEN_DEFAULT, OTO_HIDE_ERRORS, OTO_HIDE_ERRORS_DEFAULT, OTO_SILENT, OTO_SILENT_DEFAULT, STATUSICON_ERROR, STATUSICON_NONE, STATUSICON_WARNING, VIEW_CONFIG, VIEW_DM_DETAILS, VIEW_MYTORRENTS, VS_ACTIVE, VS_MINIMIZED, VS_MINIMIZED_TO_TRAY, VS_TRAY_ONLY
 
Constructor Summary
UIFunctionsImpl(MainWindow window)
           
 
Method Summary
 void addPluginView(String viewID, UISWTViewEventListener l)
           
 boolean addTorrentWithOptions(boolean force, TorrentOpenOptions torrentOptions)
          Opens the Torrent Add Options Window, if configured to
 boolean addTorrentWithOptions(TorrentOpenOptions torrentOptions, Map<String,Object> addOptions)
           
 int adjustPXForDPI(int px)
           
 void bringToFront()
          Bring main window to the front
 void bringToFront(boolean tryTricks)
          Bring main window to the front
 void closeAllDetails()
           
 void closeDownloadBars()
           
 void closeGlobalTransferBar()
           
 void closePluginView(UISWTViewCore view)
           
 void closePluginViews(String sViewID)
           
 IMainMenu createMainMenu(org.eclipse.swt.widgets.Shell shell)
          Creates the main application menu and attach it to the given Shell; this is only used for OSX so that we can attach the global menu to popup dialogs which is the expected behavior on OSX.
 TabbedMdiInterface createTabbedMDI(org.eclipse.swt.widgets.Composite parent, String id)
           
 boolean dispose(boolean for_restart, boolean close_already_in_progress)
          Request the UI be shut down.
 void doSearch(String sSearchText)
           
 void doSearch(String sSearchText, boolean toSubscribe)
           
 void forceNotify(int iconID, String title, String text, String details, Object[] relatedObjects, int timeoutSecs)
          Might launch the old-school Mr Slidey
 org.eclipse.swt.widgets.Shell getMainShell()
           
 IMainStatusBar getMainStatusBar()
           
 IMainWindow getMainWindow()
           
 MultipleDocumentInterface getMDI()
          Retrieve the MDI (Sidebar, TabbedMDI)
 MultipleDocumentInterfaceSWT getMDISWT()
           
 UISWTView[] getPluginViews()
           
 SWTSkin getSkin()
           
 UISWTInstanceImpl getSWTPluginInstanceImpl()
           
 UIToolBarManager getToolBarManager()
           
 UISWTInstance getUISWTInstance()
           
 int getUIType()
           
 UIUpdater getUIUpdater()
          Retrieves the class that handles periodically updating the UI
 UIFunctionsUserPrompter getUserPrompter(String title, String text, String[] buttons, int defaultOption)
           
 int getVisibilityState()
           
 boolean hasDetailViews()
           
 void installPlugin(String plugin_id, String resource_prefix, UIFunctions.actionListener listener)
           
 boolean isGlobalTransferBarShown()
           
 boolean isProgramInstalled(String extension, String name)
           
 void openPluginView(String sParentID, String sViewID, UISWTViewEventListener l, Object dataSource, boolean bSetFocus)
           
 void openRemotePairingWindow()
           
 void openTorrentOpenOptions(org.eclipse.swt.widgets.Shell shell, String sPathOfFilesToOpen, String[] sFilesToOpen, boolean defaultToStopped, boolean forceOpen)
           
 void openTorrentOpenOptions(org.eclipse.swt.widgets.Shell shell, String sPathOfFilesToOpen, String[] sFilesToOpen, Map<String,Object> options)
           
 void openTorrentWindow()
           
 void openView(int viewID, Object data)
          Deprecated. 
 void performAction(int action_id, Object args, UIFunctions.actionListener listener)
           
 void playOrStreamDataSource(Object ds, String referal, boolean launch_already_checked, boolean complete_only)
           
 void promptForSearch()
           
 void promptUser(String title, String text, String[] buttons, int defaultOption, String rememberID, String rememberText, boolean rememberByDefault, int autoCloseInMS, UserPrompterResultListener l)
           
 void refreshIconBar()
           
 void refreshLanguage()
          Change/Refresh the language of the UI
 void refreshTorrentMenu()
           
 void removePluginView(String viewID)
           
 void runOnUIThread(int ui_type, Runnable runnable)
           
 void setHideAll(boolean hidden)
           
 void setSkin(SWTSkin skin)
           
 void setStatusText(int statustype, String string, UIStatusTextClickListener l)
           
 void setStatusText(String string)
           
 org.eclipse.swt.widgets.Shell showCoreWaitDlg()
           
 void showCreateTagDialog(UIFunctions.TagReturner tagReturner)
           
 void showErrorMessage(String keyPrefix, String details, String[] textParams)
           
 void showGlobalTransferBar()
           
 boolean viewURL(String url, String target, double w, double h, boolean allowResize, boolean isModal)
           
 boolean viewURL(String url, String target, int w, int h, boolean allowResize, boolean isModal)
           
 void viewURL(String url, String target, String sourceRef)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isTorrentMenuVisible

protected boolean isTorrentMenuVisible
Constructor Detail

UIFunctionsImpl

public UIFunctionsImpl(MainWindow window)
Parameters:
window -
Method Detail

getUIType

public int getUIType()
Specified by:
getUIType in interface UIFunctions

addPluginView

public void addPluginView(String viewID,
                          UISWTViewEventListener l)
Specified by:
addPluginView in interface UIFunctionsSWT

bringToFront

public void bringToFront()
Description copied from interface: UIFunctions
Bring main window to the front

Specified by:
bringToFront in interface UIFunctions

bringToFront

public void bringToFront(boolean tryTricks)
Description copied from interface: UIFunctions
Bring main window to the front

Specified by:
bringToFront in interface UIFunctions

getVisibilityState

public int getVisibilityState()
Specified by:
getVisibilityState in interface UIFunctions

closeDownloadBars

public void closeDownloadBars()
Specified by:
closeDownloadBars in interface UIFunctionsSWT

closePluginView

public void closePluginView(UISWTViewCore view)
Specified by:
closePluginView in interface UIFunctionsSWT

closePluginViews

public void closePluginViews(String sViewID)
Specified by:
closePluginViews in interface UIFunctionsSWT

dispose

public boolean dispose(boolean for_restart,
                       boolean close_already_in_progress)
Description copied from interface: UIFunctions
Request the UI be shut down.

Specified by:
dispose in interface UIFunctions
Returns:
true - request granted, UI is being shut down false - request denied (example: password entry failed)

getMainShell

public org.eclipse.swt.widgets.Shell getMainShell()
Specified by:
getMainShell in interface UIFunctionsSWT

getPluginViews

public UISWTView[] getPluginViews()
Specified by:
getPluginViews in interface UIFunctionsSWT
Returns:

getSWTPluginInstanceImpl

public UISWTInstanceImpl getSWTPluginInstanceImpl()

openPluginView

public void openPluginView(String sParentID,
                           String sViewID,
                           UISWTViewEventListener l,
                           Object dataSource,
                           boolean bSetFocus)
Specified by:
openPluginView in interface UIFunctionsSWT

refreshIconBar

public void refreshIconBar()
Specified by:
refreshIconBar in interface UIFunctions

refreshLanguage

public void refreshLanguage()
Description copied from interface: UIFunctions
Change/Refresh the language of the UI

Specified by:
refreshLanguage in interface UIFunctions

removePluginView

public void removePluginView(String viewID)
Specified by:
removePluginView in interface UIFunctionsSWT

setStatusText

public void setStatusText(String string)
Specified by:
setStatusText in interface UIFunctions

setStatusText

public void setStatusText(int statustype,
                          String string,
                          UIStatusTextClickListener l)
Specified by:
setStatusText in interface UIFunctions

getMainStatusBar

public IMainStatusBar getMainStatusBar()
Specified by:
getMainStatusBar in interface UIFunctionsSWT

openView

@Deprecated
public void openView(int viewID,
                                Object data)
Deprecated. 

Specified by:
openView in interface UIFunctions

getUISWTInstance

public UISWTInstance getUISWTInstance()
Specified by:
getUISWTInstance in interface UIFunctionsSWT

viewURL

public void viewURL(String url,
                    String target,
                    String sourceRef)
Specified by:
viewURL in interface UIFunctions

viewURL

public boolean viewURL(String url,
                       String target,
                       int w,
                       int h,
                       boolean allowResize,
                       boolean isModal)
Specified by:
viewURL in interface UIFunctions

viewURL

public boolean viewURL(String url,
                       String target,
                       double w,
                       double h,
                       boolean allowResize,
                       boolean isModal)
Specified by:
viewURL in interface UIFunctions

promptUser

public void promptUser(String title,
                       String text,
                       String[] buttons,
                       int defaultOption,
                       String rememberID,
                       String rememberText,
                       boolean rememberByDefault,
                       int autoCloseInMS,
                       UserPrompterResultListener l)
Specified by:
promptUser in interface UIFunctions

getUserPrompter

public UIFunctionsUserPrompter getUserPrompter(String title,
                                               String text,
                                               String[] buttons,
                                               int defaultOption)
Specified by:
getUserPrompter in interface UIFunctions

isGlobalTransferBarShown

public boolean isGlobalTransferBarShown()
Specified by:
isGlobalTransferBarShown in interface UIFunctionsSWT

showGlobalTransferBar

public void showGlobalTransferBar()
Specified by:
showGlobalTransferBar in interface UIFunctionsSWT

closeGlobalTransferBar

public void closeGlobalTransferBar()
Specified by:
closeGlobalTransferBar in interface UIFunctionsSWT

refreshTorrentMenu

public void refreshTorrentMenu()
Specified by:
refreshTorrentMenu in interface UIFunctionsSWT

createMainMenu

public IMainMenu createMainMenu(org.eclipse.swt.widgets.Shell shell)
Description copied from interface: UIFunctionsSWT
Creates the main application menu and attach it to the given Shell; this is only used for OSX so that we can attach the global menu to popup dialogs which is the expected behavior on OSX. Windows and Linux do not require this since they do not have a global menu and because their main menu is already attached to the main application window.

Specified by:
createMainMenu in interface UIFunctionsSWT
Returns:

getSkin

public SWTSkin getSkin()

setSkin

public void setSkin(SWTSkin skin)

getMainWindow

public IMainWindow getMainWindow()
Specified by:
getMainWindow in interface UIFunctionsSWT

getUIUpdater

public UIUpdater getUIUpdater()
Description copied from interface: UIFunctions
Retrieves the class that handles periodically updating the UI

Specified by:
getUIUpdater in interface UIFunctions
Returns:

closeAllDetails

public void closeAllDetails()
Specified by:
closeAllDetails in interface UIFunctionsSWT

hasDetailViews

public boolean hasDetailViews()
Specified by:
hasDetailViews in interface UIFunctionsSWT
Returns:

performAction

public void performAction(int action_id,
                          Object args,
                          UIFunctions.actionListener listener)
Specified by:
performAction in interface UIFunctions

showCoreWaitDlg

public org.eclipse.swt.widgets.Shell showCoreWaitDlg()
Specified by:
showCoreWaitDlg in interface UIFunctionsSWT

doSearch

public void doSearch(String sSearchText)
Specified by:
doSearch in interface UIFunctions
Parameters:
searchText -

doSearch

public void doSearch(String sSearchText,
                     boolean toSubscribe)
Specified by:
doSearch in interface UIFunctions

promptForSearch

public void promptForSearch()
Specified by:
promptForSearch in interface UIFunctionsSWT

getMDI

public MultipleDocumentInterface getMDI()
Description copied from interface: UIFunctions
Retrieve the MDI (Sidebar, TabbedMDI)

Specified by:
getMDI in interface UIFunctions
Returns:

getMDISWT

public MultipleDocumentInterfaceSWT getMDISWT()
Specified by:
getMDISWT in interface UIFunctionsSWT

showErrorMessage

public void showErrorMessage(String keyPrefix,
                             String details,
                             String[] textParams)
Specified by:
showErrorMessage in interface UIFunctions
Parameters:
keyPrefix -
details - may not get displayed
textParams -

forceNotify

public void forceNotify(int iconID,
                        String title,
                        String text,
                        String details,
                        Object[] relatedObjects,
                        int timeoutSecs)
Description copied from interface: UIFunctions
Might launch the old-school Mr Slidey

Specified by:
forceNotify in interface UIFunctions

installPlugin

public void installPlugin(String plugin_id,
                          String resource_prefix,
                          UIFunctions.actionListener listener)
Specified by:
installPlugin in interface UIFunctions

getToolBarManager

public UIToolBarManager getToolBarManager()
Specified by:
getToolBarManager in interface UIFunctionsSWT

runOnUIThread

public void runOnUIThread(int ui_type,
                          Runnable runnable)
Specified by:
runOnUIThread in interface UIFunctions

isProgramInstalled

public boolean isProgramInstalled(String extension,
                                  String name)
Specified by:
isProgramInstalled in interface UIFunctions

openRemotePairingWindow

public void openRemotePairingWindow()
Specified by:
openRemotePairingWindow in interface UIFunctions

playOrStreamDataSource

public void playOrStreamDataSource(Object ds,
                                   String referal,
                                   boolean launch_already_checked,
                                   boolean complete_only)
Specified by:
playOrStreamDataSource in interface UIFunctions

setHideAll

public void setHideAll(boolean hidden)
Specified by:
setHideAll in interface UIFunctionsSWT

addTorrentWithOptions

public boolean addTorrentWithOptions(boolean force,
                                     TorrentOpenOptions torrentOptions)
Description copied from interface: UIFunctions
Opens the Torrent Add Options Window, if configured to

Specified by:
addTorrentWithOptions in interface UIFunctions
Parameters:
force - Override configuration, show it!
Returns:
true if torrent was added

addTorrentWithOptions

public boolean addTorrentWithOptions(TorrentOpenOptions torrentOptions,
                                     Map<String,Object> addOptions)
Specified by:
addTorrentWithOptions in interface UIFunctions

openTorrentOpenOptions

public void openTorrentOpenOptions(org.eclipse.swt.widgets.Shell shell,
                                   String sPathOfFilesToOpen,
                                   String[] sFilesToOpen,
                                   boolean defaultToStopped,
                                   boolean forceOpen)
Specified by:
openTorrentOpenOptions in interface UIFunctionsSWT

openTorrentOpenOptions

public void openTorrentOpenOptions(org.eclipse.swt.widgets.Shell shell,
                                   String sPathOfFilesToOpen,
                                   String[] sFilesToOpen,
                                   Map<String,Object> options)
Specified by:
openTorrentOpenOptions in interface UIFunctionsSWT
options - See UIFunctions constants

openTorrentWindow

public void openTorrentWindow()
Specified by:
openTorrentWindow in interface UIFunctionsSWT

showCreateTagDialog

public void showCreateTagDialog(UIFunctions.TagReturner tagReturner)
Specified by:
showCreateTagDialog in interface UIFunctions

createTabbedMDI

public TabbedMdiInterface createTabbedMDI(org.eclipse.swt.widgets.Composite parent,
                                          String id)
Specified by:
createTabbedMDI in interface UIFunctionsSWT
id - TODO

adjustPXForDPI

public int adjustPXForDPI(int px)
Specified by:
adjustPXForDPI in interface UIFunctions