Package fr.paris.lutece.portal.web.menu
Class MenuItem
- java.lang.Object
-
- fr.paris.lutece.portal.web.menu.MenuItem
-
public class MenuItem extends java.lang.ObjectRepresents 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMenuItem.Builderstatic classMenuItem.MenuTreeBuilder
-
Constructor Summary
Constructors Constructor Description MenuItem(int nPageId, int nParentId, java.lang.String strPageName, java.lang.String strPageDescription, java.lang.Integer nLevel, java.lang.Integer nMenuIndex, java.lang.Integer nSubMenuIndex, java.lang.Integer nCurrentPageId, java.lang.String strRole)Constructs a MenuItem with the specified properties.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MenuItem.Builderbuilder()java.util.List<MenuItem>getChildren()Gets the list of child menu items.java.lang.IntegergetCurrentPageId()Gets the current page ID associated with this menu item.java.lang.IntegergetLevel()Gets the level of this menu item in the menu hierarchy.java.lang.IntegergetMenuIndex()Gets the index of this menu item in the menu.java.lang.StringgetPageDescription()Gets the description of the page for this menu item.intgetPageId()Gets the page ID of this menu item.java.lang.StringgetPageName()Gets the name of the page for this menu item.intgetParentId()Gets the parent page ID of this menu item.java.lang.StringgetRole()Gets the role required to view this menu item.java.lang.IntegergetSubMenuIndex()Gets the index of this menu item in the submenu.
-
-
-
Constructor Detail
-
MenuItem
public MenuItem(int nPageId, int nParentId, java.lang.String strPageName, java.lang.String strPageDescription, java.lang.Integer nLevel, java.lang.Integer nMenuIndex, java.lang.Integer nSubMenuIndex, java.lang.Integer nCurrentPageId, java.lang.String strRole)Constructs a MenuItem with the specified properties.- Parameters:
nPageId- the page ID of the menu itemnParentId- the parent page ID (0 if root)strPageName- the name of the pagestrPageDescription- the description of the pagenLevel- the level in the menu hierarchynMenuIndex- the index in the menunSubMenuIndex- the index in the submenunCurrentPageId- the current page IDstrRole- the role required to view this menu item
-
-
Method Detail
-
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 java.lang.String getPageName()
Gets the name of the page for this menu item.- Returns:
- the page name
-
getPageDescription
public java.lang.String getPageDescription()
Gets the description of the page for this menu item.- Returns:
- the page description
-
getLevel
public java.lang.Integer getLevel()
Gets the level of this menu item in the menu hierarchy.- Returns:
- the level (may be null)
-
getMenuIndex
public java.lang.Integer getMenuIndex()
Gets the index of this menu item in the menu.- Returns:
- the menu index (may be null)
-
getSubMenuIndex
public java.lang.Integer getSubMenuIndex()
Gets the index of this menu item in the submenu.- Returns:
- the submenu index (may be null)
-
getCurrentPageId
public java.lang.Integer getCurrentPageId()
Gets the current page ID associated with this menu item.- Returns:
- the current page ID (may be null)
-
getRole
public java.lang.String getRole()
Gets the role required to view this menu item.- Returns:
- the role string
-
getChildren
public java.util.List<MenuItem> getChildren()
Gets the list of child menu items.- Returns:
- the list of children
-
builder
public static MenuItem.Builder builder()
-
-