diff options
author | Jonatan Kronqvist <jonatan.kronqvist@itmill.com> | 2011-04-06 10:46:32 +0000 |
---|---|---|
committer | Jonatan Kronqvist <jonatan.kronqvist@itmill.com> | 2011-04-06 10:46:32 +0000 |
commit | c2b5723c72cf692811e3e95257194f3b7950da87 (patch) | |
tree | 69cfd9d49a3fee151c1f1e52ccc6a6d9c23135e4 /src | |
parent | 3bd6f9497e0fe5755850e1e2e132a45f817905c2 (diff) | |
download | vaadin-framework-c2b5723c72cf692811e3e95257194f3b7950da87.tar.gz vaadin-framework-c2b5723c72cf692811e3e95257194f3b7950da87.zip |
Fixed #6731 - tree no longer scrolls when an item is selected.
svn changeset:18127/svn branch:6.5
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VTree.java | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTree.java b/src/com/vaadin/terminal/gwt/client/ui/VTree.java index ddc5c174ca..a007f27136 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTree.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTree.java @@ -628,15 +628,14 @@ public class VTree extends SimpleFocusablePanel implements Paintable, * Also ensure that the Tree itself is also gains focus (TreeNodes * focus is kind of faked). */ - if (BrowserInfo.get().isOpera()) { - /* - * focusing the tree in Opera would scroll long trees up on - * clicks - */ - getElement().focus(); - } else if (!BrowserInfo.get().isIE()) { - focus(); - } // else if IE: NOP, IE will give the focus to Tree anyways + // if (BrowserInfo.get().isOpera()) { + /* + * focusing the tree in Opera would scroll long trees up on clicks + */ + // getElement().focus(); + // } else if (!BrowserInfo.get().isIE()) { + // focus(); + // } // else if IE: NOP, IE will give the focus to Tree anyways ScheduledCommand command = new ScheduledCommand() { public void execute() { @@ -787,7 +786,12 @@ public class VTree extends SimpleFocusablePanel implements Paintable, * previously modified field may contain dirty variables. */ if (!treeHasFocus) { - focus(); + if (focusedNode == null) { + getNodeByKey(key).setFocused(true); + } else { + focusedNode.setFocused(true); + } + // focus(); } final MouseEventDetails details = new MouseEventDetails(evt); ScheduledCommand command = new ScheduledCommand() { @@ -832,15 +836,15 @@ public class VTree extends SimpleFocusablePanel implements Paintable, DOM.appendChild(getElement(), ie6compatnode); DOM.sinkEvents(ie6compatnode, Event.ONCLICK); - } else if (BrowserInfo.get().isOpera()) { - /* - * We need to focus the TreeNode itself to get keyboard - * navigation to work in opera at some level. Actually focusing - * individual TreeNodes would most likely be better option for - * all browsers, I don't dare to to this at bugfix release. MT. - */ - getElement().setTabIndex(-1); - } + } // else if (BrowserInfo.get().isOpera()) { + /* + * We need to focus the TreeNode itself to get keyboard navigation + * to work in opera at some level. Actually focusing individual + * TreeNodes would most likely be better option for all browsers, I + * don't dare to to this at bugfix release. MT. + */ + getElement().setTabIndex(-1); + // } nodeCaptionDiv = DOM.createDiv(); DOM.setElementProperty(nodeCaptionDiv, "className", CLASSNAME @@ -1142,12 +1146,15 @@ public class VTree extends SimpleFocusablePanel implements Paintable, ie6compatnode.addClassName(CLASSNAME_FOCUSED); } this.focused = focused; + getElement().focus(); + treeHasFocus = true; } else if (this.focused && !focused) { nodeCaptionDiv.removeClassName(CLASSNAME_FOCUSED); if (BrowserInfo.get().isIE6()) { ie6compatnode.removeClassName(CLASSNAME_FOCUSED); } this.focused = focused; + treeHasFocus = false; } } |