java.lang.Object
net.i2p.router.web.NavHelper
- All Implemented Interfaces:
ClientApp, NavService
Helper for navigation and client application management in router console.
Field Summary
Constructor Summary
ConstructorsConstructorDescriptionCreates a helper with no registered applications; entries appear only afterregisterApp(String, String, String, String, String)is called.Method Summary
Modifier and TypeMethodDescriptionbyte[]Retrieve binary icon for a plugin.private voidgetClientAppImg(StringBuilder buf, String name, String iconpath) Get 16x16 icon img and append to buf.Translated string is loaded byPluginStarter.For HomeHelper.The app's display name.static NavHelperConsole navigation-bar helper, registered as a client app.static NavHelpergetInstance(I2PAppContext ctx) Console navigation-bar helper, registered as a client app.getName()The app's internal name.getState()Always RUNNING.voidTo register a new client application so that it shows up on the router console's nav bar, it should be registered with this singleton.voidStore binary icon for a plugin.voidClear the registered app lists.voidstartup()No-op, nothing to start.voidunregisterApp(String name) Remove an app from the nav bar.
Field Details
_apps
_binary
Constructor Details
NavHelper
public NavHelper()Creates a helper with no registered applications; entries appear only afterregisterApp(String, String, String, String, String)is called.
Method Details
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:
registerAppin 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
unregisterApp
Remove an app from the nav bar.- Specified by:
unregisterAppin interfaceNavService- Parameters:
name- standard name for the app
getBinary
Retrieve binary icon for a plugin.- Parameters:
name- plugin name- Returns:
- null if not found
setBinary
Store binary icon for a plugin.- Parameters:
name- plugin namearr- the icon bytes served for that plugin
getClientAppLinks
Translated string is loaded byPluginStarter.- Returns:
- map of translated name to HTML string, or null if none
getClientAppImg
Get 16x16 icon img and append to buf.- Parameters:
buf- the page output to append the img tag toname- standard app nameiconpath- the app's custom icon path, or null for the default plugin icon
getClientApps
For HomeHelper. 32x32 icon paths.- Parameters:
ctx- unused; the app list is built in the constructor, not from this context- Returns:
- non-null, possibly empty, unsorted
getInstance
Console navigation-bar helper, registered as a client app.- Returns:
- the NavHelper registered with the global context, or null if none is
getInstance
Console navigation-bar helper, registered as a client app.- Parameters:
ctx- the app context whose client app manager holds the registration- Returns:
- the NavHelper registered with that context, or null if none is
startup
shutdown
getState
Always RUNNING.getName
getDisplayName
The app's display name.- Specified by:
getDisplayNamein interfaceClientApp- Returns:
- non-null