]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed missing stylenames on menu item #10077 70/170/2
authorJohn Ahlroos <john@vaadin.com>
Fri, 26 Oct 2012 07:36:28 +0000 (10:36 +0300)
committerVaadin Code Review <review@vaadin.com>
Mon, 29 Oct 2012 13:44:58 +0000 (13:44 +0000)
Change-Id: Iadbfee6d86efef06d549d587e2ac6e2e6b519fb1

client/src/com/vaadin/client/ui/menubar/VMenuBar.java
uitest/src/com/vaadin/tests/components/menubar/MenuBarPrimaryStylenames.html
uitest/src/com/vaadin/tests/components/menubar/MenuBarPrimaryStylenames.java

index 38d6d513bf326e02381c3987a9eea2d1eade4796..83b1c58d0ae55b3e3db568ac46b0c684635204d0 100644 (file)
@@ -783,6 +783,8 @@ public class VMenuBar extends SimpleFocusablePanel implements
         protected boolean selected = false;
         protected String description = null;
 
+        private String styleName;
+
         /**
          * Default menu item {@link Widget} constructor for GWT.create().
          * 
@@ -889,6 +891,10 @@ public class VMenuBar extends SimpleFocusablePanel implements
                 super.setStyleName(primaryStyleName + "-menuitem");
             }
 
+            if (styleName != null) {
+                addStyleDependentName(styleName);
+            }
+
             if (enabled) {
                 removeStyleDependentName("disabled");
             } else {
@@ -1003,15 +1009,16 @@ public class VMenuBar extends SimpleFocusablePanel implements
             }
 
             if (uidl.hasAttribute(MenuBarConstants.ATTRIBUTE_ITEM_STYLE)) {
-                String itemStyle = uidl
+                styleName = uidl
                         .getStringAttribute(MenuBarConstants.ATTRIBUTE_ITEM_STYLE);
-                addStyleDependentName(itemStyle);
             }
 
             if (uidl.hasAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION)) {
                 description = uidl
                         .getStringAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION);
             }
+
+            updateStyleNames();
         }
 
         public TooltipInfo getTooltip() {
index 12324189789914b48744a1b4cce752b94e0be592..3a8e8d81afe1809f6f0e9e0ce4fd896b5d2136bf 100644 (file)
     <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]/domChild[0]</td>
     <td>my-menu-bar-menuitem</td>
 </tr>
+<tr>
+    <td>assertCSSClass</td>
+    <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]/domChild[0]</td>
+    <td>my-menu-bar-menuitem-normal</td>
+</tr>
+<tr>
+    <td>assertCSSClass</td>
+    <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]/domChild[0]</td>
+    <td>icon-white</td>
+</tr>
+<tr>
+    <td>assertCSSClass</td>
+    <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]/domChild[0]</td>
+    <td>icon-headphones</td>
+</tr>
 <tr>
     <td>assertCSSClass</td>
     <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]/domChild[1]</td>
     <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]/domChild[0]</td>
     <td>my-other-menu-menuitem</td>
 </tr>
+<tr>
+    <td>assertCSSClass</td>
+    <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]/domChild[0]</td>
+    <td>my-other-menu-menuitem-normal</td>
+</tr>
+<tr>
+    <td>assertCSSClass</td>
+    <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]/domChild[0]</td>
+    <td>icon-white</td>
+</tr>
+<tr>
+    <td>assertCSSClass</td>
+    <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]/domChild[0]</td>
+    <td>icon-headphones</td>
+</tr>
 <tr>
     <td>assertCSSClass</td>
     <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]/domChild[1]</td>
     <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarPrimaryStylenames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VMenuBar[0]#item0</td>
     <td>[tab]</td>
 </tr>
-
 </tbody></table>
 </body>
 </html>
index 79bec2e65ea8f1679e87f696bd0f36bc0e25ec7a..ad8e2b05ed02076030c5013eff34b0694136c51e 100644 (file)
@@ -14,6 +14,8 @@ public class MenuBarPrimaryStylenames extends TestBase {
         mainMenu.setPrimaryStyleName("my-menu-bar");
 
         MenuItem submenu1 = mainMenu.addItem("Submenu1", null);
+        submenu1.setStyleName("normal icon-white icon-headphones");
+
         MenuItem item1 = submenu1.addItem("Item1", null);
         item1.setCheckable(true);
         item1.setStyleName("my-menu-item");