summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/Tree.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Tree.java b/server/src/com/vaadin/ui/Tree.java
index aac827e5b5..b41139275b 100644
--- a/server/src/com/vaadin/ui/Tree.java
+++ b/server/src/com/vaadin/ui/Tree.java
@@ -616,6 +616,10 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
target.addAttribute("dragMode", dragMode.ordinal());
}
+ if (isHtmlContentAllowed()) {
+ target.addAttribute(TreeConstants.ATTRIBUTE_HTML_ALLOWED, true);
+ }
+
}
// Initialize variables
@@ -1310,6 +1314,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
private DropHandler dropHandler;
+ private boolean htmlContentAllowed;
+
@Override
public void addItemClickListener(ItemClickListener listener) {
addListener(TreeConstants.ITEM_CLICK_EVENT_ID, ItemClickEvent.class,
@@ -1896,4 +1902,34 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
return element;
}
+
+ /**
+ * Sets whether html is allowed in the item captions. If set to
+ * <code>true</code>, the captions are passed to the browser as html and the
+ * developer is responsible for ensuring no harmful html is used. If set to
+ * <code>false</code>, the content is passed to the browser as plain text.
+ * The default setting is <code>false</code>
+ *
+ * @since
+ * @param htmlContentAllowed
+ * <code>true</code> if the captions are used as html,
+ * <code>false</code> if used as plain text
+ */
+ public void setHtmlContentAllowed(boolean htmlContentAllowed) {
+ this.htmlContentAllowed = htmlContentAllowed;
+ markAsDirty();
+ }
+
+ /**
+ * Checks whether captions are interpreted as html or plain text.
+ *
+ * @since
+ * @return <code>true</code> if the captions are displayed as html,
+ * <code>false</code> if displayed as plain text
+ * @see #setHtmlContentAllowed(boolean)
+ */
+ public boolean isHtmlContentAllowed() {
+ return htmlContentAllowed;
+ }
+
}