java.lang.Object
net.i2p.router.web.FormHandler
net.i2p.router.web.helpers.ConfigSidebarHandler

public class ConfigSidebarHandlerextends FormHandler
Simple sidebar configuration handler.
  • Field Details

  • Constructor Details

    • ConfigSidebarHandler

      public ConfigSidebarHandler()
      ConfigSidebarHandler default constructor.
  • Method Details

    • processForm

      protected void processForm()
      Processes the form submission from the sidebar configuration page. Handles add, delete, move, save order, and restore defaults actions. Delegates to helper methods as appropriate.
      Specified by:
      processForm in class FormHandler
    • handleSave

      private void handleSave(boolean currentUnifiedSidebar, boolean currentStickySidebar)
      Saves the sidebar settings from the form.
      Parameters:
      currentUnifiedSidebar - true if the unified sidebar is on now
      currentStickySidebar - true if the sticky sidebar is on now
    • handleGraphSave

      private void handleGraphSave()
      Saves the sidebar graph settings.
    • parseRefreshInterval

      private int parseRefreshInterval(String refreshStr) throws NumberFormatException
      Parses the graph refresh interval from the form.
      Parameters:
      refreshStr - the string from the form
      Returns:
      the interval, in seconds
      Throws:
      NumberFormatException - if it is not a number
    • getJettyStringOrDefault

      private String getJettyStringOrDefault(String key, String defaultVal)
      Reads a Jetty config value.
      Parameters:
      key - the config key
      defaultVal - the value to use if unset
      Returns:
      the value in use
    • restoreDefault

      private void restoreDefault(boolean full)
      Restores the default sidebar settings.
      Parameters:
      full - true to restore the sections as well
    • moveSection

      public void moveSection(String action)
      Moves, adds, deletes, or saves sidebar sections ordering based on the requested action. Updates the sidebar sections order and persists the changes.
      Parameters:
      action - the resolved fixed action value (additem, deleteitems, or move_N)
    • handleAddSection

      private void handleAddSection(Map<Integer,String> sections)
      Adds a sidebar section from the form.
      Parameters:
      sections - the current sections, by position
    • handleDeleteSections

      private void handleDeleteSections(Map<Integer,String> sections)
      Deletes the sections marked in the form.
      Parameters:
      sections - the current sections, by position
    • handleMoveSection

      private void handleMoveSection(Map<Integer,String> sections)
      Moves one sidebar section.
      Parameters:
      sections - the current sections, by position
    • setMovingAction

      public void setMovingAction()
      Scans settings to detect move button actions and sets the _action field accordingly.