summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2011-03-22 13:46:53 +0000
committerArtur Signell <artur.signell@itmill.com>2011-03-22 13:46:53 +0000
commit5f4afeb5c85770083df2ec48df357fee436a4318 (patch)
treebab626b1cfa618d4c0a7bd4de1ee9d3f70bcbb62 /src
parenteaf5726fc107f43116f31cdd4af4527bdbce2730 (diff)
downloadvaadin-framework-5f4afeb5c85770083df2ec48df357fee436a4318.tar.gz
vaadin-framework-5f4afeb5c85770083df2ec48df357fee436a4318.zip
#3529 Listen to icon onload events and resize Tree if needed
svn changeset:17874/svn branch:6.5
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTree.java31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTree.java b/src/com/vaadin/terminal/gwt/client/ui/VTree.java
index e423f0eb46..ddc5c174ca 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTree.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTree.java
@@ -102,6 +102,15 @@ public class VTree extends SimpleFocusablePanel implements Paintable,
private boolean selectionHasChanged = false;
+ public VLazyExecutor iconLoaded = new VLazyExecutor(50,
+ new ScheduledCommand() {
+
+ public void execute() {
+ Util.notifyParentOfSizeChange(VTree.this, true);
+ }
+
+ });
+
public VTree() {
super();
setStyleName(CLASSNAME);
@@ -513,6 +522,11 @@ public class VTree extends SimpleFocusablePanel implements Paintable,
private boolean focused = false;
+ /**
+ * Track onload events as IE6 sends two
+ */
+ private boolean onloadHandled = false;
+
public TreeNode() {
constructDom();
sinkEvents(Event.ONCLICK | Event.ONDBLCLICK | Event.MOUSEEVENTS
@@ -683,11 +697,23 @@ public class VTree extends SimpleFocusablePanel implements Paintable,
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
+ final int type = DOM.eventGetType(event);
+ final Element target = DOM.eventGetTarget(event);
+
+ if (type == Event.ONLOAD && target == icon.getElement()) {
+ if (onloadHandled) {
+ return;
+ }
+ if (BrowserInfo.get().isIE6()) {
+ fixWidth();
+ }
+ iconLoaded.trigger();
+ onloadHandled = true;
+ }
+
if (disabled) {
return;
}
- final int type = DOM.eventGetType(event);
- final Element target = DOM.eventGetTarget(event);
final boolean inCaption = target == nodeCaptionSpan
|| (icon != null && target == icon.getElement());
if (inCaption
@@ -872,6 +898,7 @@ public class VTree extends SimpleFocusablePanel implements Paintable,
if (uidl.hasAttribute("icon")) {
if (icon == null) {
+ onloadHandled = false;
icon = new Icon(client);
DOM.insertBefore(DOM.getFirstChild(nodeCaptionDiv),
icon.getElement(), nodeCaptionSpan);