Package net.i2p.desktopgui
Class TrayManager
- java.lang.Object
-
- net.i2p.desktopgui.TrayManager
-
- Direct Known Subclasses:
ExternalTrayManager,InternalTrayManager
abstract class TrayManager extends Object
Manages the tray icon life.
-
-
Field Summary
Fields Modifier and Type Field Description protected I2PAppContext_appContextprotected JMenuItem_jnotificationItem1protected JMenuItem_jnotificationItem2protected MenuItem_notificationItem1protected MenuItem_notificationItem2protected boolean_showNotificationsprotected boolean_useSwingprotected static StringPROP_NOTIFICATIONSprotected SystemTraytrayprotected TrayIcontrayIcon
-
Constructor Summary
Constructors Modifier Constructor Description protectedTrayManager(I2PAppContext ctx, boolean useSwing)Instantiate tray manager.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String_t(String s)protected String_t(String s, Object o)MenuHandleaddMenu(String message, MenuCallback callback, MenuHandle p)protected voidconfigureNotifications(boolean enable)Does not save.voiddisableMenu(MenuHandle item)intdisplayMessage(int priority, String title, String message, String path)Send a notification to the user.voidenableMenu(MenuHandle item)protected abstract PopupMenugetMainMenu()Build a popup menu, adding callbacks to the different items.protected abstract JPopupMenugetSwingMainMenu()Build a popup menu, adding callbacks to the different items.voidhideMenu(MenuHandle item)protected voidinitializeJNotificationItems()Initializes _jnotificationItem 1 and 2protected voidinitializeNotificationItems()Initializes _notificationItem 1 and 2voidlanguageChanged()voidremoveMenu(MenuHandle item)voidshowMenu(MenuHandle item)voidstartManager()Add the tray icon to the system tray and start everything up.voidstopManager()Remove the tray icon from the system trayprotected abstract voidupdateMenu()Update the menuvoidupdateMenu(String message, MenuHandle item)
-
-
-
Field Detail
-
_appContext
protected final I2PAppContext _appContext
-
_useSwing
protected final boolean _useSwing
-
tray
protected SystemTray tray
-
trayIcon
protected TrayIcon trayIcon
-
_showNotifications
protected volatile boolean _showNotifications
-
_notificationItem1
protected MenuItem _notificationItem1
-
_notificationItem2
protected MenuItem _notificationItem2
-
_jnotificationItem1
protected JMenuItem _jnotificationItem1
-
_jnotificationItem2
protected JMenuItem _jnotificationItem2
-
PROP_NOTIFICATIONS
protected static final String PROP_NOTIFICATIONS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TrayManager
protected TrayManager(I2PAppContext ctx, boolean useSwing)
Instantiate tray manager.
-
-
Method Detail
-
startManager
public void startManager() throws AWTExceptionAdd the tray icon to the system tray and start everything up.- Throws:
AWTException
-
stopManager
public void stopManager()
Remove the tray icon from the system tray- Since:
- 0.9.26
-
languageChanged
public void languageChanged()
-
getMainMenu
protected abstract PopupMenu getMainMenu()
Build a popup menu, adding callbacks to the different items.- Returns:
- popup menu
-
getSwingMainMenu
protected abstract JPopupMenu getSwingMainMenu()
Build a popup menu, adding callbacks to the different items.- Returns:
- popup menu
- Since:
- 0.9.26
-
updateMenu
protected abstract void updateMenu()
Update the menu- Since:
- 0.9.26
-
displayMessage
public int displayMessage(int priority, String title, String message, String path)Send a notification to the user.- Parameters:
title- for the popup, translatedmessage- translatedpath- unsupported- Returns:
- 0, or -1 on failure
-
configureNotifications
protected void configureNotifications(boolean enable)
Does not save. See InternalTrayManager.- Since:
- 0.9.58 moved up from InternalTrayManager
-
initializeNotificationItems
protected void initializeNotificationItems()
Initializes _notificationItem 1 and 2- Since:
- 0.9.58 pulled out of InternalTrayManager
-
initializeJNotificationItems
protected void initializeJNotificationItems()
Initializes _jnotificationItem 1 and 2- Since:
- 0.9.58 pulled out of InternalTrayManager
-
addMenu
public MenuHandle addMenu(String message, MenuCallback callback, MenuHandle p)
- Since:
- 0.9.59
-
removeMenu
public void removeMenu(MenuHandle item)
- Since:
- 0.9.59
-
showMenu
public void showMenu(MenuHandle item)
- Since:
- 0.9.59
-
hideMenu
public void hideMenu(MenuHandle item)
- Since:
- 0.9.59
-
enableMenu
public void enableMenu(MenuHandle item)
- Since:
- 0.9.59
-
disableMenu
public void disableMenu(MenuHandle item)
- Since:
- 0.9.59
-
updateMenu
public void updateMenu(String message, MenuHandle item)
- Since:
- 0.9.59
-
-