From 3a5cd8e4cd36a9db986978c01fe39356b3cbe3b6 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Mon, 30 Mar 2015 16:02:05 +0300 Subject: Make FormLayout work with HTML captions (#17143) Change-Id: I334441fd2f8d5f6d9e0629f5d7b564e9008f3fe5 --- client/src/com/vaadin/client/ui/VFormLayout.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'client') diff --git a/client/src/com/vaadin/client/ui/VFormLayout.java b/client/src/com/vaadin/client/ui/VFormLayout.java index 3781305e52..42dbbde32a 100644 --- a/client/src/com/vaadin/client/ui/VFormLayout.java +++ b/client/src/com/vaadin/client/ui/VFormLayout.java @@ -223,7 +223,7 @@ public class VFormLayout extends SimplePanel { private Icon icon; - private Element captionText; + private Element captionContent; /** * @@ -274,13 +274,13 @@ public class VFormLayout extends SimplePanel { } if (state.caption != null) { - if (captionText == null) { - captionText = DOM.createSpan(); + if (captionContent == null) { + captionContent = DOM.createSpan(); - AriaHelper.bindCaption(owner.getWidget(), captionText); + AriaHelper.bindCaption(owner.getWidget(), captionContent); - DOM.insertChild(getElement(), captionText, icon == null ? 0 - : 1); + DOM.insertChild(getElement(), captionContent, + icon == null ? 0 : 1); } String c = state.caption; if (c == null) { @@ -288,12 +288,16 @@ public class VFormLayout extends SimplePanel { } else { isEmpty = false; } - DOM.setInnerText(captionText, c); + if (state.captionAsHtml) { + captionContent.setInnerHTML(c); + } else { + captionContent.setInnerText(c); + } } else { // TODO should span also be removed } - if (state.description != null && captionText != null) { + if (state.description != null && captionContent != null) { addStyleDependentName("hasdescription"); } else { removeStyleDependentName("hasdescription"); -- cgit v1.2.3