summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Alhroos <john.ahlroos@itmill.com>2010-11-05 11:30:52 +0000
committerJohn Alhroos <john.ahlroos@itmill.com>2010-11-05 11:30:52 +0000
commit3de6cefec2548609ebabd6b8e3a7cfb46a2614fd (patch)
treeacd1f7c204195504fb9b064b8a9a53b6f2cfff71 /src
parent7c4cabc0d93b318f3f6b34e165cfbf5d6f48a7ea (diff)
parent9731d2ccb87cccb3c9e0964d2edc67e237732132 (diff)
downloadvaadin-framework-3de6cefec2548609ebabd6b8e3a7cfb46a2614fd.tar.gz
vaadin-framework-3de6cefec2548609ebabd6b8e3a7cfb46a2614fd.zip
Merged [15706] [15713] [15714] [15720] [15721] [15735] [15736] [15737] [15739] [15761] [15764]
svn changeset:15878/svn branch:6.5
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java18
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java52
2 files changed, 55 insertions, 15 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java
index 2774a97c98..b4c3dccbc9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java
@@ -1,4 +1,4 @@
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
@@ -405,21 +405,33 @@ public class VGridLayout extends SimplePanel implements Paintable, Container {
x += columnWidths[i] + spacingPixelsHorizontal;
}
- if ("".equals(width)) {
+ if (isUndefinedWidth()) {
canvas.setWidth((x - spacingPixelsHorizontal) + "px");
} else {
// main element defines width
canvas.setWidth("");
}
+
int canvasHeight;
- if ("".equals(height)) {
+ if (isUndefinedHeight()) {
canvasHeight = y - spacingPixelsVertical;
} else {
canvasHeight = getOffsetHeight() - marginTopAndBottom;
+ if (canvasHeight < 0) {
+ canvasHeight = 0;
+ }
}
canvas.setHeight(canvasHeight + "px");
}
+ private boolean isUndefinedHeight() {
+ return "".equals(height);
+ }
+
+ private boolean isUndefinedWidth() {
+ return "".equals(width);
+ }
+
private void renderRemainingComponents(LinkedList<Cell> pendingCells) {
for (Cell cell : pendingCells) {
cell.render();
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index 8ad782411d..b1ebb763bf 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -1,4 +1,4 @@
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
@@ -115,6 +115,14 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
private static final int MULTISELECT_MODE_DEFAULT = 0;
/**
+ * The simple multiselect mode is what the table used to have before
+ * ctrl/shift selections were added. That is that when this is set clicking
+ * on an item selects/deselects the item and no ctrl/shift selections are
+ * available.
+ */
+ private static final int MULTISELECT_MODE_SIMPLE = 1;
+
+ /**
* multiple of pagelength which component will cache when requesting more
* rows
*/
@@ -3963,7 +3971,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
deselectAll();
}
toggleSelection();
- } else if (selectMode == SELECT_MODE_SINGLE
+ } else if ((selectMode == SELECT_MODE_SINGLE || multiselectmode == MULTISELECT_MODE_SIMPLE)
&& nullSelectionAllowed) {
toggleSelection();
}/*
@@ -5011,12 +5019,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
var top = elem.offsetTop;
var height = elem.offsetHeight;
- if (elem.parentNode != elem.offsetParent) {
+ if (elem.parentNode != elem.offsetParent) {
top -= elem.parentNode.offsetTop;
}
var cur = elem.parentNode;
- while (cur && (cur.nodeType == 1)) {
+ while (cur && (cur.nodeType == 1)) {
if (top < cur.scrollTop) {
cur.scrollTop = top;
}
@@ -5025,7 +5033,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
}
var offsetTop = cur.offsetTop;
- if (cur.parentNode != cur.offsetParent) {
+ if (cur.parentNode != cur.offsetParent) {
offsetTop -= cur.parentNode.offsetTop;
}
@@ -5302,7 +5310,11 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
* .gwt.event.dom.client.KeyPressEvent)
*/
public void onKeyPress(KeyPressEvent event) {
- if (hasFocus) {
+ if (!enabled) {
+ // Cancel default keyboard events on a disabled Table (prevents
+ // scrolling)
+ event.preventDefault();
+ } else if (hasFocus) {
if (handleNavigation(event.getNativeEvent().getKeyCode(),
event.isControlKeyDown() || event.isMetaKeyDown(),
event.isShiftKeyDown())) {
@@ -5330,7 +5342,11 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
* .event.dom.client.KeyDownEvent)
*/
public void onKeyDown(KeyDownEvent event) {
- if (hasFocus) {
+ if (!enabled) {
+ // Cancel default keyboard events on a disabled Table (prevents
+ // scrolling)
+ event.preventDefault();
+ } else if (hasFocus) {
if (handleNavigation(event.getNativeEvent().getKeyCode(),
event.isControlKeyDown() || event.isMetaKeyDown(),
event.isShiftKeyDown())) {
@@ -5384,8 +5400,10 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
hasFocus = false;
navKeyDown = false;
- // Unfocus any row
- setRowFocus(null);
+ if (isFocusable()) {
+ // Unfocus any row
+ setRowFocus(null);
+ }
}
/**
@@ -5420,7 +5438,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
* @return True if the table can be focused, else false
*/
public boolean isFocusable() {
- if (scrollBody != null) {
+ if (scrollBody != null && enabled) {
boolean hasVerticalScrollbars = scrollBody.getOffsetHeight() > scrollBodyPanel
.getOffsetHeight();
boolean hasHorizontalScrollbars = scrollBody.getOffsetWidth() > scrollBodyPanel
@@ -5437,7 +5455,9 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
* @see com.vaadin.terminal.gwt.client.Focusable#focus()
*/
public void focus() {
- scrollBodyPanel.focus();
+ if (isFocusable()) {
+ scrollBodyPanel.focus();
+ }
}
/**
@@ -5461,7 +5481,15 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
public void onKeyUp(KeyUpEvent event) {
int keyCode = event.getNativeKeyCode();
- if (isNavigationKey(keyCode)) {
+
+ if (!isFocusable()) {
+ if (scrollingVelocityTimer != null) {
+ // Remove velocityTimer if it exists and the Table is disabled
+ scrollingVelocityTimer.cancel();
+ scrollingVelocityTimer = null;
+ scrollingVelocity = 10;
+ }
+ } else if (isNavigationKey(keyCode)) {
if (keyCode == getNavigationDownKey()
|| keyCode == getNavigationUpKey()) {
/*