Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
The existing menu component allows hierarchical support of menus. A top menu can have several submenus etc. However, if you have a menu node to view a 'customerList' page and a link from that page takes the user to a page (editCustomer) that is not a menu node, then any mechanism that is in place to keep the menu hierarchy open fails, since the 'selected' menu node is no longer selected. What is required is that the 'customerList' menu node needs to know what sub pages can be displayed from 'customerList'.
A suggested solution - allow a comma-separated list of pages to be added to a node, and change the select method to determine if the resourcePath is part of this comma-separated list.
Eg: menu.xml
<menu label="Management" path="customerList.htm">
<menu label="Customers" path="customerList.htm" title="Customers"
pages="/editCustomer.htm,deleteCustomer.htm,viewCustomer.htm"/>
</menu>
And, in Menu.java:
public void select(Context context) {
String pageToView = context.getResourcePath();
if (pages.contains(pageToView))
else {
String path = getPath();
if (path != null)
else
{ selected = false; } }
for (int i = 0; i < getChildren().size(); i++) {
Menu menu = (Menu) getChildren().get;
menu.select(context);
if (menu.isSelected())
}
}
Obviously the page list needs to be parsed in the getRootMenu method into a 'pages' ArrayList, similar to the 'roles' code,