aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com')
-rw-r--r--server/src/com/vaadin/ui/AbstractComponent.java2
-rw-r--r--server/src/com/vaadin/ui/Button.java6
-rw-r--r--server/src/com/vaadin/ui/Label.java10
3 files changed, 15 insertions, 3 deletions
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index 1cda253b01..808b70386f 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -111,6 +111,8 @@ public abstract class AbstractComponent extends AbstractClientConnector
private Boolean explicitImmediateValue;
+ protected static final String DESIGN_ATTR_PLAIN_TEXT = "plain-text";
+
/* Constructor */
/**
diff --git a/server/src/com/vaadin/ui/Button.java b/server/src/com/vaadin/ui/Button.java
index 82666613bb..9a754c24d9 100644
--- a/server/src/com/vaadin/ui/Button.java
+++ b/server/src/com/vaadin/ui/Button.java
@@ -686,7 +686,7 @@ public class Button extends AbstractComponent implements
def.getTabIndex(), Integer.class));
// plain-text (default is html)
setHtmlContentAllowed(!DesignAttributeHandler.readAttribute(
- "plain-text", attr, false, Boolean.class));
+ DESIGN_ATTR_PLAIN_TEXT, attr, false, Boolean.class));
setIconAlternateText(DesignAttributeHandler.readAttribute("icon-alt",
attr, def.getIconAlternateText(), String.class));
// click-shortcut
@@ -707,7 +707,7 @@ public class Button extends AbstractComponent implements
protected Collection<String> getCustomAttributes() {
Collection<String> result = super.getCustomAttributes();
result.add("tabindex");
- result.add("plain-text");
+ result.add(DESIGN_ATTR_PLAIN_TEXT);
result.add("caption");
result.add("icon-alt");
result.add("click-shortcut");
@@ -736,7 +736,7 @@ public class Button extends AbstractComponent implements
def.getTabIndex(), Integer.class);
// plain-text (default is html)
if (!isHtmlContentAllowed()) {
- design.attr("plain-text", "");
+ design.attr(DESIGN_ATTR_PLAIN_TEXT, "");
}
// icon-alt
DesignAttributeHandler.writeAttribute("icon-alt", attr,
diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java
index a4d9da752d..f882940fe6 100644
--- a/server/src/com/vaadin/ui/Label.java
+++ b/server/src/com/vaadin/ui/Label.java
@@ -590,6 +590,11 @@ public class Label extends AbstractComponent implements Property<String>,
if (innerHtml != null && !"".equals(innerHtml)) {
setValue(innerHtml);
}
+ if (design.hasAttr(DESIGN_ATTR_PLAIN_TEXT)) {
+ setContentMode(ContentMode.TEXT);
+ } else {
+ setContentMode(ContentMode.HTML);
+ }
}
/*
@@ -601,6 +606,7 @@ public class Label extends AbstractComponent implements Property<String>,
protected Collection<String> getCustomAttributes() {
Collection<String> result = super.getCustomAttributes();
result.add("value");
+ result.add("content-mode");
return result;
}
@@ -618,5 +624,9 @@ public class Label extends AbstractComponent implements Property<String>,
if (content != null) {
design.html(getValue());
}
+ // plain-text (default is html)
+ if (getContentMode() == ContentMode.TEXT) {
+ design.attr(DESIGN_ATTR_PLAIN_TEXT, "");
+ }
}
}