Interface MenuNode

  • All Known Implementing Classes:
    Menu, MenuItem

    public interface MenuNode
    Interface for the menu nodes in the menu tree. The menu nodes are either a menu or a menu item.
    • Method Detail

      • getId

        @NotEmpty
        @NotEmpty String getId()
        Returns:
        the ID of this menu node
      • getLabel

        @NotEmpty
        @NotEmpty String getLabel()
        Returns:
        the label of this menu node to use when displaying the menu
      • isMenu

        boolean isMenu()
        Returns:
        true if this is a menu, false if it is a menu item
      • filter

        Optional<MenuNode> filter​(Predicate<MenuNode> predicate)
        Filters all Menu nodes by applying the predicate to their items.
        Parameters:
        predicate - Predicate to apply to the items
        Returns:
        the filtered menu node
      • getPath

        Optional<List<String>> getPath​(String id)
        Returns the path from this menu node to the menu with given ID.
        Parameters:
        id - the ID of the menu to look for
        Returns:
        Optional List of Strings of the IDs of the menus leading up to the specified id, or Optional.empty() if this menu does not contain a node with the specified ID
      • contains

        boolean contains​(Predicate<MenuNode> predicate)
        Checks if this Menu node contains a menu node matching the given predicate
        Parameters:
        predicate - the predicate to match
        Returns:
        boolean true if it contains a matching node, else false
      • firstItem

        Optional<MenuItem> firstItem()
        Finds the first menu item in this menu node. If it is a menu, this is the first item of its first child.