diff options
author | John Alhroos <john.ahlroos@itmill.com> | 2010-06-02 08:00:48 +0000 |
---|---|---|
committer | John Alhroos <john.ahlroos@itmill.com> | 2010-06-02 08:00:48 +0000 |
commit | 80a8fa6877e47b27e404cf42fdf6211ea8e83cec (patch) | |
tree | 578f6bd15517da7bce1ce92096fda261cb530e10 | |
parent | 1e125b4ae9c417435f44de3c705215ec1ab1201a (diff) | |
download | vaadin-framework-80a8fa6877e47b27e404cf42fdf6211ea8e83cec.tar.gz vaadin-framework-80a8fa6877e47b27e404cf42fdf6211ea8e83cec.zip |
Fix for #5065
svn changeset:13488/svn branch:6.4
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index 338d6a3c98..c6f74bc360 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -815,6 +815,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, setRowFocus(getRenderedRowByKey(focusedRow.getKey())); } + if (!isFocusable()) { + scrollBodyPanel.getElement().setTabIndex(-1); + } else { + scrollBodyPanel.getElement().setTabIndex(0); + } + rendering = false; headerChangedDuringUpdate = false; } @@ -3818,6 +3824,13 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, event.stopPropagation(); } + + if (!isFocusable()) { + scrollBodyPanel.getElement().setTabIndex(-1); + } else { + scrollBodyPanel.getElement().setTabIndex(0); + } + break; case Event.ONMOUSEOUT: mDown = false; @@ -4179,6 +4192,11 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, super.setWidth(""); } + if (!isFocusable()) { + scrollBodyPanel.getElement().setTabIndex(-1); + } else { + scrollBodyPanel.getElement().setTabIndex(0); + } } private static final int LAZY_COLUMN_ADJUST_TIMEOUT = 300; @@ -4361,6 +4379,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, // overflow hack here to shake body element a bit. Util.runWebkitOverflowAutoFix(scrollBodyPanel.getElement()); } + + if (!isFocusable()) { + scrollBodyPanel.getElement().setTabIndex(-1); + } else { + scrollBodyPanel.getElement().setTabIndex(0); + } } /* @@ -4945,11 +4969,13 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, * .dom.client.FocusEvent) */ public void onFocus(FocusEvent event) { - scrollBodyPanel.addStyleName("focused"); + if (isFocusable()) { + scrollBodyPanel.addStyleName("focused"); - // Focus a row if no row is in focus - if (focusedRow == null) { - setRowFocus((VScrollTableRow) scrollBody.iterator().next()); + // Focus a row if no row is in focus + if (focusedRow == null) { + setRowFocus((VScrollTableRow) scrollBody.iterator().next()); + } } } @@ -4995,4 +5021,21 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } } + /** + * Can the Table be focused? + * + * @return True if the table can be focused, else false + */ + public boolean isFocusable() { + if (scrollBody != null) { + boolean hasVerticalScrollbars = scrollBody.getOffsetHeight() > scrollBodyPanel + .getOffsetHeight(); + boolean hasHorizontalScrollbars = scrollBody.getOffsetWidth() > scrollBodyPanel + .getOffsetWidth(); + return !(!hasHorizontalScrollbars && !hasVerticalScrollbars && selectMode == SELECT_MODE_NONE); + } + + return false; + } + } |