setRowFocus(getRenderedRowByKey(focusedRow.getKey()));
}
+ if (!isFocusable()) {
+ scrollBodyPanel.getElement().setTabIndex(-1);
+ } else {
+ scrollBodyPanel.getElement().setTabIndex(0);
+ }
+
rendering = false;
headerChangedDuringUpdate = false;
}
event.stopPropagation();
}
+
+ if (!isFocusable()) {
+ scrollBodyPanel.getElement().setTabIndex(-1);
+ } else {
+ scrollBodyPanel.getElement().setTabIndex(0);
+ }
+
break;
case Event.ONMOUSEOUT:
mDown = false;
super.setWidth("");
}
+ if (!isFocusable()) {
+ scrollBodyPanel.getElement().setTabIndex(-1);
+ } else {
+ scrollBodyPanel.getElement().setTabIndex(0);
+ }
}
private static final int LAZY_COLUMN_ADJUST_TIMEOUT = 300;
// overflow hack here to shake body element a bit.
Util.runWebkitOverflowAutoFix(scrollBodyPanel.getElement());
}
+
+ if (!isFocusable()) {
+ scrollBodyPanel.getElement().setTabIndex(-1);
+ } else {
+ scrollBodyPanel.getElement().setTabIndex(0);
+ }
}
/*
* .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());
+ }
}
}
}
}
+ /**
+ * 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;
+ }
+
}