Class JsonMenuItem

java.lang.Object
jmri.server.web.app.JsonMenuItem
All Implemented Interfaces:
WebMenuItem

public class JsonMenuItem
extends Object
implements WebMenuItem
A POJO for Web menu items generated from JSON.
  • Field Details

  • Constructor Details

  • Method Details

    • getPath

      public String getPath()
      Description copied from interface: WebMenuItem
      Get the path to the menu item. This should be the same regardless of locale. Use forward slashes (/ ) to separate menu items to create sub menus. Menu items will have the id navbar-<path>

      Primary menu items will not have a separator.

      Specified by:
      getPath in interface WebMenuItem
      Returns:
      the path to the menu item
    • getHref

      public String getHref()
      Description copied from interface: WebMenuItem
      Get the URL for the menu item. This may be an absolute URL path in the JMRI web service, a URL that resolves to some other public location, or a JavaScript trigger. If null, the menu item will not have a link. If the HREF starts with ng-click:, it will be treated as a JavaScript trigger instead of a URL.
      Specified by:
      getHref in interface WebMenuItem
      Returns:
      the hyper-reference or null if the item is not a link
    • getIconClass

      public String getIconClass()
      Description copied from interface: WebMenuItem
      Get the icon for the menu item. This icon needs to be the class attributes for the HTML span element that contains the icon. It is recommended that this icon be one of the Font Awesome or Patternfly icons as these icon sets will be available.

      Icons will only be displayed for items in the primary menu.

      Specified by:
      getIconClass in interface WebMenuItem
      Returns:
      the class(es) for the icon or null if no icon is to be used
    • getTitle

      public String getTitle​(Locale locale)
      Description copied from interface: WebMenuItem
      Get the title for the menu item. This is displayed in the menu.
      Specified by:
      getTitle in interface WebMenuItem
      Parameters:
      locale - the client locale
      Returns:
      the localized title
    • getPosition

      public int getPosition()
      Description copied from interface: WebMenuItem
      The relative position of the menu item. If two menu items have the same relative position, they will be sorted in order by the path. For items within a sub menu, this position only applies to the sub menu.
      Specified by:
      getPosition in interface WebMenuItem
      Returns:
      the relative position
    • isSeparatedBefore

      public boolean isSeparatedBefore()
      Description copied from interface: WebMenuItem
      Indicate if the menu item should have a separator before it. Note that if there are multiple items with the same position, they will be grouped on the same side of the separator if any of the items requires a separator.
      Specified by:
      isSeparatedBefore in interface WebMenuItem
      Returns:
      true if there should be a separator before the item; false otherwise
    • isSeparatedAfter

      public boolean isSeparatedAfter()
      Description copied from interface: WebMenuItem
      Indicate if the menu item should have a separator after it. Note that if there are multiple items with the same position, they will be grouped on the same side of the separator if any of the items requires a separator.
      Specified by:
      isSeparatedAfter in interface WebMenuItem
      Returns:
      true if there should be a separator after the item; false otherwise
    • isDynamic

      public boolean isDynamic()
      Description copied from interface: WebMenuItem
      Indicate if the menu item is the anchor for a dynamic menu. A dynamic menu is one that is built on as needed, often by JavaScript executed on the client.
      Specified by:
      isDynamic in interface WebMenuItem
      Returns:
      true if the menu item is an anchor for a dynamic menu; false otherwise