summaryrefslogtreecommitdiffstats
path: root/shared/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2014-12-19 10:08:34 +0200
committerArtur Signell <artur@vaadin.com>2014-12-19 10:08:34 +0200
commit8d8ba6f438f61d2e1d26fe9e23ddd58296e5f193 (patch)
tree194b7972ce90c324c11ca7c4a661f727256a1bb3 /shared/src
parent456eec655d3a7c8040b00a82d7267e8cb892754d (diff)
parentc1c3564717388708e34f7ec6e9beeb09e4c2d6a4 (diff)
downloadvaadin-framework-7.4.0.beta1.tar.gz
vaadin-framework-7.4.0.beta1.zip
Merge remote-tracking branch 'origin/grid' into 7.47.4.0.beta1
Diffstat (limited to 'shared/src')
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/Range.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/shared/src/com/vaadin/shared/ui/grid/Range.java b/shared/src/com/vaadin/shared/ui/grid/Range.java
index 2054845320..6be9e04cbc 100644
--- a/shared/src/com/vaadin/shared/ui/grid/Range.java
+++ b/shared/src/com/vaadin/shared/ui/grid/Range.java
@@ -177,6 +177,10 @@ public final class Range implements Serializable {
* range
*/
public boolean isSubsetOf(final Range other) {
+ if (isEmpty() && other.isEmpty()) {
+ return true;
+ }
+
return other.getStart() <= getStart() && getEnd() <= other.getEnd();
}
@@ -411,8 +415,10 @@ public final class Range implements Serializable {
* @return a bounded range
*/
public Range restrictTo(Range bounds) {
- boolean startWithin = getStart() >= bounds.getStart();
- boolean endWithin = getEnd() <= bounds.getEnd();
+ boolean startWithin = bounds.contains(getStart());
+ boolean endWithin = bounds.contains(getEnd());
+ boolean boundsWithin = getStart() < bounds.getStart()
+ && getEnd() >= bounds.getEnd();
if (startWithin) {
if (endWithin) {
@@ -423,8 +429,10 @@ public final class Range implements Serializable {
} else {
if (endWithin) {
return Range.between(bounds.getStart(), getEnd());
- } else {
+ } else if (boundsWithin) {
return bounds;
+ } else {
+ return Range.withLength(getStart(), 0);
}
}
}