Class MenuItem

java.lang.Object
fr.paris.lutece.portal.web.menu.MenuItem

public class MenuItem extends Object
Represents a menu item in the portal menu structure. Each MenuItem can have child menu items, forming a tree structure.

This class provides information about the menu item such as its page ID, parent ID, name, description, level, menu index, sub-menu index, current page ID, role, and its children. It also provides a builder for easy construction and a utility to build a tree from a flat list.

  • Constructor Details

    • MenuItem

      public MenuItem(int nPageId, int nParentId, String strPageName, String strPageDescription, Integer nLevel, Integer nMenuIndex, Integer nSubMenuIndex, Integer nCurrentPageId, String strRole)
      Constructs a MenuItem with the specified properties.
      Parameters:
      nPageId - the page ID of the menu item
      nParentId - the parent page ID (0 if root)
      strPageName - the name of the page
      strPageDescription - the description of the page
      nLevel - the level in the menu hierarchy
      nMenuIndex - the index in the menu
      nSubMenuIndex - the index in the submenu
      nCurrentPageId - the current page ID
      strRole - the role required to view this menu item
  • Method Details

    • getPageId

      public int getPageId()
      Gets the page ID of this menu item.
      Returns:
      the page ID
    • getParentId

      public int getParentId()
      Gets the parent page ID of this menu item.
      Returns:
      the parent page ID (0 if root)
    • getPageName

      public String getPageName()
      Gets the name of the page for this menu item.
      Returns:
      the page name
    • getPageDescription

      public String getPageDescription()
      Gets the description of the page for this menu item.
      Returns:
      the page description
    • getLevel

      public Integer getLevel()
      Gets the level of this menu item in the menu hierarchy.
      Returns:
      the level (may be null)
    • getMenuIndex

      public Integer getMenuIndex()
      Gets the index of this menu item in the menu.
      Returns:
      the menu index (may be null)
    • getSubMenuIndex

      public Integer getSubMenuIndex()
      Gets the index of this menu item in the submenu.
      Returns:
      the submenu index (may be null)
    • getCurrentPageId

      public Integer getCurrentPageId()
      Gets the current page ID associated with this menu item.
      Returns:
      the current page ID (may be null)
    • getRole

      public String getRole()
      Gets the role required to view this menu item.
      Returns:
      the role string
    • getChildren

      public List<MenuItem> getChildren()
      Gets the list of child menu items.
      Returns:
      the list of children
    • builder

      public static MenuItem.Builder builder()