Browse Source

Fix for #5144

svn changeset:13713/svn branch:6.4
tags/6.7.0.beta1
John Alhroos 14 years ago
parent
commit
708662f34f
1 changed files with 48 additions and 40 deletions
  1. 48
    40
      src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java

+ 48
- 40
src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java View File

@@ -274,6 +274,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
private String height;
private String width = "";
private boolean rendering = false;
private boolean hasFocus = false;
private int dragmode;

private int multiselectmode;
@@ -355,12 +356,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
*/
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);

}

@@ -671,7 +672,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,

showRowHeaders = uidl.getBooleanAttribute("rowheaders");
showColHeaders = uidl.getBooleanAttribute("colheaders");
nullSelectionAllowed = uidl.hasAttribute("nsa") ? uidl
.getBooleanAttribute("nsa") : true;

@@ -4807,15 +4808,16 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
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);
}

@@ -4918,21 +4920,23 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
* .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);
}
}
}

@@ -4944,21 +4948,23 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
* .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);
}
}
}

@@ -4972,6 +4978,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
public void onFocus(FocusEvent event) {
if (isFocusable()) {
scrollBodyPanel.addStyleName("focused");
hasFocus = true;

// Focus a row if no row is in focus
if (focusedRow == null) {
@@ -4989,6 +4996,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
*/
public void onBlur(BlurEvent event) {
scrollBodyPanel.removeStyleName("focused");
hasFocus = false;

// Unfocus any row
setRowFocus(null);

Loading…
Cancel
Save