Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2017-03-21 08:54:02 +0000
committerIvan Furnadjiev2017-03-21 09:43:24 +0000
commitd4d6c5186f6477eeb7810d967cd2f96cc744be9c (patch)
tree271beec90ff9dd91f31b2033f9e1f3288feb41fd /bundles
parentb0ef7d2f459d707b5182b7ac231aa7911eb01305 (diff)
downloadorg.eclipse.rap-d4d6c5186f6477eeb7810d967cd2f96cc744be9c.tar.gz
org.eclipse.rap-d4d6c5186f6477eeb7810d967cd2f96cc744be9c.tar.xz
org.eclipse.rap-d4d6c5186f6477eeb7810d967cd2f96cc744be9c.zip
Create a safe-copy of min/max date in setters and getters
To avoid min/max date manipulation outside the DateTime widget, the min/max setters and getters should create a safe-copy of the Date object. Change-Id: I19705fd401e91b5b1f3b6c60e0f26a05184dbd58
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/DateTime.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/DateTime.java
index f58e686eea..12400fbc56 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/DateTime.java
@@ -420,7 +420,7 @@ public class DateTime extends Composite {
*/
public Date getMinimum() {
checkWidget();
- return minimum;
+ return minimum == null ? null : ( Date )minimum.clone();
}
/**
@@ -437,7 +437,7 @@ public class DateTime extends Composite {
*/
public Date getMaximum() {
checkWidget();
- return maximum;
+ return maximum == null ? null : ( Date )maximum.clone();
}
/**
@@ -594,8 +594,11 @@ public class DateTime extends Composite {
*/
public void setMinimum( Date date ) {
checkWidget();
- if( date == null || maximum == null || date.getTime() < maximum.getTime() ) {
- minimum = date;
+ if( date == null ) {
+ minimum = null;
+ applyLimits();
+ } else if( maximum == null || date.getTime() < maximum.getTime() ) {
+ minimum = ( Date )date.clone();
applyLimits();
}
}
@@ -615,8 +618,11 @@ public class DateTime extends Composite {
*/
public void setMaximum( Date date ) {
checkWidget();
- if( date == null || minimum == null || date.getTime() > minimum.getTime() ) {
- maximum = date;
+ if( date == null ) {
+ maximum = null;
+ applyLimits();
+ } else if( minimum == null || date.getTime() > minimum.getTime() ) {
+ maximum = ( Date )date.clone();
applyLimits();
}
}

Back to the top