Package jmri.server.web.app
Class JsonMenuItem
java.lang.Object
jmri.server.web.app.JsonMenuItem
- All Implemented Interfaces:
WebMenuItem
A POJO for Web menu items generated from JSON.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJsonMenuItem(com.fasterxml.jackson.databind.JsonNode node) Create a menu item from a JSON object. -
Method Summary
Modifier and TypeMethodDescriptiongetHref()Get the URL for the menu item.Get the icon for the menu item.getPath()Get the path to the menu item.intThe relative position of the menu item.Get the title for the menu item.booleanIndicate if the menu item is the anchor for a dynamic menu.booleanIndicate if the menu item should have a separator after it.booleanIndicate if the menu item should have a separator before it.
-
Field Details
-
path
-
href
-
iconClass
-
title
-
position
-
separatedBefore
-
separatedAfter
-
dynamic
-
-
Constructor Details
-
JsonMenuItem
public JsonMenuItem(@Nonnull com.fasterxml.jackson.databind.JsonNode node) throws IllegalArgumentException Create a menu item from a JSON object.- Parameters:
node- the JSON object containing the menu item- Throws:
IllegalArgumentException- if node does not contain a path node
-
-
Method Details
-
getPath
Description copied from interface:WebMenuItemGet 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 idnavbar-<path>Primary menu items will not have a separator.
- Specified by:
getPathin interfaceWebMenuItem- Returns:
- the path to the menu item
-
getHref
Description copied from interface:WebMenuItemGet 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 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:
getHrefin interfaceWebMenuItem- Returns:
- the hyper-reference or null if the item is not a link
-
getIconClass
Description copied from interface:WebMenuItemGet 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:
getIconClassin interfaceWebMenuItem- Returns:
- the class(es) for the icon or null if no icon is to be used
-
getTitle
Description copied from interface:WebMenuItemGet the title for the menu item. This is displayed in the menu.- Specified by:
getTitlein interfaceWebMenuItem- Parameters:
locale- the client locale- Returns:
- the localized title
-
getPosition
Description copied from interface:WebMenuItemThe 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:
getPositionin interfaceWebMenuItem- Returns:
- the relative position
-
isSeparatedBefore
Description copied from interface:WebMenuItemIndicate 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:
isSeparatedBeforein interfaceWebMenuItem- Returns:
- true if there should be a separator before the item; false otherwise
-
isSeparatedAfter
Description copied from interface:WebMenuItemIndicate 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:
isSeparatedAfterin interfaceWebMenuItem- Returns:
- true if there should be a separator after the item; false otherwise
-
isDynamic
Description copied from interface:WebMenuItemIndicate 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:
isDynamicin interfaceWebMenuItem- Returns:
- true if the menu item is an anchor for a dynamic menu; false otherwise
-