Rich Platform project for Java web applications.
This project is maintained by aktion-hip
The following snippet shows how to create a set of menu items for the context menu:
public final class ContextMenuHelper { private static final IMessages MESSAGES = new Messages(); private static final IContextMenuItem INPUT_WIDGETS = new ContextMenuItem( InputWidgetsController.class, "widgets.menu.input", Constants.PERMISSION_INPUT_WIDGETS, MESSAGES); private static final IContextMenuItem BUTTON_WIDGETS = new ContextMenuItem( ButtonWidgetsController.class, "widgets.menu.button", Constants.PERMISSION_BUTTON_WIDGETS, MESSAGES); public static IMenuSet createContextMenuSet() { return new IMenuSet() { public String getSetID() { return Constants.CONTEXT_MENU_SET_WIDGETS; } public IContextMenuItem[] getContextMenuItems() { return new IContextMenuItem[] { INPUT_WIDGETS, BUTTON_WIDGETS }; } }; } }
The org.ripla.web.interfaces.IMenuSet is identified by a menu ID and contains a set of menu elments. In this example, the set will display two menu entries. Each org.ripla.web.interfaces.IContextMenuItem has to know which controller has to be activated when the user clicks the menu entry. In addition, the context menu has to be configured with a permission. Thus, the menu entry is displayed only if the user has the required permission.
A context menu consists of various menu items. A use case can have different context menus for different controllers/views. However, a specific context menu item can be part of multiple context menu sets. Each context menu set has to be identified by a unique ID (within the use case bundle) for that the controller can load the context menu set appropriate for the acutal view.