mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 01:31:01 +00:00
bug4210 Adjusted internal format of accuracy enumeration
This commit is contained in:
1 parent
ebb5656108
commit
1187cac58e
5 files changed
+13
-11
No files matched your search
+2
-2
@@ -46,8 +46,8 @@ public class DateAndTimeInput extends Composite implements DateTimeInput {
|
||||
add(this.dateInput = new DateInput());
|
||||
add(this.timeInput = new TimeInput(accuracy));
|
||||
this.dateFormat = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||
this.timeFormat = DateTimeFormat.getFormat(accuracy.getTimeFormat());
|
||||
this.datetimeFormat = DateTimeFormat.getFormat(accuracy.getDatetimeFormat());
|
||||
this.timeFormat = accuracy.getTimeFormat();
|
||||
this.datetimeFormat = accuracy.getDatetimeFormat();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-6
@@ -3,31 +3,33 @@ package com.sap.sailing.gwt.common.client.datetime;
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.user.client.ui.HasValue;
|
||||
import com.google.gwt.user.client.ui.IsWidget;
|
||||
|
||||
public interface DateTimeInput extends IsWidget, HasValue<Date> {
|
||||
|
||||
enum Accuracy {
|
||||
public enum Accuracy {
|
||||
MINUTES(60, "yyyy-MM-dd'T'HH:mm", "HH:mm"), SECONDS(1, "yyyy-MM-dd'T'HH:mm:ss", "HH:mm:ss");
|
||||
|
||||
private final String step, datetimeFormat, timeFormat;
|
||||
private final String step;
|
||||
private final DateTimeFormat datetimeFormat, timeFormat;
|
||||
|
||||
private Accuracy(int step, String datetimeFormat, String timeFormat) {
|
||||
this.step = String.valueOf(step);
|
||||
this.datetimeFormat = datetimeFormat;
|
||||
this.timeFormat = timeFormat;
|
||||
this.datetimeFormat = DateTimeFormat.getFormat(datetimeFormat);
|
||||
this.timeFormat = DateTimeFormat.getFormat(timeFormat);
|
||||
}
|
||||
|
||||
public String getStep() {
|
||||
return step;
|
||||
}
|
||||
|
||||
public String getDatetimeFormat() {
|
||||
public DateTimeFormat getDatetimeFormat() {
|
||||
return datetimeFormat;
|
||||
}
|
||||
|
||||
public String getTimeFormat() {
|
||||
public DateTimeFormat getTimeFormat() {
|
||||
return timeFormat;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ class NativeDatetimeLocalInput extends Widget implements DateTimeInput {
|
||||
this.input = Document.get().createElement(InputElement.TAG).cast();
|
||||
this.input.setAttribute(ATTR_TYPE, DateTimeInputType.DATETIME_LOCAL.getType());
|
||||
this.input.setAttribute(ATTR_STEP, accuracy.getStep());
|
||||
this.format = DateTimeFormat.getFormat(accuracy.getDatetimeFormat());
|
||||
this.format = accuracy.getDatetimeFormat();
|
||||
setElement(input);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ class NativeTimeInput extends Widget implements DateTimeInput {
|
||||
this.input = Document.get().createElement(InputElement.TAG).cast();
|
||||
this.input.setAttribute(ATTR_TYPE, DateTimeInputType.TIME.getType());
|
||||
this.input.setAttribute(ATTR_STEP, accuracy.getStep());
|
||||
this.format = DateTimeFormat.getFormat(accuracy.getTimeFormat());
|
||||
this.format = accuracy.getTimeFormat();
|
||||
setElement(input);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class TimeInput extends Composite implements DateTimeInput {
|
||||
private final DateTimeFormat timeFormat;
|
||||
|
||||
private TimeConverter(Accuracy accuracy) {
|
||||
this.timeFormat = DateTimeFormat.getFormat(accuracy.getTimeFormat());
|
||||
this.timeFormat = accuracy.getTimeFormat();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user