aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/DateField.java
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2009-11-04 12:45:38 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2009-11-04 12:45:38 +0000
commit79ef77855d98132bb0c9c9c802f4047e4ad825f8 (patch)
treedc27ce252c642ed45b86858afb68bfeb6edd7932 /src/com/vaadin/ui/DateField.java
parent821a8cbc916b9110fbbc96f2b78fbedc4f6a484b (diff)
downloadvaadin-framework-79ef77855d98132bb0c9c9c802f4047e4ad825f8.tar.gz
vaadin-framework-79ef77855d98132bb0c9c9c802f4047e4ad825f8.zip
fixes #3175, now non-lenient by default, can be changed via setLenient()
svn changeset:9624/svn branch:6.2
Diffstat (limited to 'src/com/vaadin/ui/DateField.java')
-rw-r--r--src/com/vaadin/ui/DateField.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/com/vaadin/ui/DateField.java b/src/com/vaadin/ui/DateField.java
index 789ae06b48..425040a016 100644
--- a/src/com/vaadin/ui/DateField.java
+++ b/src/com/vaadin/ui/DateField.java
@@ -116,6 +116,8 @@ public class DateField extends AbstractField {
*/
private String dateString;
+ private boolean lenient = false;
+
/* Constructors */
/**
@@ -202,6 +204,10 @@ public class DateField extends AbstractField {
target.addAttribute("format", dateFormat);
}
+ if (!isLenient()) {
+ target.addAttribute("strict", true);
+ }
+
target.addAttribute("type", type);
// Gets the calendar
@@ -511,4 +517,32 @@ public class DateField extends AbstractField {
return dateFormat;
}
+ /**
+ * Specifies whether or not date/time interpretation in component is to be
+ * lenient.
+ *
+ * @see Calendar#setLenient(boolean)
+ * @see #isLenient()
+ *
+ * @param lenient
+ * true if the lenient mode is to be turned on; false if it is to
+ * be turned off.
+ */
+ public void setLenient(boolean lenient) {
+ this.lenient = lenient;
+ requestRepaint();
+ }
+
+ /**
+ * Specifies whether or not date/time interpretation is to be lenient.
+ *
+ * @see #setLenient(boolean)
+ *
+ * @return true if the interpretation mode of this calendar is lenient;
+ * false otherwise.
+ */
+ public boolean isLenient() {
+ return lenient;
+ }
+
}