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
 @Override
 public Node getDisplayNode() {
   if (displayNode == null) {
     displayNode = getEditableInputNode();
     displayNode.getStyleClass().add("date-picker-display-node");
     updateDisplayNode();
   }
   displayNode.setEditable(jfxDatePicker.isEditable());
   return displayNode;
 }
Exemplo n.º 3
0
  public JFXDatePickerSkin(final JFXDatePicker datePicker) {
    super(datePicker, new JFXDatePickerBehavior(datePicker));
    this.jfxDatePicker = datePicker;
    editorNode = new JFXTextField();
    editorNode.focusColorProperty().bind(datePicker.defaultColorProperty());

    arrow =
        new SVGGlyph(
            0,
            "calendar",
            "M320 384h128v128h-128zM512 384h128v128h-128zM704 384h128v128h-128zM128 768h128v128h-128zM320 768h128v128h-128zM512 768h128v128h-128zM320 576h128v128h-128zM512 576h128v128h-128zM704 576h128v128h-128zM128 576h128v128h-128zM832 0v64h-128v-64h-448v64h-128v-64h-128v1024h960v-1024h-128zM896 960h-832v-704h832v704z",
            Color.BLACK);
    ((SVGGlyph) arrow).fillProperty().bind(jfxDatePicker.defaultColorProperty());
    ((SVGGlyph) arrow).setSize(20, 20);
    arrowButton.getChildren().setAll(arrow);
    arrowButton.setBackground(
        new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));

    // dialog = new JFXDialog(null, content, transitionType, overlayClose)

    registerChangeListener(datePicker.converterProperty(), "CONVERTER");
    registerChangeListener(datePicker.dayCellFactoryProperty(), "DAY_CELL_FACTORY");
    registerChangeListener(datePicker.showWeekNumbersProperty(), "SHOW_WEEK_NUMBERS");
    registerChangeListener(datePicker.valueProperty(), "VALUE");
  }
Exemplo n.º 4
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();
 }