]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #1085
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 30 Jan 2008 07:01:16 +0000 (07:01 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 30 Jan 2008 07:01:16 +0000 (07:01 +0000)
svn changeset:3668/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/ITree.java

index 4568339c72273c5b4096e5d4430b1871598a7460..64693b5b938caee54bb500826d783816589f7471 100644 (file)
@@ -179,6 +179,8 @@ public class ITree extends FlowPanel implements Paintable {
 
         private boolean open;
 
+        private Icon icon;
+
         public TreeNode() {
             constructDom();
             sinkEvents(Event.ONCLICK);
@@ -264,6 +266,20 @@ public class ITree extends FlowPanel implements Paintable {
             if (uidl.getBooleanAttribute("selected")) {
                 setSelected(true);
             }
+
+            if (uidl.hasAttribute("icon")) {
+                if (icon == null) {
+                    icon = new Icon(client);
+                    DOM.insertBefore(nodeCaptionDiv, icon.getElement(),
+                            nodeCaptionSpan);
+                }
+                icon.setUri(uidl.getStringAttribute("icon"));
+            } else {
+                if (icon != null) {
+                    DOM.removeChild(nodeCaptionDiv, icon.getElement());
+                    icon = null;
+                }
+            }
         }
 
         private void setState(boolean state, boolean notifyServer) {