diff options
author | Mika Murtojarvi <mika@vaadin.com> | 2014-12-04 17:25:05 +0200 |
---|---|---|
committer | Mika Murtojarvi <mika@vaadin.com> | 2014-12-05 16:22:10 +0200 |
commit | 117bf2b791b70d4e85916acf5e43a5c3b2ba66ca (patch) | |
tree | d9883cc7697906b81fc88d612383461836294dd0 /server/src/com/vaadin/ui/Button.java | |
parent | be35a9b3f1250d9139baf5eeb3f48cb4a20c2822 (diff) | |
download | vaadin-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/Button.java')
-rw-r--r-- | server/src/com/vaadin/ui/Button.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Button.java b/server/src/com/vaadin/ui/Button.java index e58ad7bee5..809fbd5e55 100644 --- a/server/src/com/vaadin/ui/Button.java +++ b/server/src/com/vaadin/ui/Button.java @@ -18,6 +18,9 @@ package com.vaadin.ui; import java.io.Serializable; import java.lang.reflect.Method; +import java.util.Collection; + +import org.jsoup.nodes.Element; import com.vaadin.event.Action; import com.vaadin.event.FieldEvents; @@ -35,6 +38,7 @@ import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.button.ButtonServerRpc; import com.vaadin.shared.ui.button.ButtonState; import com.vaadin.ui.Component.Focusable; +import com.vaadin.ui.declarative.DesignContext; import com.vaadin.util.ReflectTools; /** @@ -660,4 +664,46 @@ public class Button extends AbstractComponent implements return getState(false).htmlContentAllowed; } + /* + * (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 content = design.html(); + setCaption(content); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.AbstractComponent#getCustomAttributes() + */ + @Override + protected Collection<String> getCustomAttributes() { + Collection<String> result = super.getCustomAttributes(); + result.add("caption"); + 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 = getCaption(); + if (content != null) { + design.html(content); + } + } } |