summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/DateField.java
diff options
context:
space:
mode:
authorPekka Hyvönen <pekka@vaadin.com>2012-09-10 22:12:47 +0300
committerArtur Signell <artur@vaadin.com>2012-09-11 12:19:02 +0300
commit0f5284bb827b5f04c6c064c851b851604293665a (patch)
tree4c9949ba7fa08dfae4f276f95c6928cae8b7760f /server/src/com/vaadin/ui/DateField.java
parent8a904080835193e322e1f006aa65f490f2cd930a (diff)
downloadvaadin-framework-0f5284bb827b5f04c6c064c851b851604293665a.tar.gz
vaadin-framework-0f5284bb827b5f04c6c064c851b851604293665a.zip
Constants -> enums (#9072)
Patch from Pekka with minor changes (ButtonCode -> MouseButton, FilteringMode -> ComboBox)
Diffstat (limited to 'server/src/com/vaadin/ui/DateField.java')
-rw-r--r--server/src/com/vaadin/ui/DateField.java72
1 files changed, 3 insertions, 69 deletions
diff --git a/server/src/com/vaadin/ui/DateField.java b/server/src/com/vaadin/ui/DateField.java
index f54959fb0a..39230bf662 100644
--- a/server/src/com/vaadin/ui/DateField.java
+++ b/server/src/com/vaadin/ui/DateField.java
@@ -17,12 +17,10 @@
package com.vaadin.ui;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
-import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
@@ -40,6 +38,7 @@ import com.vaadin.server.LegacyComponent;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
import com.vaadin.shared.ui.datefield.DateFieldConstants;
+import com.vaadin.shared.ui.datefield.Resolution;
/**
* <p>
@@ -64,71 +63,6 @@ public class DateField extends AbstractField<Date> implements
FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, LegacyComponent {
/**
- * Resolutions for DateFields
- *
- * @author Vaadin Ltd.
- * @since 7.0
- */
- public enum Resolution {
- SECOND(Calendar.SECOND), MINUTE(Calendar.MINUTE), HOUR(
- Calendar.HOUR_OF_DAY), DAY(Calendar.DAY_OF_MONTH), MONTH(
- Calendar.MONTH), YEAR(Calendar.YEAR);
-
- private int calendarField;
-
- private Resolution(int calendarField) {
- this.calendarField = calendarField;
- }
-
- /**
- * Returns the field in {@link Calendar} that corresponds to this
- * resolution.
- *
- * @return one of the field numbers used by Calendar
- */
- public int getCalendarField() {
- return calendarField;
- }
-
- /**
- * Returns the resolutions that are higher or equal to the given
- * resolution, starting from the given resolution. In other words
- * passing DAY to this methods returns DAY,MONTH,YEAR
- *
- * @param r
- * The resolution to start from
- * @return An iterable for the resolutions higher or equal to r
- */
- public static Iterable<Resolution> getResolutionsHigherOrEqualTo(
- Resolution r) {
- List<Resolution> resolutions = new ArrayList<DateField.Resolution>();
- Resolution[] values = Resolution.values();
- for (int i = r.ordinal(); i < values.length; i++) {
- resolutions.add(values[i]);
- }
- return resolutions;
- }
-
- /**
- * Returns the resolutions that are lower than the given resolution,
- * starting from the given resolution. In other words passing DAY to
- * this methods returns HOUR,MINUTE,SECOND.
- *
- * @param r
- * The resolution to start from
- * @return An iterable for the resolutions lower than r
- */
- public static List<Resolution> getResolutionsLowerThan(Resolution r) {
- List<Resolution> resolutions = new ArrayList<DateField.Resolution>();
- Resolution[] values = Resolution.values();
- for (int i = r.ordinal() - 1; i >= 0; i--) {
- resolutions.add(values[i]);
- }
- return resolutions;
- }
- };
-
- /**
* Resolution identifier: seconds.
*
* @deprecated As of 7.0, use {@link Resolution#SECOND}
@@ -212,7 +146,7 @@ public class DateField extends AbstractField<Date> implements
private TimeZone timeZone = null;
- private static Map<Resolution, String> variableNameForResolution = new HashMap<DateField.Resolution, String>();
+ private static Map<Resolution, String> variableNameForResolution = new HashMap<Resolution, String>();
{
variableNameForResolution.put(Resolution.SECOND, "sec");
variableNameForResolution.put(Resolution.MINUTE, "min");
@@ -372,7 +306,7 @@ public class DateField extends AbstractField<Date> implements
// Gets the new date in parts
boolean hasChanges = false;
- Map<Resolution, Integer> calendarFieldChanges = new HashMap<DateField.Resolution, Integer>();
+ Map<Resolution, Integer> calendarFieldChanges = new HashMap<Resolution, Integer>();
for (Resolution r : Resolution
.getResolutionsHigherOrEqualTo(resolution)) {