From 77a5b6f83add600c3ad5c142ada2d2c92c89635f Mon Sep 17 00:00:00 2001 From: John Alhroos Date: Fri, 18 Jun 2010 12:55:26 +0000 Subject: [PATCH] Fix for #5068 svn changeset:13776/svn branch:6.4 --- .../vaadin/terminal/gwt/client/ui/VScrollTable.java | 10 +++++----- src/com/vaadin/terminal/gwt/client/ui/VTree.java | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index d07a3c75b4..4eb66621c0 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -4813,6 +4813,9 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, if (row != null) { + // Apply focus style to new selection + row.addStyleName(CLASSNAME_SELECTION_FOCUS); + // Trying to set focus on already focused row if (row == focusedRow) { return false; @@ -4821,9 +4824,6 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, // Set new focused row focusedRow = row; - // Apply focus style to new selection - focusedRow.addStyleName(CLASSNAME_SELECTION_FOCUS); - // Scroll up or down if needed int rowTop = focusedRow.getElement().getAbsoluteTop(); int scrollTop = scrollBodyPanel.getElement().getAbsoluteTop(); @@ -4840,8 +4840,6 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } return true; - } else { - focusedRow = null; } return false; @@ -5080,6 +5078,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, // Focus a row if no row is in focus if (focusedRow == null) { setRowFocus((VScrollTableRow) scrollBody.iterator().next()); + } else { + setRowFocus(focusedRow); } } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTree.java b/src/com/vaadin/terminal/gwt/client/ui/VTree.java index 9f5202cb68..108a68be14 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTree.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTree.java @@ -1429,6 +1429,8 @@ public class VTree extends SimpleFocusablePanel implements Paintable, // If no node has focus, focus the first item in the tree if (focusedNode == null && selectable) { setFocusedNode((TreeNode) body.getWidget(0)); + } else if (selectable) { + setFocusedNode(focusedNode); } } @@ -1440,7 +1442,7 @@ public class VTree extends SimpleFocusablePanel implements Paintable, * .dom.client.BlurEvent) */ public void onBlur(BlurEvent event) { - setFocusedNode(null); + focusedNode.setFocused(false); } /* -- 2.39.5