Package net.i2p.desktopgui
Class Main
- java.lang.Object
-
- net.i2p.desktopgui.Main
-
- All Implemented Interfaces:
ClientApp,MenuService,NotificationService,RouterApp
public class Main extends Object implements RouterApp, NotificationService, MenuService
The main class of the application.
-
-
Field Summary
Fields Modifier and Type Field Description static StringPROP_ENABLE
-
Constructor Summary
Constructors Constructor Description Main()Main(RouterContext ctx, ClientAppManager mgr, String[] args)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MenuHandleaddMenu(String message, MenuCallback callback)Menu will start out shown and enabled, in the root menuMenuHandleaddMenu(String message, MenuCallback callback, MenuHandle parent)Menu will start out enabled, as a submenubooleancancel(int id)Cancel a notification if possible.voiddisableMenu(MenuHandle item)voidenableMenu(MenuHandle item)StringgetDisplayName()The display name of the ClientApp, used in user interfaces.StringgetName()The generic name of the ClientApp, used for registration, e.g.ClientAppStategetState()The current state of the ClientApp.voidhideMenu(MenuHandle item)static voidmain(String[] args)intnotify(String source, String category, int priority, String title, String message, String path)Send a notification to the user.voidremoveMenu(MenuHandle item)voidshowMenu(MenuHandle item)voidshutdown(String[] args)Do not take a long time.voidstartup()Do not take a long time.booleanupdate(int id, String title, String message, String path)Update the text of a notification if possible.voidupdateMenu(String message, MenuHandle item)
-
-
-
Field Detail
-
PROP_ENABLE
public static final String PROP_ENABLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Main
public Main(RouterContext ctx, ClientAppManager mgr, String[] args)
- Since:
- 0.9.26
-
Main
public Main()
- Since:
- 0.9.26
-
-
Method Detail
-
main
public static void main(String[] args)
-
notify
public int notify(String source, String category, int priority, String title, String message, String path)
Send a notification to the user.- Specified by:
notifyin interfaceNotificationService- Parameters:
source- unsupportedcategory- unsupportedpriority- unsupportedtitle- for the popup, translatedmessage- translatedpath- unsupported- Returns:
- 0, or -1 on failure
-
cancel
public boolean cancel(int id)
Cancel a notification if possible. Unsupported.- Specified by:
cancelin interfaceNotificationService- Parameters:
id- as received from notify()- Returns:
- false always
-
update
public boolean update(int id, String title, String message, String path)Update the text of a notification if possible. Unsupported.- Specified by:
updatein interfaceNotificationService- Parameters:
id- as received from notify()title- for the popup, translatedmessage- translatedpath- in console starting with /, must be URL-escaped, or null- Returns:
- false always
-
addMenu
public MenuHandle addMenu(String message, MenuCallback callback)
Menu will start out shown and enabled, in the root menu- Specified by:
addMenuin interfaceMenuService- Parameters:
message- for the menu, translatedcallback- fired on click- Returns:
- null on error
- Since:
- 0.9.59
-
addMenu
public MenuHandle addMenu(String message, MenuCallback callback, MenuHandle parent)
Menu will start out enabled, as a submenu- Specified by:
addMenuin interfaceMenuService- Parameters:
message- for the menu, translatedcallback- fired on clickparent- the parent menu this will be a submenu of, or null for top level- Returns:
- null on error
- Since:
- 0.9.59
-
removeMenu
public void removeMenu(MenuHandle item)
- Specified by:
removeMenuin interfaceMenuService- Since:
- 0.9.59
-
showMenu
public void showMenu(MenuHandle item)
- Specified by:
showMenuin interfaceMenuService- Since:
- 0.9.59
-
hideMenu
public void hideMenu(MenuHandle item)
- Specified by:
hideMenuin interfaceMenuService- Since:
- 0.9.59
-
enableMenu
public void enableMenu(MenuHandle item)
- Specified by:
enableMenuin interfaceMenuService- Since:
- 0.9.59
-
disableMenu
public void disableMenu(MenuHandle item)
- Specified by:
disableMenuin interfaceMenuService- Since:
- 0.9.59
-
updateMenu
public void updateMenu(String message, MenuHandle item)
- Specified by:
updateMenuin interfaceMenuService- Since:
- 0.9.59
-
startup
public void startup()
Description copied from interface:ClientAppDo not take a long time. Do not block. Start threads here if necessary. Client must call ClientAppManager.notify() at least once within this method to change the state from INITIALIZED to something else. Will not be called multiple times on the same object.
-
shutdown
public void shutdown(String[] args)
Description copied from interface:ClientAppDo not take a long time. Do not block. Use a thread if necessary. If previously running, client must call ClientAppManager.notify() at least once within this method to change the state to STOPPING or STOPPED. May be called multiple times on the same object, in any state.
-
getState
public ClientAppState getState()
Description copied from interface:ClientAppThe current state of the ClientApp.
-
getName
public String getName()
Description copied from interface:ClientAppThe generic name of the ClientApp, used for registration, e.g. "console". Do not translate.
-
getDisplayName
public String getDisplayName()
Description copied from interface:ClientAppThe display name of the ClientApp, used in user interfaces. The app must translate.- Specified by:
getDisplayNamein interfaceClientApp- Returns:
- non-null
- Since:
- 0.9.26
-
-