diff --git a/modules/gui/src/com/haulmont/cuba/gui/config/MenuConfig.java b/modules/gui/src/com/haulmont/cuba/gui/config/MenuConfig.java index 07a2d85c94..6aa04c8c43 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/config/MenuConfig.java +++ b/modules/gui/src/com/haulmont/cuba/gui/config/MenuConfig.java @@ -172,6 +172,7 @@ public class MenuConfig { loadShortcut(menuItem, element); loadStylename(element, menuItem); + loadDescription(element, menuItem); loadMenuItems(element, menuItem); // if (menuItem.getChildren().isEmpty()) { @@ -185,6 +186,7 @@ public class MenuConfig { menuItem.setDescriptor(element); loadShortcut(menuItem, element); loadStylename(element, menuItem); + loadDescription(element, menuItem); } } else if ("separator".equals(element.getName())) { String id = element.attributeValue("id"); @@ -207,6 +209,13 @@ public class MenuConfig { } } + protected void loadDescription(Element element, MenuItem menuItem) { + String description = element.attributeValue("description"); + if (StringUtils.isNotBlank(description)) { + menuItem.setDescription(description); + } + } + protected void loadStylename(Element element, MenuItem menuItem) { String stylename = element.attributeValue("stylename"); if (StringUtils.isNotBlank(stylename)) { diff --git a/modules/gui/src/com/haulmont/cuba/gui/config/MenuItem.java b/modules/gui/src/com/haulmont/cuba/gui/config/MenuItem.java index e04c9b079c..f8a425f508 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/config/MenuItem.java +++ b/modules/gui/src/com/haulmont/cuba/gui/config/MenuItem.java @@ -37,6 +37,7 @@ public class MenuItem { private String id; private String stylename; + private String description; private Element descriptor; private boolean separator = false; @@ -77,6 +78,14 @@ public class MenuItem { return descriptor; } + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public String getStylename() { return stylename; } diff --git a/modules/gui/src/com/haulmont/cuba/gui/menu.xsd b/modules/gui/src/com/haulmont/cuba/gui/menu.xsd index 68e5e85a3a..5d1e184356 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/menu.xsd +++ b/modules/gui/src/com/haulmont/cuba/gui/menu.xsd @@ -44,6 +44,7 @@ + @@ -56,6 +57,7 @@ + diff --git a/modules/web/src/com/haulmont/cuba/web/sys/MenuBuilder.java b/modules/web/src/com/haulmont/cuba/web/sys/MenuBuilder.java index 4eff9534ad..3930df5e27 100644 --- a/modules/web/src/com/haulmont/cuba/web/sys/MenuBuilder.java +++ b/modules/web/src/com/haulmont/cuba/web/sys/MenuBuilder.java @@ -108,6 +108,7 @@ public class MenuBuilder { createSubMenu(menuItem, item, session); assignTestId(menuItem, item); assignStyleName(menuItem, item); + assignDescription(menuItem, item); if (isMenuItemEmpty(menuItem)) { menuBar.removeItem(menuItem); } @@ -122,6 +123,8 @@ public class MenuBuilder { MenuBar.MenuItem menuItem = (child.isSeparator()) ? vItem.addSeparator() : vItem.addItem(MenuConfig.getMenuItemCaption(child.getId()), createMenuBarCommand(child)); assignShortcut(menuItem, child); assignTestId(menuItem, child); + assignDescription(menuItem, child); + assignStyleName(menuItem, child); } } else { if (child.isPermitted(session)) { @@ -129,6 +132,8 @@ public class MenuBuilder { assignShortcut(menuItem, child); createSubMenu(menuItem, child, session); assignTestId(menuItem, child); + assignDescription(menuItem, child); + assignStyleName(menuItem, child); if (isMenuItemEmpty(menuItem)) { vItem.removeChild(menuItem); } @@ -204,4 +209,10 @@ public class MenuBuilder { menuItem.setStyleName("ms " + conf.getStylename()); } } + + protected void assignDescription(MenuBar.MenuItem menuItem, MenuItem conf) { + if (conf.getDescription() != null) { + menuItem.setDescription(conf.getDescription()); + } + } } \ No newline at end of file