summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2011-08-09 11:19:03 +0000
committerLeif Åstrand <leif@vaadin.com>2011-08-09 11:19:03 +0000
commit2628f2cf0d392e703c97b89a4f12a8b0cc896b9a (patch)
tree3bbc6b64db971826cf885317b4ec034635a713ca
parent5f4b96d3781a067d0e2dab5c573674bce293e6dd (diff)
downloadvaadin-framework-2628f2cf0d392e703c97b89a4f12a8b0cc896b9a.tar.gz
vaadin-framework-2628f2cf0d392e703c97b89a4f12a8b0cc896b9a.zip
#5402 Simplified attribute passing for html-mode in OptionGroup
svn changeset:20220/svn branch:6.7
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VOptionGroup.java16
-rw-r--r--src/com/vaadin/ui/OptionGroup.java5
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);
}