diff options
author | Jonas Zipprick <jonas.zipprick@gmail.com> | 2017-12-29 11:36:05 +0100 |
---|---|---|
committer | Aleksi Hietanen <aleksi@vaadin.com> | 2017-12-29 12:36:05 +0200 |
commit | 0663acc47174bf86c02cdb7291e1c0d7b98551ed (patch) | |
tree | 2c3076f2a1b2d376575555b7eb2a8aee7a5ce893 /client | |
parent | 1619d1f0bbd41de3f175b9eb2f34b468ec7e0367 (diff) | |
download | vaadin-framework-0663acc47174bf86c02cdb7291e1c0d7b98551ed.tar.gz vaadin-framework-0663acc47174bf86c02cdb7291e1c0d7b98551ed.zip |
Add ContentMode for the description of MenuItems (#9984)
Adds the ability to set the content mode for the description of a menu item that is part of a menu bar.
This functionality was already available for every AbstractComponent but missing for the menu items of menu bars.
If no content mode is specified it defaults to the PREFORMATED content mode.
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VMenuBar.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java index 29897f7dd6..144f6117d0 100644 --- a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java @@ -805,6 +805,7 @@ public class VMenuBar extends FocusableFlowPanel protected boolean checked = false; protected boolean selected = false; protected String description = null; + protected ContentMode contentMode = null; private String styleName; @@ -1114,15 +1115,24 @@ public class VMenuBar extends FocusableFlowPanel MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION); } + if (uidl.hasAttribute( + MenuBarConstants.ATTRIBUTE_ITEM_CONTENT_MODE)) { + String contentModeString = uidl.getStringAttribute( + MenuBarConstants.ATTRIBUTE_ITEM_CONTENT_MODE); + contentMode = ContentMode.valueOf(contentModeString); + } else { + contentMode = ContentMode.PREFORMATTED; + } + updateStyleNames(); } public TooltipInfo getTooltip() { - if (description == null) { + if (description == null || contentMode == null) { return null; } - return new TooltipInfo(description, ContentMode.PREFORMATTED, null, + return new TooltipInfo(description, contentMode, null, this); } |