bug4210 Added styling to date and time inputs

This commit is contained in:
Benjamin Barth committed 2017-11-20 16:58:51 +01:00
1 parent cb17545150
commit f816d16639
7 files changed
+32 -2

No files matched your search

@@ -13,6 +13,7 @@ abstract class AbstractInput extends Composite implements DateTimeInput {
private HasValue<Date> delegate;
protected <T extends HasValue<Date> & IsWidget> AbstractInput(T delegate) {
DateTimeInputResources.INSTANCE.css().ensureInjected();
this.delegate = delegate;
initWidget(delegate.asWidget());
}
@@ -26,6 +26,8 @@ public class DateAndTimeInput extends AbstractInput {
public DateAndTimePanel(Accuracy accuracy) {
add(this.dateInput = new DateInput());
add(this.timeInput = new TimeInput(accuracy));
dateInput.addStyleName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
timeInput.addStyleName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
this.dateFormat = DateTimeFormat.getFormat("yyyy-MM-dd");
this.timeFormat = accuracy.getTimeFormat();
this.datetimeFormat = accuracy.getDatetimeFormat();
@@ -3,7 +3,6 @@ package com.sap.sailing.gwt.common.client.datetime;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import com.google.gwt.user.datepicker.client.DateBox;
import com.google.gwt.user.datepicker.client.DatePicker;
public class DateInput extends AbstractInput {
@@ -14,7 +13,8 @@ public class DateInput extends AbstractInput {
private static class CustomDateBox extends DateBox {
private CustomDateBox() {
super(new DatePicker(), null, new DefaultFormat(DateTimeFormat.getFormat(PredefinedFormat.DATE_MEDIUM)));
setFormat(new DefaultFormat(DateTimeFormat.getFormat(PredefinedFormat.DATE_MEDIUM)));
addStyleName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
}
}
@@ -0,0 +1,18 @@
package com.sap.sailing.gwt.common.client.datetime;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
interface DateTimeInputResources extends ClientBundle {
static final DateTimeInputResources INSTANCE = GWT.create(DateTimeInputResources.class);
@Source("dateTimeInput.gss")
Style css();
interface Style extends CssResource {
String dateTimeInput();
}
}
@@ -36,6 +36,7 @@ class NativeDateTimeInput extends Widget implements DateTimeInput {
this.input = Document.get().createElement(InputElement.TAG).cast();
this.input.setAttribute(ATTR_TYPE, inputType.getType());
this.input.setAttribute(ATTR_STEP, step);
this.input.addClassName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
this.format = format;
setElement(input);
sinkEvents(Event.ONCHANGE | Event.ONBLUR | Event.ONKEYUP);
@@ -21,6 +21,7 @@ public class TimeInput extends AbstractInput {
private TimeBox(TimeConverter converter) {
super(Document.get().createElement(InputElement.TAG), converter, converter);
addStyleName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
}
}
@@ -0,0 +1,7 @@
.dateTimeInput {
font-family: 'Open Sans', 'Arial Unicode MS', Arial, sans-serif;
font-size: small;
border: 1px solid #ccc;
border-top: 1px solid #999;
padding: 2.75px 3px;
}