public class MenuHelper extends Object
MenuItem & MenuItemState traversal.
Can extends this.| Constructor and Description |
|---|
MenuHelper() |
| Modifier and Type | Method and Description |
|---|---|
static MenuItemState |
cloneMenuItemToState(MenuItem item,
Integer levels)
generate State tree from an
MenuItem upto levels. |
<T extends AbsrtactHierarchialItem> |
getDepth(T item,
boolean shortCircuit)
Get depth of tree.
|
<T extends AbsrtactHierarchialItem> |
getFirstFertileChild(T item)
Convenience method to get the first child element (that has children)
for a given list of children in the item
|
MenuItem |
getLogicalFocussedPage(String currentPageUrlPath,
Map<String,MenuItem> pageMenuMap,
String defaultPageName,
boolean cacheByRefIdIfNotFound)
Gets the logical path name from the page parameters;
if not its extracts it from the end of the path.
|
static MenuItem |
getMenuByRef(String refId,
Map<String,MenuItem> pageMenuMap)
Search for a MenuItem by references from a map
|
static MenuItem |
getMenuByRef(String refId,
MenuItem rootMenuItem)
Search for a MenuItem by references from the root
MenuItem |
<T extends AbsrtactHierarchialItem> |
getSelectedItemHierarchy(T focussedItem,
T item)
Check if selectedItem is in item's hierarchy.
|
String |
scanOutAppSpecificReference(String currentPageUrlPath)
Special function to sniff out raw Wicket class URLs as the intended target; else it returns null
|
public static MenuItemState cloneMenuItemToState(MenuItem item, Integer levels)
MenuItem upto levels. If levels is null, then all levels to child
node are followed.item - as MenuItemint - @nullable trueMenuItemStatepublic static MenuItem getMenuByRef(String refId, MenuItem rootMenuItem)
MenuItemrefId - rootMenuItem - public static MenuItem getMenuByRef(String refId, Map<String,MenuItem> pageMenuMap)
refId - rootMenuItem - public String scanOutAppSpecificReference(String currentPageUrlPath)
currentPageUrlPath - public MenuItem getLogicalFocussedPage(String currentPageUrlPath, Map<String,MenuItem> pageMenuMap, String defaultPageName, boolean cacheByRefIdIfNotFound)
currentPageUrlPath - as String (current page path URL)pageMenuMap - as Map of String to MenuItemdefaultPageName - as String (TODO: Remove this shit once we have clarity !)cacheByRefIdIfNotFound - On true: If the MenuItem is not found, before checking defaultPage then it will cache it in the pageMenuMap for future reference (TODO: Remove this shit once we have clarity !)MenuItem, which Menu item the page corresponds to
TODO: Add Unit Testpublic <T extends AbsrtactHierarchialItem> T getFirstFertileChild(T item)
T - item - shortCircuit - public <T extends AbsrtactHierarchialItem> int getDepth(T item, boolean shortCircuit)
T - as AbsrtactHierarchialItemitem - as T type that has children itemsshortCircuit; - if true will follow the path of first depth and return with its depth.public <T extends AbsrtactHierarchialItem> List<T> getSelectedItemHierarchy(T focussedItem, T item)
focussedItem - as extends AbsrtactHierarchialItemitem - as extends AbsrtactHierarchialItemList of extends AbsrtactHierarchialItemCopyright © 2018. All rights reserved.