~~NOTRANS~~
~~Title: Flatten Menu~~
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.,
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);
}
}
}
To use the custom menu, simply change the corporation menu class name in your deployment descriptor, e.g.,
Application.Menu.corporation.classname
com.sibvisions.apps.vaadin.FlatMenuBarCorporation
In newer versions, it's possible to set:
Application.Menu.corporation.groups.flat
Admin
instead of your custom menu implementation.