aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/Label.java
diff options
context:
space:
mode:
authorMika Murtojarvi <mika@vaadin.com>2014-12-04 17:25:05 +0200
committerMika Murtojarvi <mika@vaadin.com>2014-12-05 16:22:10 +0200
commit117bf2b791b70d4e85916acf5e43a5c3b2ba66ca (patch)
treed9883cc7697906b81fc88d612383461836294dd0 /server/src/com/vaadin/ui/Label.java
parentbe35a9b3f1250d9139baf5eeb3f48cb4a20c2822 (diff)
downloadvaadin-framework-117bf2b791b70d4e85916acf5e43a5c3b2ba66ca.tar.gz
vaadin-framework-117bf2b791b70d4e85916acf5e43a5c3b2ba66ca.zip
Declarative: handle inner html for Button and Label (#7749).
Change-Id: Ie98d633e8583efed142a6a3d2cc980070cbc73f7
Diffstat (limited to 'server/src/com/vaadin/ui/Label.java')
-rw-r--r--server/src/com/vaadin/ui/Label.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java
index c73840e6e9..6001e30446 100644
--- a/server/src/com/vaadin/ui/Label.java
+++ b/server/src/com/vaadin/ui/Label.java
@@ -17,8 +17,11 @@
package com.vaadin.ui;
import java.lang.reflect.Method;
+import java.util.Collection;
import java.util.Locale;
+import org.jsoup.nodes.Element;
+
import com.vaadin.data.Property;
import com.vaadin.data.util.AbstractProperty;
import com.vaadin.data.util.LegacyPropertyHelper;
@@ -27,6 +30,7 @@ import com.vaadin.data.util.converter.ConverterUtil;
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;
/**
* Label component for showing non-editable short texts.
@@ -570,4 +574,49 @@ public class Label extends AbstractComponent implements Property<String>,
return LegacyPropertyHelper.legacyPropertyToString(this);
}
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.ui.DesignSynchronizable#synchronizeFromDesign(org.jsoup.nodes
+ * .Element, com.vaadin.ui.declarative.DesignContext)
+ */
+ @Override
+ public void synchronizeFromDesign(Element design,
+ DesignContext designContext) {
+ super.synchronizeFromDesign(design, designContext);
+ String innerHtml = design.html();
+ if (innerHtml != null && !"".equals(innerHtml)) {
+ setValue(innerHtml);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractComponent#getCustomAttributes()
+ */
+ @Override
+ protected Collection<String> getCustomAttributes() {
+ Collection<String> result = super.getCustomAttributes();
+ result.add("value");
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.ui.DesignSynchronizable#synchronizeToDesign(org.jsoup.nodes
+ * .Element, com.vaadin.ui.declarative.DesignContext)
+ */
+ @Override
+ public void synchronizeToDesign(Element design, DesignContext designContext) {
+ super.synchronizeToDesign(design, designContext);
+ String content = getValue();
+ if (content != null) {
+ design.html(getValue());
+ }
+ }
}