Interface MenuVisitor
-
- All Known Implementing Classes:
BaseMenuVisitor
@JsType public interface MenuVisitorVisitor interface for implementing arbitrary operations over menus. For example, a visitor could filter a menu tree for items that the current user has permission to see; it could build widgets in a particular view module; it could simply dump the menu structure to a string.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidvisit(MenuCustom<?> menuCustom)Visits a custom menu item in the menu tree.voidvisit(MenuItemCommand menuItemCommand)Visits a menu item that has an associated command.voidvisit(MenuItemPerspective menuItemPerspective)Visits a menu item that has an associated perspective.voidvisit(MenuItemPlain menuItemPlain)Visits a plain menu item in the tree.booleanvisitEnter(MenuGroup menuGroup)Visits a menu group in the tree of menus.booleanvisitEnter(Menus menus)Visits the top-level menu container.voidvisitLeave(MenuGroup menuGroup)Visits a menu group in the tree of menus.voidvisitLeave(Menus menus)Ends the visit of the top-level menu container.
-
-
-
Method Detail
-
visitEnter
boolean visitEnter(Menus menus)
Visits the top-level menu container. This is the first method invoked when visiting a complete menu tree.- Parameters:
menus- the top-level container of the menus that will be visited.- Returns:
- true if the visitor would like to continue down the tree and visit all children; false if it wants to skip this node. Since this is the root node, returning false from this call will result in no more calls to the visitor.
-
visitLeave
void visitLeave(Menus menus)
Ends the visit of the top-level menu container. This is the last method invoked when visiting a complete menu tree.Note that this method is not called if
visitEnter(Menus)returns false.- Parameters:
menus- the top-level container of the menus that will be visited.
-
visitEnter
@JsMethod(name="visitEnterGroup") boolean visitEnter(MenuGroup menuGroup)
Visits a menu group in the tree of menus. A menu group has zero or more MenuItem children.- Parameters:
menuGroup- the menu group to visit.- Returns:
- true if the visitor would like to visit all children of this node; false if it wants to skip this node. A
visitor that returns false from this node will not receive any further calls for this node or its
descendants. In particular, there will be no corresponding
visitLeave(MenuGroup)call for this node.
-
visitLeave
@JsMethod(name="visitLeaveGroup") void visitLeave(MenuGroup menuGroup)
Visits a menu group in the tree of menus. All descendants of the given menu group have been visited before this method is called.Note that this method is not called for a MenuGroup where the
visitEnter(MenuGroup)method returned false.- Parameters:
menuGroup- the menu group to leave.
-
visit
void visit(MenuItemPlain menuItemPlain)
Visits a plain menu item in the tree.- Parameters:
menuItemPlain- the plain menu item to visit.
-
visit
@JsMethod(name="visitCommand") void visit(MenuItemCommand menuItemCommand)
Visits a menu item that has an associated command.- Parameters:
menuItemCommand- the command menu item to visit.
-
visit
@JsMethod(name="visitPerspective") void visit(MenuItemPerspective menuItemPerspective)
Visits a menu item that has an associated perspective.- Parameters:
menuItemPerspective- the command menu item to visit.
-
visit
@JsMethod(name="visitCustom") void visit(MenuCustom<?> menuCustom)
Visits a custom menu item in the menu tree.- Parameters:
menuCustom- the custom (application provides the widget) menu item to visit.
-
-