Exemplo n.º 1
0
 @Override
 protected void handleControlPropertyChanged(String p) {
   if ("DAY_CELL_FACTORY".equals(p)) {
     updateDisplayNode();
     jfxDatePickerContent = null;
     popup = null;
   } else if ("CONVERTER".equals(p)) {
     updateDisplayNode();
   } else if ("EDITOR".equals(p)) {
     getEditableInputNode();
   } else if ("SHOWING".equals(p)) {
     if (jfxDatePicker.isShowing()) {
       if (jfxDatePickerContent != null) {
         LocalDate date = jfxDatePicker.getValue();
         // set the current date / now when showing the date picker content
         jfxDatePickerContent
             .displayedYearMonthProperty()
             .set((date != null) ? YearMonth.from(date) : YearMonth.now());
         jfxDatePickerContent.updateValues();
       }
       show();
     } else {
       hide();
     }
   } else if ("SHOW_WEEK_NUMBERS".equals(p)) {
     if (jfxDatePickerContent != null) {
       // update the content grid to show week numbers
       jfxDatePickerContent.updateContentGrid();
       jfxDatePickerContent.updateWeekNumberDateCells();
     }
   } else if ("VALUE".equals(p)) {
     updateDisplayNode();
     if (jfxDatePickerContent != null) {
       LocalDate date = jfxDatePicker.getValue();
       jfxDatePickerContent
           .displayedYearMonthProperty()
           .set((date != null) ? YearMonth.from(date) : YearMonth.now());
       jfxDatePickerContent.updateValues();
     }
     jfxDatePicker.fireEvent(new ActionEvent());
   } else {
     super.handleControlPropertyChanged(p);
   }
 }
Exemplo n.º 2
0
 /*
  * this method is called from the behavior class to make sure
  * DatePicker button is in sync after the popup is being dismissed
  */
 public void syncWithAutoUpdate() {
   if (!getPopup().isShowing() && jfxDatePicker.isShowing()) jfxDatePicker.hide();
 }