Trace: • Flatten Menu
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
vaadin:flatten_corporation_menu [2019/04/26 10:52] admin created |
vaadin:flatten_corporation_menu [2020/08/05 12:49] (current) cduncan |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ~~NOTRANS~~ | ~~NOTRANS~~ | ||
| - | ~~Title: Flatten menu~~ | + | ~~Title: Flatten Menu~~ |
| - | Usually, the corporation menu items will be shown in groups: | + | Usually, the corporation menu items will be shown in groups (e.g. MDM, Admin): |
| + | {{:vaadin:vaadin_corporation_menu_standard.jpg?nolink|}} | ||
| + | The menu bar contains menus with menu items, for each screen, e.g., the menu Admin contains **Statistic** and **Company** screen. | ||
| + | |||
| + | But, sometimes, you want flat menus, e.g., | ||
| + | |||
| + | {{:vaadin:vaadin_corporation_menu_flat.jpg?nolink|}} | ||
| + | |||
| + | This can be done with your own Menu implementation, e.g., | ||
| + | |||
| + | <file java> | ||
| + | public class FlatMenuBarCorporation extends WebMenuCorporation | ||
| + | { | ||
| + | public FlatMenuBarCorporation(IApplication pApplication) | ||
| + | { | ||
| + | super(pApplication); | ||
| + | } | ||
| + | | ||
| + | @Override | ||
| + | protected IMenuItem addMenuItem(String pId, | ||
| + | String pGroupId, | ||
| + | String pAction, | ||
| + | String pActionCommand, | ||
| + | String pGroup, | ||
| + | String pGroupImage, | ||
| + | String pShortcut, | ||
| + | String pText, | ||
| + | String pImage, | ||
| + | boolean pUseSeparator, | ||
| + | boolean pToggle) | ||
| + | { | ||
| + | if ("Admin".equals(pGroup)) | ||
| + | { | ||
| + | UIMenuBar bar = getMenuBar(); | ||
| + | | ||
| + | UIMenuItem miItem = createMenuItem(pAction, pActionCommand, pText, UIImage.getImage(pImage)); | ||
| + | | ||
| + | bar.add(miItem); | ||
| + | | ||
| + | return miItem; | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | return super.addMenuItem(pId, pGroupId, pAction, pActionCommand, pGroup, | ||
| + | pGroupImage, pShortcut, pText, pImage, pUseSeparator, pToggle); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </file> | ||
| + | |||
| + | To use the custom menu, simply change the corporation menu class name in your deployment descriptor, e.g., | ||
| + | |||
| + | <file xml> | ||
| + | <init-param> | ||
| + | <param-name>Application.Menu.corporation.classname</param-name> | ||
| + | <param-value>com.sibvisions.apps.vaadin.FlatMenuBarCorporation</param-value> | ||
| + | </init-param> | ||
| + | </file> | ||
| + | |||
| + | In newer versions, it's possible to set: | ||
| + | |||
| + | <file xml> | ||
| + | <init-param> | ||
| + | <param-name>Application.Menu.corporation.groups.flat</param-name> | ||
| + | <!-- comma separated list of group names --> | ||
| + | <param-value>Admin</param-value> | ||
| + | </init-param> | ||
| + | </file> | ||
| + | |||
| + | instead of your custom menu implementation. | ||
