diff options
author | Jouni Koivuviita <jouni.koivuviita@itmill.com> | 2008-09-10 10:55:13 +0000 |
---|---|---|
committer | Jouni Koivuviita <jouni.koivuviita@itmill.com> | 2008-09-10 10:55:13 +0000 |
commit | 68559ee7f22500154409949dc957b6ba58987bc7 (patch) | |
tree | 9f0851c601f48285ab7b83a0f24d3d3268c3f5bc /src | |
parent | 367e9f7c5af55b4cce9c4c30bd1c88256ff12490 (diff) | |
download | vaadin-framework-68559ee7f22500154409949dc957b6ba58987bc7.tar.gz vaadin-framework-68559ee7f22500154409949dc957b6ba58987bc7.zip |
Fixes #2027: One extra DIV element added to each node caption to help style Tree.
svn changeset:5378/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/com/itmill/toolkit/terminal/gwt/client/ui/ITree.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ITree.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ITree.java index 08f3930799..87c1a6c292 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/ITree.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ITree.java @@ -196,6 +196,7 @@ public class ITree extends FlowPanel implements Paintable { sinkEvents(Event.ONCLICK | Event.ONDBLCLICK | Event.ONMOUSEUP); } + @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); if (disabled) { @@ -253,20 +254,24 @@ public class ITree extends FlowPanel implements Paintable { nodeCaptionDiv = DOM.createDiv(); DOM.setElementProperty(nodeCaptionDiv, "className", CLASSNAME + "-caption"); + Element wrapper = DOM.createDiv(); nodeCaptionSpan = DOM.createSpan(); DOM.appendChild(getElement(), nodeCaptionDiv); - DOM.appendChild(nodeCaptionDiv, nodeCaptionSpan); + DOM.appendChild(nodeCaptionDiv, wrapper); + DOM.appendChild(wrapper, nodeCaptionSpan); childNodeContainer = new FlowPanel(); childNodeContainer.setStylePrimaryName(CLASSNAME + "-children"); setWidget(childNodeContainer); } + @Override public void onDetach() { Util.removeContextMenuEvent(nodeCaptionSpan); super.onDetach(); } + @Override public void onAttach() { attachContextMenuEvent(nodeCaptionSpan); super.onAttach(); @@ -305,13 +310,14 @@ public class ITree extends FlowPanel implements Paintable { if (uidl.hasAttribute("icon")) { if (icon == null) { icon = new Icon(client); - DOM.insertBefore(nodeCaptionDiv, icon.getElement(), - nodeCaptionSpan); + DOM.insertBefore(DOM.getFirstChild(nodeCaptionDiv), icon + .getElement(), nodeCaptionSpan); } icon.setUri(uidl.getStringAttribute("icon")); } else { if (icon != null) { - DOM.removeChild(nodeCaptionDiv, icon.getElement()); + DOM.removeChild(DOM.getFirstChild(nodeCaptionDiv), icon + .getElement()); icon = null; } } |