From 0663acc47174bf86c02cdb7291e1c0d7b98551ed Mon Sep 17 00:00:00 2001 From: Jonas Zipprick Date: Fri, 29 Dec 2017 11:36:05 +0100 Subject: 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. --- .../java/com/vaadin/tests/elements/menubar/MenuBarUI.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'uitest/src/main/java/com/vaadin/tests') diff --git a/uitest/src/main/java/com/vaadin/tests/elements/menubar/MenuBarUI.java b/uitest/src/main/java/com/vaadin/tests/elements/menubar/MenuBarUI.java index a78eae271c..d56ead71e9 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/menubar/MenuBarUI.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/menubar/MenuBarUI.java @@ -16,6 +16,7 @@ package com.vaadin.tests.elements.menubar; import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.ContentMode; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.MenuBar; import com.vaadin.ui.MenuBar.Command; @@ -38,8 +39,11 @@ public class MenuBarUI extends AbstractTestUI { String secondaryLevelItemSuffix) { MenuBar menuBar = new MenuBar(); MenuItem file = menuBar.addItem("File" + topLevelItemSuffix, null); - file.addItem("Open" + secondaryLevelItemSuffix, new MenuBarCommand()); - file.addItem("Save" + secondaryLevelItemSuffix, new MenuBarCommand()); + file.addItem("Open" + secondaryLevelItemSuffix, new MenuBarCommand()) + .setDescription("Preformatted\ndescription"); + file.addItem("Save" + secondaryLevelItemSuffix, new MenuBarCommand()) + .setDescription("plain description,\n HTML is visible", + ContentMode.TEXT); file.addItem("Save As.." + secondaryLevelItemSuffix, new MenuBarCommand()); file.addSeparator(); @@ -52,7 +56,9 @@ public class MenuBarUI extends AbstractTestUI { new MenuBarCommand()); file.addSeparator(); - file.addItem("Exit" + secondaryLevelItemSuffix, new MenuBarCommand()); + file.addItem("Exit" + secondaryLevelItemSuffix, new MenuBarCommand()) + .setDescription("HTML
description", + ContentMode.HTML); MenuItem edit = menuBar.addItem("Edit" + topLevelItemSuffix, null); edit.addItem("Copy" + secondaryLevelItemSuffix, new MenuBarCommand()); -- cgit v1.2.3