Java 类javafx.scene.control.DatePicker 实例源码

项目:marathonv5    文件:JavaFXDatePickerElementTest.java   
@Test public void selectDate() {
    DatePicker datePickerNode = (DatePicker) getPrimaryStage().getScene().getRoot().lookup(".date-picker");
    IJavaFXElement datePicker = datePickers.get(0);
    Platform.runLater(() -> {
        datePicker.marathon_select(dateString);
    });
    List<Object> dates = new ArrayList<>();
    Platform.runLater(() -> {
        LocalDate value = datePickerNode.getValue();
        dates.add(datePickerNode.getConverter().toString(value));
    });
    new Wait("Waiting for date to be set.") {
        @Override public boolean until() {
            return dates.size() > 0;
        }
    };
    AssertJUnit.assertEquals(dateString, dates.get(0));
}
项目:marathonv5    文件:JavaFXDatePickerElementTest.java   
@Test public void selectEdiotrDate() {
    Set<Node> datePickerNodes = getPrimaryStage().getScene().getRoot().lookupAll(".date-picker");
    List<Node> pickers = new ArrayList<>(datePickerNodes);
    DatePicker datePickerNode = (DatePicker) pickers.get(1);
    IJavaFXElement datePicker = datePickers.get(1);
    Platform.runLater(() -> {
        datePicker.marathon_select(dateString);
    });
    List<Object> dates = new ArrayList<>();
    Platform.runLater(() -> {
        LocalDate value = datePickerNode.getValue();
        dates.add(datePickerNode.getConverter().toString(value));
    });
    new Wait("Waiting for date to be set.") {
        @Override public boolean until() {
            return dates.size() > 0;
        }
    };
    AssertJUnit.assertEquals(dateString, dates.get(0));
}
项目:marathonv5    文件:RFXDatePickerTest.java   
@Test public void getText() {
    DatePicker datePicker = (DatePicker) getPrimaryStage().getScene().getRoot().lookup(".date-picker");
    LoggingRecorder lr = new LoggingRecorder();
    List<String> text = new ArrayList<>();
    RFXDatePicker rfxDatePicker = new RFXDatePicker(datePicker, null, null, lr);
    Platform.runLater(() -> {
        datePicker.setValue(LocalDate.now());
        text.add(rfxDatePicker._getText());
    });
    new Wait("Waiting for date picker text.") {
        @Override public boolean until() {
            return text.size() > 0;
        }
    };
    AssertJUnit.assertEquals(datePicker.getConverter().toString(LocalDate.now()), text.get(0));
}
项目:marathonv5    文件:RFXDatePickerTest.java   
@Test public void pickEditorDate() {
    Set<Node> datePickerNodes = getPrimaryStage().getScene().getRoot().lookupAll(".date-picker");
    List<Node> pickers = new ArrayList<>(datePickerNodes);
    DatePicker datePicker = (DatePicker) pickers.get(1);
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        RFXDatePicker rfxDatePicker = new RFXDatePicker(datePicker, null, null, lr);
        datePicker.getEditor().setText("8/8/2016");
        rfxDatePicker.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("8/8/2016", recording.getParameters()[0]);

}
项目:fxutils    文件:FXInput.java   
/**
 * Sets a custom date format on a {@link DatePicker}. The format must be compliant with the java.time specifications.
 * @param datePicker The DatePicker object
 * @param format The date format
 */
public static void setDateFormat(DatePicker datePicker, final String format) {
    datePicker.setConverter(new StringConverter<LocalDate>() {
        DateTimeFormatter df = DateTimeFormatter.ofPattern(format);

        @Override
        public String toString(LocalDate date) {
            return date != null ? df.format(date) : "";
        }

        @Override
        public LocalDate fromString(String string) {
            return (string != null && !string.isEmpty()) ? LocalDate.parse(string, df) : null;
        }

    });

}
项目:fxutils    文件:DatePickerTableCell.java   
private void createDatePicker() {
    datePicker = new DatePicker(getDate());
    FXInput.setDateFormat(datePicker, datePattern);
   // datePicker.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
    datePicker.setOnKeyReleased(keyEvent -> {
        if(keyEvent.getCode() == KeyCode.ENTER) {
            commitEdit(datePicker.getValue().format(dateFormatter)); // TODO check for empty/null values
        } else if(keyEvent.getCode() == KeyCode.ESCAPE) {
            cancelEdit();
        }
    });

    datePicker.focusedProperty().addListener((obsValue, oldValue, newValue) -> {
        if(oldValue == true && newValue == false)
            commitEdit(datePicker.getValue().format(dateFormatter));
    });
}
项目:qgu    文件:GanttChart.java   
private void initTimelineViewToolBar() {
    timelineViewToolBar.setPrefHeight(TOOLBAR_HEIGHT);

    dpStart = new DatePicker(timelineView.getTimelineStart());
    FXInput.setDateFormat(dpStart, TASK_DATE_FORMAT);
    dpStart.setOnAction(event -> {
        timelineView.resetStart(dpStart.getValue());
    });

    dpEnd = new DatePicker(timelineView.getTimelineEnd());
    FXInput.setDateFormat(dpEnd, TASK_DATE_FORMAT);
    dpEnd.setOnAction(event -> {
        timelineView.resetEnd(dpEnd.getValue());
    });

    timelineViewToolBar.getItems().addAll(new Label("From: "), dpStart, new Label("To: "), dpEnd);
}
项目:git-rekt    文件:BrowseRoomsScreenController.java   
/**
 * Ensures that the date pickers only allow selection of dates within the valid booking date
 * range, as defined in the specifications document.
 *
 * Chief among these rules is that bookings may not be placed more than one year in advance.
 */
private void initializeDatePickers() {
    Callback<DatePicker, DateCell> dayCellFactory =
        (final DatePicker datePicker) -> new DateCell() {
            @Override
            public void updateItem(LocalDate item, boolean empty) {
                super.updateItem(item, empty);

                if(item.isAfter(LocalDate.now().plusYears(1))) {
                    setDisable(true);
                }
                if(item.isBefore(ChronoLocalDate.from(LocalDate.now()))) {
                    setDisable(true);
                }
            }
        };
    // Disable selecting invalid check-in/check-out dates
    checkInDatePicker.setDayCellFactory(dayCellFactory);
    checkOutDatePicker.setDayCellFactory(dayCellFactory);
}
项目:travelimg    文件:FlickrDatePicker.java   
public void setRanges(LocalDateTime startDate, LocalDateTime endDate){
    logger.debug("Setting allowed dates from {} to {}", startDate, endDate);
    final Callback<DatePicker, DateCell> dayCellFactory =
            new Callback<DatePicker, DateCell>() {
                @Override
                public DateCell call(final DatePicker datePicker) {
                    return new DateCell() {
                        @Override
                        public void updateItem(LocalDate item, boolean empty) {
                            super.updateItem(item, empty);
                            if (item.isBefore(startDate.toLocalDate()) || item.isAfter(endDate.toLocalDate())) {
                                setDisable(true);
                                setStyle("-fx-background-color: #ffc0cb;");
                            }
                        }
                    };
                }
            };
    setDayCellFactory(dayCellFactory);
}
项目:tornadofx-controls    文件:DatePickerTableCell.java   
private void createDatePicker() {
    datePicker = new DatePicker(getItem());
    datePicker.converterProperty().bind(converterProperty());

    datePicker.setOnAction(event -> {
        commitEdit(datePicker.getValue());
        event.consume();
    });

    datePicker.setOnKeyReleased(t -> {
        if (t.getCode() == KeyCode.ESCAPE) {
            cancelEdit();
            t.consume();
        }
    });
}
项目:openjfx-8u-dev-tests    文件:DatePickerTest.java   
/**
 * Check bindings of the 'prompt text' property
 */
@Test(timeout = 10000)
public void promptTextProperty() {
    rememberInitialState();
    assertTrue("[Propmpt text is empty by default]", new GetAction<Boolean>() {
        @Override public void run(Object... parameters) throws Exception {
            setResult(new DatePicker().promptTextProperty().getValue().isEmpty());
        }
    }.dispatch(testedControl.getEnvironment()).booleanValue());

    final String TESTED_TEXT = "MM_dd_YY";
    final String DEFAULT_TEXT = "default";

    for(SettingType settingType : SettingType.values()) {
        System.out.format("Testing binding:%s\n", settingType.toString());

        setPropertyByTextField(settingType, Properties.prompttext, TESTED_TEXT);
        checkTextFieldText(Properties.prompttext, TESTED_TEXT);

        switchOffBinding(settingType, Properties.prompttext);
        setPropertyByTextField(SettingType.SETTER, Properties.prompttext, DEFAULT_TEXT);
    }
    checkFinalState();
}
项目:JVx.javafx    文件:FXMonthViewTestMain.java   
@Override
public void start(Stage primaryStage)
{
    FXMonthView monthView = new FXMonthView();

    DatePicker datePicker = new DatePicker();
    datePicker.valueProperty().bindBidirectional(monthView.selectedDateProperty());

    FXFormPane controls = new FXFormPane();
    controls.addChild(datePicker);

    BorderPane root = new BorderPane();
    root.setBottom(controls);
    root.setCenter(monthView);
    BorderPane.setAlignment(root.getCenter(), Pos.CENTER);
    BorderPane.setMargin(monthView, new Insets(10, 10, 10, 10));

    primaryStage.setScene(new Scene(root));
    primaryStage.setTitle("JavaFX FXMonthView Test");
    primaryStage.show();
}
项目:Narvaro    文件:Controller.java   
/**
 * Clears all data on-screen in text fields,
 * text-area's, and date-picker's.
 *
 * @param event The action event.
 */
@FXML
public void handleClearButton(final ActionEvent event) {
    Object[] o = userDataGroup.getChildren().toArray();
    for (int i = 0; i < o.length; i++) {
        if (o[i] instanceof TextField) {
            ((TextField) o[i]).clear();
        } else if (o[i] instanceof TextArea) {
            ((TextArea) o[i]).clear();
        } else if (o[i] instanceof DatePicker) {
            ((DatePicker) o[i]).setValue(null);
        }
    }
    selectAParkDropDownMenu.setValue(null);
    enterYear.setValue(null);
    enterMonth.setValue(null);
    resetValidation();
}
项目:dominoes    文件:ProjectInfoPane.java   
private void UpdateDatePicker(){
    Callback<DatePicker, DateCell> dayCellFactory = dp -> new DateCell()
       {
           @Override
           public void updateItem(LocalDate item, boolean empty)
           {
               super.updateItem(item, empty);

               if(item.isBefore(Instant.ofEpochMilli(repoBeginDate.getTime()).atZone(ZoneId.systemDefault()).toLocalDate()) 
                    || item.isAfter(Instant.ofEpochMilli(repoEndDate.getTime()).atZone(ZoneId.systemDefault()).toLocalDate()))
               {
                   setStyle("-fx-background-color: #ffc0cb;");
                   setDisable(true);

                   /* When Hijri Dates are shown, setDisable() doesn't work. Here is a workaround */
                 //  addEventFilter(MouseEvent.MOUSE_CLICKED, e -> e.consume());
               }


           }
       };

       beginDate.setDayCellFactory(dayCellFactory);
       endDate.setDayCellFactory(dayCellFactory);
}
项目:marathonv5    文件:JavaFXElementFactory.java   
public static void reset() {
    add(Node.class, JavaFXElement.class);
    add(TextInputControl.class, JavaFXTextInputControlElement.class);
    add(HTMLEditor.class, JavaFXHTMLEditor.class);
    add(CheckBox.class, JavaFXCheckBoxElement.class);
    add(ToggleButton.class, JavaFXToggleButtonElement.class);
    add(Slider.class, JavaFXSliderElement.class);
    add(Spinner.class, JavaFXSpinnerElement.class);
    add(SplitPane.class, JavaFXSplitPaneElement.class);
    add(ProgressBar.class, JavaFXProgressBarElement.class);
    add(ChoiceBox.class, JavaFXChoiceBoxElement.class);
    add(ColorPicker.class, JavaFXColorPickerElement.class);
    add(ComboBox.class, JavaFXComboBoxElement.class);
    add(DatePicker.class, JavaFXDatePickerElement.class);
    add(TabPane.class, JavaFXTabPaneElement.class);
    add(ListView.class, JavaFXListViewElement.class);
    add(TreeView.class, JavaFXTreeViewElement.class);
    add(TableView.class, JavaFXTableViewElement.class);
    add(TreeTableView.class, JavaFXTreeTableViewElement.class);
    add(CheckBoxListCell.class, JavaFXCheckBoxListCellElement.class);
    add(ChoiceBoxListCell.class, JavaFXChoiceBoxListCellElement.class);
    add(ComboBoxListCell.class, JavaFXComboBoxListCellElemnt.class);
    add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class);
    add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxTreeCellElement.class);
    add(ComboBoxTreeCell.class, JavaFXComboBoxTreeCellElement.class);
    add(TableCell.class, JavaFXTableViewCellElement.class);
    add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class);
    add(ChoiceBoxTableCell.class, JavaFXChoiceBoxTableCellElement.class);
    add(ComboBoxTableCell.class, JavaFXComboBoxTableCellElemnt.class);
    add(TreeTableCell.class, JavaFXTreeTableCellElement.class);
    add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class);
    add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxTreeTableCell.class);
    add(ComboBoxTreeTableCell.class, JavaFXComboBoxTreeTableCell.class);
}
项目:marathonv5    文件:JavaFXDatePickerElement.java   
@Override public boolean marathon_select(String value) {
    DatePicker datePicker = (DatePicker) getComponent();
    if (!value.equals("")) {
        try {
            LocalDate date = datePicker.getConverter().fromString(value);
            datePicker.setValue(date);
        } catch (Throwable t) {
            throw new DateTimeException("Invalid value for '" + value + "' for date-picker '");
        }
        return true;
    }
    return false;
}
项目:marathonv5    文件:DatePickerSample.java   
public DatePickerSample() {
    HBox hBox = new HBox();
    hBox.setSpacing(15);

    DatePicker uneditableDatePicker = new DatePicker();
    uneditableDatePicker.setEditable(false);

    DatePicker editablDatePicker = new DatePicker();
    editablDatePicker.setPromptText("Edit or Pick...");
    hBox.getChildren().addAll(uneditableDatePicker, editablDatePicker);
    getChildren().add(hBox);
}
项目:marathonv5    文件:RFXDatePicker.java   
@Override public void focusGained(RFXComponent prev) {
    DatePicker datePicker = (DatePicker) node;
    LocalDate value = datePicker.getValue();
    if (value == null && datePicker.isEditable()) {
        prevDate = datePicker.getEditor().getText();
    } else {
        prevDate = getDatePickerText(datePicker, value);
    }
}
项目:marathonv5    文件:RFXDatePicker.java   
@Override public void focusLost(RFXComponent next) {
    DatePicker datePicker = (DatePicker) node;
    LocalDate value = datePicker.getValue();
    String currentDate;
    if (value == null && datePicker.isEditable()) {
        currentDate = datePicker.getEditor().getText();
    } else {
        currentDate = getDatePickerText(datePicker, value);
    }
    if (!currentDate.equals(prevDate))
        recorder.recordSelect(this, currentDate);
}
项目:marathonv5    文件:RFXDatePickerTest.java   
@Test public void pickDate() {
    DatePicker datePicker = (DatePicker) getPrimaryStage().getScene().getRoot().lookup(".date-picker");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        RFXDatePicker rfxDatePicker = new RFXDatePicker(datePicker, null, null, lr);
        datePicker.setValue(LocalDate.now());
        rfxDatePicker.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    LocalDate date = (LocalDate) datePicker.getChronology().date(LocalDate.now());
    AssertJUnit.assertEquals(datePicker.getConverter().toString(date), recording.getParameters()[0]);
}
项目:openjfx-8u-dev-tests    文件:DatePickerAppManual.java   
public DatePickerScene() {
    super(new VBox(10), 300, 300);

    final DatePicker datePicker = new DatePicker();

    ComboBox comboBox = new ComboBox();
    comboBox.getItems().addAll(Chronology.getAvailableChronologies());
    comboBox.valueProperty().addListener(new ChangeListener<Chronology>() {
        public void changed(ObservableValue<? extends Chronology> ov, Chronology t, Chronology t1) {
            datePicker.setChronology(t1);
        }
    });

    ((VBox) getRoot()).getChildren().addAll(datePicker, comboBox);
}
项目:openjfx-8u-dev-tests    文件:DatePickerApp.java   
public DateCell call(DatePicker param) {
    return new DateCell() {

        @Override
        public void updateItem(LocalDate item, boolean empty) {
            super.updateItem(item, empty);

            if (isRestricted(item)) {
                setStyle("-fx-background-color: #ff4444;");
                setDisable(true);
            }
        }
    };
}
项目:openjfx-8u-dev-tests    文件:TestBase.java   
void setDayCellFactory(Callback<DatePicker, DateCell> dayCellFactory) {
    new GetAction<Void>() {
        @Override public void run(Object... parameters) throws Exception {
            testedControl.getControl().setDayCellFactory((Callback<DatePicker, DateCell>) parameters[0]);
        }
    }.dispatch(testedControl.getEnvironment(), dayCellFactory);
}
项目:openjfx-8u-dev-tests    文件:TestBase.java   
Callback<DatePicker, DateCell> getDayCellFactory() {
    return new GetAction<Callback<DatePicker, DateCell>>() {
        @Override public void run(Object... parameters) throws Exception {
            setResult(testedControl.getControl().getDayCellFactory());
        }
    }.dispatch(testedControl.getEnvironment());
}
项目:openjfx-8u-dev-tests    文件:DatePickerTest.java   
/**
 * Checks that disabled DateCell can't be selected and
 * that state doesn't change after.
 */
@Test(timeout = 10000)
public void daysRestriction() throws InterruptedException {
    rememberInitialState(Properties.showing, Properties.hover, Properties.pressed, Properties.armed);

    final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() {
        public DateCell call(DatePicker param) { return new DateCell(); }
    };
    setDayCellFactory(dayCellFactory);
    assertSame(dayCellFactory, getDayCellFactory());

    selectObjectFromChoiceBox(SettingType.BIDIRECTIONAL, Properties.dayCellFactory, WorkingDays.class);
    setDate(LocalDate.of(2020, 10, 31));
    clickDropDownButton();
    waitPopupShowingState(true);

    PopupSceneDescription description = new PopupSceneDescription();
    description.extractData();
    Wrap<? extends DateCell> cellWrap = description.currentMonthDays.get(24);
    DateCellDescription cell = new DateCellDescription(cellWrap);
    assertEquals("[Selected wrong day]", 25, cell.mainDate);

    cellWrap.mouse().click();
    waitPopupShowingState(true);

    HashMap<String, String> expectedState = new HashMap<String, String>(2);
    expectedState.put("selectedDay", "31");
    expectedState.put("monthName", "October");
    expectedState.put("year", "2020");
    testedControl.waitState(new DateState(expectedState, description));
    waitShownText("10/31/2020");

    testedControl.keyboard().pushKey(KeyboardButtons.ESCAPE);
    setDate(LocalDate.of(2020, Month.OCTOBER, 25));
    checkFinalState();
}
项目:openjfx-8u-dev-tests    文件:DatePickerTest.java   
/**
 * Check value of the 'showing' property.
 */
@Test(timeout = 20000)
public void showingProperty() throws InterruptedException {
    assertFalse(new GetAction<Boolean>() {
        @Override public void run(Object... parameters) throws Exception {
            setResult(new DatePicker().showingProperty().getValue());
        }
    }.dispatch(testedControl.getEnvironment()).booleanValue());

    rememberInitialState(Properties.showing, Properties.hover, Properties.pressed, Properties.armed);

    clickDropDownButton();
    waitPopupShowingState(true);

    clickDropDownButton();
    waitPopupShowingState(false);

    testedControl.mouse().click();
    waitPopupShowingState(false);

    Object[][] keyCombinations = {
        {KeyboardButtons.F4},
        {KeyboardButtons.DOWN, KeyboardModifiers.ALT_DOWN_MASK},
        {KeyboardButtons.UP, KeyboardModifiers.ALT_DOWN_MASK}
    };

    for(Object[] keyCombo : keyCombinations) {
        System.out.println(Arrays.toString(keyCombo));
        if (keyCombo.length == 1) {
            testedControl.keyboard().pushKey((KeyboardButton) keyCombo[0]);
        } else {
            testedControl.keyboard().pushKey((KeyboardButton) keyCombo[0], (Modifier) keyCombo[1]);
        }
        waitPopupShowingState(true);
        testedControl.keyboard().pushKey(KeyboardButtons.ESCAPE);
        waitPopupShowingState(false);
    }

    checkFinalState();
}
项目:factoryfx    文件:LocalDateAttributeVisualisation.java   
@Override
public Node createVisualisation(SimpleObjectProperty<LocalDate> boundTo, boolean readonly) {
    DatePicker datePicker = new DatePicker();
    datePicker.valueProperty().bindBidirectional(boundTo);
    datePicker.setEditable(!readonly);
    return datePicker;
}
项目:factoryfx    文件:LocalDateTimeAttributeVisualisation.java   
@Override
public Node createVisualisation(SimpleObjectProperty<LocalDateTime> boundTo, boolean readonly) {
    HBox controls = new HBox(3);
    controls.setOpaqueInsets(new Insets(0,3,0,3));
    DatePicker datePicker = new DatePicker();
    datePicker.valueProperty().addListener((observable, oldValue, newValue) -> {
        updateDatePart(boundTo,newValue);
    });
    TextField timeField = new TextField();
    TypedTextFieldHelper.setupLocalTimeTextField(timeField);
    timeField.textProperty().addListener((observable, oldValue, newValue) -> {
        updateTimePart(boundTo,newValue);
    });
    controls.getChildren().addAll(datePicker,timeField);
    boundTo.addListener((observable, oldValue, newValue) -> {
        updateDatePicker(datePicker,newValue);
        updateTimeField(timeField,newValue);
    });
    Optional.ofNullable(boundTo.getValue()).ifPresent(newValue-> {
        updateDatePicker(datePicker, newValue);
        updateTimeField(timeField, newValue);
    });

    datePicker.setEditable(!readonly);
    timeField.setEditable(!readonly);
    return controls;
}
项目:factoryfx    文件:LocalDateTimeAttributeVisualisation.java   
private void updateDatePicker(DatePicker datePicker, LocalDateTime newValue) {
    if (newValue == null) {
        if (datePicker.getValue() != null)
            datePicker.setValue(null);
        return;
    }
    LocalDate current = datePicker.getValue();
    if (current != null && current.equals(newValue.toLocalDate()))
        return;
    datePicker.setValue(newValue.toLocalDate());
}
项目:drbookings    文件:BookingDetailsController.java   
private void addRow5(final Pane content, final Booking be) {
    final HBox box = new HBox();
    box.setPadding(new Insets(4));
    box.setFillHeight(true);
    final Text t0 = new Text("Welcome Mail sent: ");
    final CheckBox cb0 = new CheckBox();
    cb0.setSelected(be.isWelcomeMailSend());
    booking2WelcomeMail.put(be, cb0);
    final Text t1 = new Text(" \tPayment done: ");

    final CheckBox cb1 = new CheckBox();
    cb1.setSelected(be.isPaymentDone());

    //if (logger.isDebugEnabled()) {
    //  logger.debug("DateOfPayment for " + be + "(" + be.hashCode() + ") is " + be.getDateOfPayment());
    //}

    final DatePicker dp = new DatePicker();
    dp.setValue(be.getDateOfPayment());

    dp.setPrefWidth(140);
    booking2PaymentDate.put(be, dp);

    booking2Payment.put(be, cb1);
    final TextFlow tf = new TextFlow();
    tf.getChildren().addAll(t0, cb0, t1, cb1, dp);
    box.getChildren().add(tf);
    if (!be.isWelcomeMailSend() || !be.isPaymentDone()) {
        box.getStyleClass().addAll("warning", "warning-bg");
    } else {
        box.getStyleClass().removeAll("warning", "warning-bg");
    }
    content.getChildren().add(box);

}
项目:JFoenix    文件:DatePickerDemo.java   
@Override
public void start(Stage stage) {

    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);


    DatePicker datePicker = new DatePicker();

    main.getChildren().add(datePicker);
    JFXDatePicker datePickerFX = new JFXDatePicker();

    main.getChildren().add(datePickerFX);
    datePickerFX.setPromptText("pick a date");
    JFXTimePicker blueDatePicker = new JFXTimePicker();
    blueDatePicker.setDefaultColor(Color.valueOf("#3f51b5"));
    blueDatePicker.setOverLay(true);
    main.getChildren().add(blueDatePicker);


    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    pane.setStyle("-fx-background-color:WHITE");

    final Scene scene = new Scene(pane, 400, 700);
    final ObservableList<String> stylesheets = scene.getStylesheets();
    stylesheets.addAll(MainDemo.class.getResource("/css/jfoenix-fonts.css").toExternalForm(),
                       MainDemo.class.getResource("/css/jfoenix-design.css").toExternalForm());
    stage.setTitle("JFX Date Picker Demo");
    stage.setScene(scene);
    stage.show();

}
项目:JFoenix    文件:JFXDatePickerBehavior.java   
/**************************************************************************
 *                                                                        *
 * Mouse Events handling (when losing focus)                              *
 *                                                                        *
 *************************************************************************/

@Override
public void onAutoHide() {
    DatePicker datePicker = (DatePicker) getControl();
    JFXDatePickerSkin cpSkin = (JFXDatePickerSkin) datePicker.getSkin();
    cpSkin.syncWithAutoUpdate();
    if (!datePicker.isShowing()) {
        super.onAutoHide();
    }
}
项目:JFoenix    文件:JFXDatePicker.java   
@Override
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
    if (STYLEABLES == null) {
        final List<CssMetaData<? extends Styleable, ?>> styleables =
            new ArrayList<>(Control.getClassCssMetaData());
        styleables.addAll(getClassCssMetaData());
        styleables.addAll(DatePicker.getClassCssMetaData());
        STYLEABLES = Collections.unmodifiableList(styleables);
    }
    return STYLEABLES;
}
项目:roda-in    文件:InspectionPane.java   
private DatePicker createFormDatePicker(TemplateFieldValue metadataValue) {
  DateTimeFormatter formatter = DateTimeFormatter.ofPattern(Constants.DATE_FORMAT_4);
  LocalDateStringConverter ldsc = new LocalDateStringConverter(formatter, null);

  String currentValue = metadataValue.get("value") != null ? (String) metadataValue.get("value") : "";

  LocalDate date = null;
  try {
    date = ldsc.fromString(currentValue);
  } catch (DateTimeParseException e) {
    // maybe because of {{mixed}}
  }
  DatePicker datePicker = new DatePicker(date);
  datePicker.setMaxWidth(Double.MAX_VALUE);
  datePicker.setConverter(new StringConverter<LocalDate>() {
    private DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(Constants.DATE_FORMAT_4);

    @Override
    public String toString(LocalDate localDate) {
      if (localDate == null)
        return "";
      return dateTimeFormatter.format(localDate);
    }

    @Override
    public LocalDate fromString(String dateString) {
      if (dateString == null || dateString.trim().isEmpty())
        return null;
      return LocalDate.parse(dateString, dateTimeFormatter);
    }
  });
  datePicker.valueProperty()
    .addListener((observable, oldValue, newValue) -> metadataValue.set("value", ldsc.toString(newValue)));
  addListenersToUpdateUI(metadataValue, datePicker.valueProperty());
  return datePicker;
}
项目:SimpleTaskList    文件:NewEditDialogController.java   
/**
 * Initialize a date picker with a date. If the date has the minimum value no date is set.
 *
 * @param picker The date picker component to initialize
 * @param value The date to be set in the picker
 */
private void initDatePicker(final DatePicker picker, final LocalDate value) {
    if (value.equals(LocalDate.MIN)) {
        picker.setValue(null);
    } else {
        picker.setValue(value);
    }
}
项目:Cachoeira    文件:TaskInformationModuleController.java   
private DateCell makeStartDatePickerCellsDisabled(DatePicker datePicker) {
    return new DateCell() {
        @Override
        public void updateItem(LocalDate startDate, boolean empty) {
            super.updateItem(startDate, empty);
            if (startDate.isBefore(controller.getProject().getStartDate())) {
                setDisable(true);
            }
            if (startDate.isEqual(controller.getProject().getFinishDate()) || startDate.isAfter(controller.getProject().getFinishDate())) {
                setDisable(true);
            }
        }
    };
}
项目:Cachoeira    文件:TaskInformationModuleController.java   
private DateCell makeFinishDatePickerCellsDisabled(DatePicker datePicker) {
    return new DateCell() {
        @Override
        public void updateItem(LocalDate finishDate, boolean empty) {
            super.updateItem(finishDate, empty);
            if (finishDate.isBefore(module.getStartDatePicker().getValue().plusDays(1))) {
                setDisable(true);
            }
            if (finishDate.isEqual(controller.getProject().getFinishDate().plusDays(1)) || finishDate.isAfter(controller.getProject().getFinishDate().plusDays(1))) {
                setDisable(true);
            }
        }
    };
}
项目:Cachoeira    文件:ProjectInformationModuleController.java   
private DateCell makeFinishDatePickerCellsDisabledBeforeStartDate(DatePicker datePicker) {
    return new DateCell() {
        @Override
        public void updateItem(LocalDate finishDate, boolean empty) {
            super.updateItem(finishDate, empty);
            if (finishDate.isBefore(module.getStartDatePicker().getValue().plusDays(1))) {
                setDisable(true);
            }
        }
    };
}
项目:bgfinancas    文件:Validar.java   
public static void datePicker(DatePicker campo) throws Erro{
    if(campo.getValue() == null){
        Janela.showTooltip(Status.ADVERTENCIA, idioma.getMensagem("campo_nao_informado"), campo, Duracao.CURTA);
        campo.requestFocus();
        throw new Erro();
    }
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetDatePickerAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(DatePicker.class);

    assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}