summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/DateField.java
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2011-11-08 18:02:55 +0200
committerHenri Sara <hesara@vaadin.com>2011-11-08 18:02:55 +0200
commit0ab1d01c8da1f280370452fa2427708fd6de513e (patch)
tree4bf67b8a478da3b25af35c33c031c837ef2cc2e7 /src/com/vaadin/ui/DateField.java
parenta61302616430cbbfc97cbdbb85fe294842b3409c (diff)
downloadvaadin-framework-0ab1d01c8da1f280370452fa2427708fd6de513e.tar.gz
vaadin-framework-0ab1d01c8da1f280370452fa2427708fd6de513e.zip
Parameterize Property and Field with the value type.
The interfaces Property and Field and most of their implementations are now parameterized with the type of their value. The method getValue() returns the Property type but setValue() takes Object as its parameter. No implicit conversions between value type and strings are performed in most locations (fields). Among others, AbstractTextField, DateField and RichTextArea not have specific value types and do not accept arbitrary values. Most locations requiring migration will be visible as compilation errors, with the exception of some cases where a non-parameterized Property or Field (or one parametrized with Object) is used. Not yet done: - Label - converters - setValue() parameterization (causes much more migration effort)
Diffstat (limited to 'src/com/vaadin/ui/DateField.java')
-rw-r--r--src/com/vaadin/ui/DateField.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/com/vaadin/ui/DateField.java b/src/com/vaadin/ui/DateField.java
index b6e3d1e8cb..040a2a4dd4 100644
--- a/src/com/vaadin/ui/DateField.java
+++ b/src/com/vaadin/ui/DateField.java
@@ -48,7 +48,7 @@ import com.vaadin.terminal.gwt.client.ui.VPopupCalendar;
*/
@SuppressWarnings("serial")
@ClientWidget(VPopupCalendar.class)
-public class DateField extends AbstractField implements
+public class DateField extends AbstractField<Date> implements
FieldEvents.BlurNotifier, FieldEvents.FocusNotifier {
/* Private members */
@@ -228,7 +228,7 @@ public class DateField extends AbstractField implements
// Gets the calendar
final Calendar calendar = getCalendar();
- final Date currentDate = (Date) getValue();
+ final Date currentDate = getValue();
for (int r = resolution; r <= largestModifiable; r++) {
switch (r) {
@@ -298,10 +298,10 @@ public class DateField extends AbstractField implements
|| variables.containsKey("min")
|| variables.containsKey("sec")
|| variables.containsKey("msec") || variables
- .containsKey("dateString"))) {
+ .containsKey("dateString"))) {
// Old and new dates
- final Date oldDate = (Date) getValue();
+ final Date oldDate = getValue();
Date newDate = null;
// this enables analyzing invalid input on the server
@@ -469,7 +469,7 @@ public class DateField extends AbstractField implements
* the default documentation from implemented interface.
*/
@Override
- public Class<?> getType() {
+ public Class<Date> getType() {
return Date.class;
}
@@ -642,7 +642,7 @@ public class DateField extends AbstractField implements
final Calendar newCal = (Calendar) calendar.clone();
// Assigns the current time tom calendar.
- final Date currentDate = (Date) getValue();
+ final Date currentDate = getValue();
if (currentDate != null) {
newCal.setTime(currentDate);
}