diff options
author | Leif Åstrand <leif@vaadin.com> | 2015-09-18 16:54:46 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-10-02 12:53:02 +0000 |
commit | 1d538feb45ab223ac763bc3b414523697904a80f (patch) | |
tree | d5d3eed6d6449295d764d70913b0e752c5a91dd8 /client | |
parent | 904ae72ed3ca7f9477d59bd7fd284bb254895f8b (diff) | |
download | vaadin-framework-1d538feb45ab223ac763bc3b414523697904a80f.tar.gz vaadin-framework-1d538feb45ab223ac763bc3b414523697904a80f.zip |
Add Tree.htmlContentsAllowed (#7717)
Change-Id: I5c773da806b8358ee203c9c12fd2e2b6fec1970f
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VTree.java | 8 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/tree/TreeConnector.java | 11 |
2 files changed, 17 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ui/VTree.java b/client/src/com/vaadin/client/ui/VTree.java index 846b16d0cb..3e51374dc7 100644 --- a/client/src/com/vaadin/client/ui/VTree.java +++ b/client/src/com/vaadin/client/ui/VTree.java @@ -146,6 +146,9 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, public boolean isNullSelectionAllowed = true; /** For internal use only. May be removed or replaced in the future. */ + public boolean isHtmlContentAllowed = false; + + /** For internal use only. May be removed or replaced in the future. */ public boolean disabled = false; /** For internal use only. May be removed or replaced in the future. */ @@ -983,6 +986,11 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, DOM.setInnerText(nodeCaptionSpan, text); } + /** For internal use only. May be removed or replaced in the future. */ + public void setHtml(String html) { + nodeCaptionSpan.setInnerHTML(html); + } + public boolean isChildrenLoaded() { return childrenLoaded; } diff --git a/client/src/com/vaadin/client/ui/tree/TreeConnector.java b/client/src/com/vaadin/client/ui/tree/TreeConnector.java index 23091d0ad5..b2babe9d52 100644 --- a/client/src/com/vaadin/client/ui/tree/TreeConnector.java +++ b/client/src/com/vaadin/client/ui/tree/TreeConnector.java @@ -82,6 +82,8 @@ public class TreeConnector extends AbstractComponentConnector implements getWidget().isNullSelectionAllowed = uidl .getBooleanAttribute("nullselect"); + getWidget().isHtmlContentAllowed = uidl + .getBooleanAttribute(TreeConstants.ATTRIBUTE_HTML_ALLOWED); if (uidl.hasAttribute("alb")) { getWidget().bodyActionKeys = uidl.getStringArrayAttribute("alb"); @@ -245,8 +247,13 @@ public class TreeConnector extends AbstractComponentConnector implements level); String nodeKey = uidl.getStringAttribute("key"); - treeNode.setText(uidl - .getStringAttribute(TreeConstants.ATTRIBUTE_NODE_CAPTION)); + String caption = uidl + .getStringAttribute(TreeConstants.ATTRIBUTE_NODE_CAPTION); + if (getWidget().isHtmlContentAllowed) { + treeNode.setHtml(caption); + } else { + treeNode.setText(caption); + } treeNode.key = nodeKey; getWidget().registerNode(treeNode); |