@Override protected void resetImpl() { notificationSchemaInfo.reset(); expiredAt.setValue(null); notificationData.reset(); }
final DateBox dateBox = new DateBox(); dateBox.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(final ValueChangeEvent<Date> dateValueChangeEvent) { if (dateValueChangeEvent.getValue().before(today())) { dateBox.setValue(today(), false); } } }); dateBox.getDatePicker().addShowRangeHandler(new ShowRangeHandler<Date>() { @Override public void onShowRange(final ShowRangeEvent<Date> dateShowRangeEvent) { final Date today = today(); Date d = zeroTime(dateShowRangeEvent.getStart()); while (d.before(today)) { dateBox.getDatePicker().setTransientEnabledOnDates(false, d); d = nextDay(d); } } });
/** * Set the date. */ public void setValue(Date date) { setValue(date, false); }
public void setValue(Date date, boolean fireEvents) { setValue(picker.getValue(), date, fireEvents, true); }
@Editor.Ignore @UiField DateBox dateField; LeafValueEditor<Long> longField = new LeafValueEditor<Long>() { @Override public Long getValue() { Date date = dateField.getValue(); return date == null ? null : date.getTime(); } @Override public void setValue(Long value) { Date date = value == null ? null : new Date(value.longValue()); dateField.setValue(date); } }
private void updateDateFromTextBox() { Date parsedDate = parseDate(true); if (fireNullValues || (parsedDate != null)) { setValue(picker.getValue(), parsedDate, true, false); } } }
/** * Sets the format used to control formatting and parsing of dates in this * {@link DateBox}. If this {@link DateBox} is not empty, the contents of date * box will be replaced with current contents in the new format. * * @param format the new date format */ public void setFormat(Format format) { assert format != null : "A Date box may not have a null format"; if (this.format != format) { Date date = getValue(); // This call lets the formatter do whatever other clean up is required to // switch formatters. // this.format.reset(this, true); // Now update the format and show the current date using the new format. this.format = format; setValue(date); } }
/** * Set the date. */ public void setValue(Date date) { setValue(date, false); }
/** * Set the date. */ public void setValue(Date date) { setValue(date, false); }
protected void setValue(DateBox datebox, Date value) { datebox.setValue(value); }
/** * Create a new date box. * * @param date the default date. * @param picker the picker to drop down from the date box * @param format to use to parse and format dates */ public DateBox(DatePicker picker, Date date, Format format) { this.picker = picker; this.popup = new PopupPanel(true); assert format != null : "You may not construct a date box with a null format"; this.format = format; popup.addAutoHidePartner(box.getElement()); popup.setWidget(picker); popup.setStyleName("dateBoxPopup"); initWidget(box); setStyleName(DEFAULT_STYLENAME); DateBoxHandler handler = new DateBoxHandler(); picker.addValueChangeHandler(handler); box.addFocusHandler(handler); box.addBlurHandler(handler); box.addClickHandler(handler); box.addKeyDownHandler(handler); box.setDirectionEstimator(false); popup.addCloseHandler(handler); setValue(date); }
public void setValue(Date date, boolean fireEvents) { setValue(picker.getValue(), date, fireEvents, true); }
public void setValue(Date date, boolean fireEvents) { setValue(picker.getValue(), date, fireEvents, true); }
private void updateDateFromTextBox() { Date parsedDate = parseDate(true); if (fireNullValues || (parsedDate != null)) { setValue(picker.getValue(), parsedDate, true, false); } } }
private void updateDateFromTextBox() { Date parsedDate = parseDate(true); if (fireNullValues || (parsedDate != null)) { setValue(picker.getValue(), parsedDate, true, false); } } }
private Date prevDate; ... final DateBox dateBox = new DateBox(); final DateTimeFormat dateTimeFormat=DateTimeFormat.getFormat("MM/dd/yyyy"); dateBox.getDatePicker().addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { if (dateTimeFormat.format(event.getValue()).equals(dateTimeFormat.format(new Date()))) { dateBox.setValue(prevDate); // show warning message here }else{ prevDate=event.getValue(); } } });
/** * Sets the format used to control formatting and parsing of dates in this * {@link DateBox}. If this {@link DateBox} is not empty, the contents of date * box will be replaced with current contents in the new format. * * @param format the new date format */ public void setFormat(Format format) { assert format != null : "A Date box may not have a null format"; if (this.format != format) { Date date = getValue(); // This call lets the formatter do whatever other clean up is required to // switch formatters. // this.format.reset(this, true); // Now update the format and show the current date using the new format. this.format = format; setValue(date); } }
/** * Sets the format used to control formatting and parsing of dates in this * {@link DateBox}. If this {@link DateBox} is not empty, the contents of date * box will be replaced with current contents in the new format. * * @param format the new date format */ public void setFormat(Format format) { assert format != null : "A Date box may not have a null format"; if (this.format != format) { Date date = getValue(); // This call lets the formatter do whatever other clean up is required to // switch formatters. // this.format.reset(this, true); // Now update the format and show the current date using the new format. this.format = format; setValue(date); } }
/*************************************** * Handles a {@link ValueChangeEvent} from a {@link GwtTimePicker}. * * @param rEvent The event that occurred */ void timePickerValueChanged(ValueChangeEvent<Integer> rEvent) { if (rDateBox == null) { ValueChangeEvent.fire(GwtDatePicker.this, getDate()); } else { rDateBox.setValue(getDate(), true); } }
/*************************************** * Sets the date value of this component. * * @param rDate The new date value or NULL for an empty edit field */ @Override public void setDate(Date rDate) { if (rDate == null) { getDateWidget().getTextBox().setText(""); } else { getDateWidget().setValue(rDate); } }