Package net.i2p.router.web
Class NavHelper
- java.lang.Object
-
- net.i2p.router.web.NavHelper
-
- All Implemented Interfaces:
ClientApp
,NavService
public class NavHelper extends Object implements NavService, ClientApp
-
-
Constructor Summary
Constructors Constructor Description NavHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getBinary(String name)
Retrieve binary icon for a pluginMap<String,String>
getClientAppLinks()
Translated string is loaded by PluginStarterList<App>
getClientApps(I2PAppContext ctx)
For HomeHelper.String
getDisplayName()
The display name of the ClientApp, used in user interfaces.static NavHelper
getInstance()
static NavHelper
getInstance(I2PAppContext ctx)
String
getName()
The generic name of the ClientApp, used for registration, e.g.ClientAppState
getState()
The current state of the ClientApp.void
registerApp(String appName, String displayName, String path, String tooltip, String iconpath)
To register a new client application so that it shows up on the router console's nav bar, it should be registered with this singleton.void
setBinary(String name, byte[] arr)
Store binary icon for a pluginvoid
shutdown(String[] args)
Do not take a long time.void
startup()
Do not take a long time.void
unregisterApp(String name)
-
-
-
Method Detail
-
registerApp
public void registerApp(String appName, String displayName, String path, String tooltip, String iconpath)
To register a new client application so that it shows up on the router console's nav bar, it should be registered with this singleton.- Specified by:
registerApp
in interfaceNavService
- Parameters:
appName
- standard name for the app (plugin)displayName
- translated name the app will be called in the link warning, this is the display name aka ConsoleLinkName, not the plugin namepath
- full path pointing to the application's root (e.g. /i2ptunnel/index.jsp), non-nulltooltip
- HTML escaped text or nulliconpath
- path-only URL starting with /, HTML escaped, or null- Since:
- 0.9.20 added iconpath parameter
-
unregisterApp
public void unregisterApp(String name)
- Specified by:
unregisterApp
in interfaceNavService
- Parameters:
name
- standard name for the app
-
getBinary
public byte[] getBinary(String name)
Retrieve binary icon for a plugin- Parameters:
name
- plugin name- Returns:
- null if not found
- Since:
- 0.9.25
-
setBinary
public void setBinary(String name, byte[] arr)
Store binary icon for a plugin- Parameters:
name
- plugin name- Since:
- 0.9.25
-
getClientAppLinks
public Map<String,String> getClientAppLinks()
Translated string is loaded by PluginStarter- Returns:
- map of translated name to HTML string, or null if none
-
getClientApps
public List<App> getClientApps(I2PAppContext ctx)
For HomeHelper. 32x32 icon paths.- Parameters:
ctx
- unused- Returns:
- non-null, possibly empty, unsorted
- Since:
- 0.9, public since 0.9.33, was package private
-
getInstance
public static NavHelper getInstance()
- Since:
- 0.9.56
-
getInstance
public static NavHelper getInstance(I2PAppContext ctx)
- Since:
- 0.9.56
-
startup
public void startup()
Description copied from interface:ClientApp
Do 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:ClientApp
Do 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:ClientApp
The current state of the ClientApp.
-
getName
public String getName()
Description copied from interface:ClientApp
The generic name of the ClientApp, used for registration, e.g. "console". Do not translate.
-
getDisplayName
public String getDisplayName()
Description copied from interface:ClientApp
The display name of the ClientApp, used in user interfaces. The app must translate.- Specified by:
getDisplayName
in interfaceClientApp
- Returns:
- non-null
- Since:
- 0.9.56
-
-