private void updateCaption(boolean nullTheCaption) { if (nullTheCaption) { if (decorator != null && decorator.getAllItemsVisibleString() != null) { content.setCaption(decorator.getAllItemsVisibleString()); } else { content.setCaption(null); } } else { SimpleDateFormat sdf = new SimpleDateFormat(dateFormatPattern); content.setCaption((fromField.getValue() == null ? "" : sdf.format(fromField.getValue())) + " - " + (toField.getValue() == null ? "" : sdf.format(toField.getValue()))); } }
final Date currentDate = getValue(); if (currentDate != null) { newCal.setTime(currentDate);
private void updateValue(boolean nullTheValue) { if (nullTheValue) { fromField.setValue(null); toField.setValue(null); } else { cancelReset = true; } /* Truncate the from and to dates */ Resolution res = decorator != null ? decorator.getDateFieldResolution(propertyId) : DEFAULT_RESOLUTION; if (res == null) { res = DEFAULT_RESOLUTION; } fromValue = truncateDate(fromField.getValue(), res, true); toValue = truncateDate(toField.getValue(), res, false); setValue(new DateInterval(fromValue, toValue)); DateFilterPopup.this.content.setPopupVisible(false); }
final Date oldDate = getValue(); Date newDate = null;
@Override protected Component initContent() { if (content == null) { content = new PopupButton(null); content.setWidth(100, Unit.PERCENTAGE); setImmediate(true); buildPopup(); setStyleName("datefilterpopup"); setFilterDecorator(decorator); updateCaption(true); content.addPopupVisibilityListener(event -> { if (cancelReset || event.getPopupButton().isPopupVisible()) { fromValue = fromField.getValue(); toValue = toField.getValue(); cancelReset = false; return; } fromField.setValue(fromValue); toField.setValue(toValue); cancelReset = false; }); } return content; }
final Date currentDate = getValue();