private String height;
private String width = "";
private boolean rendering = false;
+ private boolean hasFocus = false;
private int dragmode;
private int multiselectmode;
*/
private void fireColumnResizeEvent(String columnId, int originalWidth,
int newWidth) {
- client.updateVariable(paintableId, "columnResizeEventColumn",
- columnId, false);
- client.updateVariable(paintableId, "columnResizeEventPrev",
- originalWidth, false);
- client.updateVariable(paintableId, "columnResizeEventCurr",
- newWidth, immediate);
+ client.updateVariable(paintableId, "columnResizeEventColumn", columnId,
+ false);
+ client.updateVariable(paintableId, "columnResizeEventPrev",
+ originalWidth, false);
+ client.updateVariable(paintableId, "columnResizeEventCurr", newWidth,
+ immediate);
}
showRowHeaders = uidl.getBooleanAttribute("rowheaders");
showColHeaders = uidl.getBooleanAttribute("colheaders");
-
+
nullSelectionAllowed = uidl.hasAttribute("nsa") ? uidl
.getBooleanAttribute("nsa") : true;
scrollBodyPanel.setHorizontalScrollPosition(scrollBodyPanel
.getHorizontalScrollPosition()
+ scrollingVelocity);
+ return true;
}
// Select navigation
if (selectMode > SELECT_MODE_NONE
&& keycode == getNavigationSelectKey()) {
if (selectMode == SELECT_MODE_SINGLE) {
- boolean wasSelected = focusedRow.isSelected();
- deselectAll();
- if (!wasSelected || !nullSelectionAllowed ) {
+ boolean wasSelected = focusedRow.isSelected();
+ deselectAll();
+ if (!wasSelected || !nullSelectionAllowed) {
focusedRow.toggleSelection(true);
}
* .gwt.event.dom.client.KeyPressEvent)
*/
public void onKeyPress(KeyPressEvent event) {
- if (handleNavigation(event.getNativeEvent().getKeyCode(), event
- .isControlKeyDown()
- || event.isMetaKeyDown(), event.isShiftKeyDown())) {
- event.preventDefault();
- }
-
- // Start the velocityTimer
- if (scrollingVelocityTimer == null) {
- scrollingVelocityTimer = new Timer() {
- @Override
- public void run() {
- scrollingVelocity++;
- }
- };
- scrollingVelocityTimer.scheduleRepeating(100);
+ if (hasFocus) {
+ if (handleNavigation(event.getNativeEvent().getKeyCode(), event
+ .isControlKeyDown()
+ || event.isMetaKeyDown(), event.isShiftKeyDown())) {
+ event.preventDefault();
+ }
+
+ // Start the velocityTimer
+ if (scrollingVelocityTimer == null) {
+ scrollingVelocityTimer = new Timer() {
+ @Override
+ public void run() {
+ scrollingVelocity++;
+ }
+ };
+ scrollingVelocityTimer.scheduleRepeating(100);
+ }
}
}
* .event.dom.client.KeyDownEvent)
*/
public void onKeyDown(KeyDownEvent event) {
- if (handleNavigation(event.getNativeEvent().getKeyCode(), event
- .isControlKeyDown()
- || event.isMetaKeyDown(), event.isShiftKeyDown())) {
- event.preventDefault();
- }
-
- // Start the velocityTimer
- if (scrollingVelocityTimer == null) {
- scrollingVelocityTimer = new Timer() {
- @Override
- public void run() {
- scrollingVelocity++;
- }
- };
- scrollingVelocityTimer.scheduleRepeating(100);
+ if (hasFocus) {
+ if (handleNavigation(event.getNativeEvent().getKeyCode(), event
+ .isControlKeyDown()
+ || event.isMetaKeyDown(), event.isShiftKeyDown())) {
+ event.preventDefault();
+ }
+
+ // Start the velocityTimer
+ if (scrollingVelocityTimer == null) {
+ scrollingVelocityTimer = new Timer() {
+ @Override
+ public void run() {
+ scrollingVelocity++;
+ }
+ };
+ scrollingVelocityTimer.scheduleRepeating(100);
+ }
}
}
public void onFocus(FocusEvent event) {
if (isFocusable()) {
scrollBodyPanel.addStyleName("focused");
+ hasFocus = true;
// Focus a row if no row is in focus
if (focusedRow == null) {
*/
public void onBlur(BlurEvent event) {
scrollBodyPanel.removeStyleName("focused");
+ hasFocus = false;
// Unfocus any row
setRowFocus(null);