]> source.dussan.org Git - vaadin-framework.git/commitdiff
#5402 Simplified attribute passing for html-mode in OptionGroup
authorLeif Åstrand <leif@vaadin.com>
Tue, 9 Aug 2011 11:19:03 +0000 (11:19 +0000)
committerLeif Åstrand <leif@vaadin.com>
Tue, 9 Aug 2011 11:19:03 +0000 (11:19 +0000)
svn changeset:20220/svn branch:6.7

src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java
src/com/vaadin/ui/OptionGroup.java

index eb3da571834e39c6c83f51ff1110edf4842134e4..828a10399ef52607d5e104d4af3cb9609ff8812c 100644 (file)
@@ -31,7 +31,7 @@ import com.vaadin.terminal.gwt.client.UIDL;
 public class VOptionGroup extends VOptionGroupBase implements FocusHandler,\r
         BlurHandler {\r
 \r
-    public static final String HTML_CONTENT_ALLOWED = "htmlcontentallowed";\r
+    public static final String HTML_CONTENT_ALLOWED = "usehtml";\r
 \r
     public static final String CLASSNAME = "v-select-optiongroup";\r
 \r
@@ -53,7 +53,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
      */\r
     private boolean blurOccured = false;\r
 \r
-    private boolean htmlItems = false;\r
+    private boolean htmlContentAllowed = false;\r
 \r
     public VOptionGroup() {\r
         super(CLASSNAME);\r
@@ -63,12 +63,8 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
 \r
     @Override\r
     public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {\r
-        if (uidl.hasAttribute(HTML_CONTENT_ALLOWED)\r
-                && uidl.getBooleanAttribute(HTML_CONTENT_ALLOWED)) {\r
-            htmlItems = true;\r
-        } else {\r
-            htmlItems = false;\r
-        }\r
+        htmlContentAllowed = uidl.hasAttribute(HTML_CONTENT_ALLOWED);\r
+\r
         super.updateFromUIDL(uidl, client);\r
 \r
         sendFocusEvents = client.hasEventListeners(this, EventId.FOCUS);\r
@@ -114,13 +110,13 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
             String caption = opUidl.getStringAttribute("caption");\r
             if (isMultiselect()) {\r
                 op = new VCheckBox();\r
-                if (htmlItems) {\r
+                if (htmlContentAllowed) {\r
                     op.setHTML(caption);\r
                 } else {\r
                     op.setText(caption);\r
                 }\r
             } else {\r
-                op = new RadioButton(id, caption, htmlItems);\r
+                op = new RadioButton(id, caption, htmlContentAllowed);\r
                 op.setStyleName("v-radiobutton");\r
             }\r
             op.addStyleName(CLASSNAME_OPTION);\r
index ba300131bb3d747c60131153cd92b978a46f4735..a8cebc1c5d7ad9a369cbcc37d7799989b0d6a7e9 100644 (file)
@@ -49,8 +49,9 @@ public class OptionGroup extends AbstractSelect implements
     @Override
     public void paintContent(PaintTarget target) throws PaintException {
         target.addAttribute("type", "optiongroup");
-        target.addAttribute(VOptionGroup.HTML_CONTENT_ALLOWED,
-                htmlContentAllowed);
+        if (isHtmlContentAllowed()) {
+            target.addAttribute(VOptionGroup.HTML_CONTENT_ALLOWED, true);
+        }
         super.paintContent(target);
     }