From 2628f2cf0d392e703c97b89a4f12a8b0cc896b9a Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Tue, 9 Aug 2011 11:19:03 +0000 Subject: #5402 Simplified attribute passing for html-mode in OptionGroup svn changeset:20220/svn branch:6.7 --- src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java | 16 ++++++---------- src/com/vaadin/ui/OptionGroup.java | 5 +++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java b/src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java index eb3da57183..828a10399e 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java @@ -31,7 +31,7 @@ import com.vaadin.terminal.gwt.client.UIDL; public class VOptionGroup extends VOptionGroupBase implements FocusHandler, BlurHandler { - public static final String HTML_CONTENT_ALLOWED = "htmlcontentallowed"; + public static final String HTML_CONTENT_ALLOWED = "usehtml"; public static final String CLASSNAME = "v-select-optiongroup"; @@ -53,7 +53,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, */ private boolean blurOccured = false; - private boolean htmlItems = false; + private boolean htmlContentAllowed = false; public VOptionGroup() { super(CLASSNAME); @@ -63,12 +63,8 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - if (uidl.hasAttribute(HTML_CONTENT_ALLOWED) - && uidl.getBooleanAttribute(HTML_CONTENT_ALLOWED)) { - htmlItems = true; - } else { - htmlItems = false; - } + htmlContentAllowed = uidl.hasAttribute(HTML_CONTENT_ALLOWED); + super.updateFromUIDL(uidl, client); sendFocusEvents = client.hasEventListeners(this, EventId.FOCUS); @@ -114,13 +110,13 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, String caption = opUidl.getStringAttribute("caption"); if (isMultiselect()) { op = new VCheckBox(); - if (htmlItems) { + if (htmlContentAllowed) { op.setHTML(caption); } else { op.setText(caption); } } else { - op = new RadioButton(id, caption, htmlItems); + op = new RadioButton(id, caption, htmlContentAllowed); op.setStyleName("v-radiobutton"); } op.addStyleName(CLASSNAME_OPTION); diff --git a/src/com/vaadin/ui/OptionGroup.java b/src/com/vaadin/ui/OptionGroup.java index ba300131bb..a8cebc1c5d 100644 --- a/src/com/vaadin/ui/OptionGroup.java +++ b/src/com/vaadin/ui/OptionGroup.java @@ -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); } -- cgit v1.2.3