summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/Label.java
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com/vaadin/ui/Label.java')
-rw-r--r--server/src/com/vaadin/ui/Label.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java
index a6ee11bdd5..0ead70933b 100644
--- a/server/src/com/vaadin/ui/Label.java
+++ b/server/src/com/vaadin/ui/Label.java
@@ -31,6 +31,7 @@ import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.shared.ui.label.LabelState;
import com.vaadin.shared.util.SharedUtil;
import com.vaadin.ui.declarative.DesignContext;
+import com.vaadin.ui.declarative.DesignFormatter;
/**
* Label component for showing non-editable short texts.
@@ -585,14 +586,18 @@ public class Label extends AbstractComponent implements Property<String>,
public void readDesign(Element design, DesignContext designContext) {
super.readDesign(design, designContext);
String innerHtml = design.html();
- if (innerHtml != null && !"".equals(innerHtml)) {
- setValue(innerHtml);
- }
- if (design.hasAttr(DESIGN_ATTR_PLAIN_TEXT)) {
+ boolean plainText = design.hasAttr(DESIGN_ATTR_PLAIN_TEXT);
+ if (plainText) {
setContentMode(ContentMode.TEXT);
} else {
setContentMode(ContentMode.HTML);
}
+ if (innerHtml != null && !"".equals(innerHtml)) {
+ if (plainText) {
+ innerHtml = DesignFormatter.unencodeFromTextNode(innerHtml);
+ }
+ setValue(innerHtml);
+ }
}
/*
@@ -625,6 +630,7 @@ public class Label extends AbstractComponent implements Property<String>,
// plain-text (default is html)
if (getContentMode() == ContentMode.TEXT) {
design.attr(DESIGN_ATTR_PLAIN_TEXT, "");
+ design.html(DesignFormatter.encodeForTextNode(getValue()));
}
}
}