use of com.vaadin.shared.ui.datefield.DateResolution in project cuba by cuba-platform.
the class CubaDateFieldWidget method updateValue.
@Override
public void updateValue(Date newDate) {
DateResolution currentResolution = getCurrentResolution();
if (getDate() == null && currentResolution != null && currentResolution.compareTo(DateResolution.DAY) > 0) {
Date date = newDate;
// Collects a map of current date values depending on date resolution
Map<DateResolution, Integer> dateValues = getResolutions().collect(Collectors.toMap(Function.identity(), res -> currentResolution.compareTo(res) <= 0 ? res == DateResolution.MONTH ? date.getMonth() + 1 : date.getYear() + 1900 : null));
if (!dateValues.isEmpty()) {
newDate = makeDate(dateValues);
calendar.setDate(newDate);
}
}
super.updateValue(newDate);
}
use of com.vaadin.shared.ui.datefield.DateResolution in project cuba by cuba-platform.
the class WebDatePicker method setResolution.
@Override
public void setResolution(Resolution resolution) {
Preconditions.checkNotNullArgument(resolution);
this.resolution = resolution;
DateResolution vResolution = WebWrapperUtils.convertDateResolution(resolution);
component.setResolution(vResolution);
}
Aggregations