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

  Helper for navigation and client application management in router console.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NavHelper()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getBinary(String name)` Retrieve binary icon for a plugin
    `Map<String,String>` | `getClientAppLinks()` Translated string is loaded by PluginStarter
    `List<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 plugin
    `void` | `shutdown(String[] args)` Do not take a long time.
    `void` | `startup()` Do not take a long time.
    `void` | `unregisterApp(String name)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NavHelper

          public NavHelper()

  - ### Method Detail

    - #### getBinary

          public byte[] getBinary(String name)

      Retrieve binary icon for a plugin
      Parameters:
        `name` - plugin name
      Returns:
        null if not found

    - #### 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

    - #### 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 interface `ClientApp`
      Returns:
        non-null

    - #### getInstance

          public static NavHelper getInstance()

    - #### getInstance

          public static NavHelper getInstance(I2PAppContext ctx)

    - #### getName

          public String getName()

      Description copied from interface: `ClientApp`
      The generic name of the ClientApp, used for registration, e.g. "console". Do not translate.
      Specified by:
        `getName` in interface `ClientApp`
      Returns:
        non-null

    - #### getState

          public ClientAppState getState()

      Description copied from interface: `ClientApp`
      The current state of the ClientApp.
      Specified by:
        `getState` in interface `ClientApp`
      Returns:
        non-null

    - #### 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 interface `NavService`
      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 name
        `path` - full path pointing to the application's root (e.g. /i2ptunnel/index.jsp), non-null
        `tooltip` - HTML escaped text or null
        `iconpath` - path-only URL starting with /, HTML escaped, or null

    - #### setBinary

          public void setBinary(String name,
                                byte[] arr)

      Store binary icon for a plugin
      Parameters:
        `name` - plugin name

    - #### 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.
      Specified by:
        `shutdown` in interface `ClientApp`
      Parameters:
        `args` - generally null but could be stopArgs from clients.config

    - #### 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.
      Specified by:
        `startup` in interface `ClientApp`

    - #### unregisterApp

          public void unregisterApp(String name)

      Specified by:
        `unregisterApp` in interface `NavService`
      Parameters:
        `name` - standard name for the app