From 3f7c75415bc73ab750f809bde0c5da02f5d8e7c2 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Sat, 13 Dec 2014 12:12:12 +0200 Subject: Support plain-text attribute for Label (#7749) Change-Id: I4ef210d131f1e616b501468cb94ea518945a3b30 --- server/src/com/vaadin/ui/Label.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'server/src/com/vaadin/ui/Label.java') 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, 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, protected Collection getCustomAttributes() { Collection result = super.getCustomAttributes(); result.add("value"); + result.add("content-mode"); return result; } @@ -618,5 +624,9 @@ public class Label extends AbstractComponent implements Property, if (content != null) { design.html(getValue()); } + // plain-text (default is html) + if (getContentMode() == ContentMode.TEXT) { + design.attr(DESIGN_ATTR_PLAIN_TEXT, ""); + } } } -- cgit v1.2.3