Package org.opencms.ui.contextmenu
Class CmsContextMenuTreeBuilder
java.lang.Object
org.opencms.ui.contextmenu.CmsContextMenuTreeBuilder
Helper class for building context menus from the list of available context menu items.
-
Constructor Summary
ConstructorDescriptionCreates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbuildAll
(List<I_CmsContextMenuItem> availableItems) Builds the complete context menu from the given available items.buildTree
(List<I_CmsContextMenuItem> items) Builds a tree from a list of available context menu items.Returns the default action item if available.Gets the visibility for a given item (cached, if possible).void
Recursively remove subtrees (destructively!) which do not contain any 'leaf' context menu items.
-
Constructor Details
-
CmsContextMenuTreeBuilder
Creates a new instance.- Parameters:
context
- the dialog context
-
-
Method Details
-
buildAll
Builds the complete context menu from the given available items.- Parameters:
availableItems
- the available items- Returns:
- the complete context menu
-
buildTree
Builds a tree from a list of available context menu items.The root node of the returned tree has no useful data, its child nodes correspond to the top-level entries of the ccontext menu.
- Parameters:
items
- the available context menu items- Returns:
- the context menu item tree
-
getDefaultActionItem
Returns the default action item if available.Only available once
buildTree(List)
orbuildAll(List)
has been executed.- Returns:
- the default action item
-
removeEmptySubtrees
Recursively remove subtrees (destructively!) which do not contain any 'leaf' context menu items.- Parameters:
root
- the root of the tree to process
-