@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]); }
@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); }
RFXDatePicker extends RFXComponent { @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); } }
RFXDatePicker extends RFXComponent { @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); } RFXDatePicker(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder); }
RFXDatePicker extends RFXComponent { @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); } RFXDatePicker(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder); @Override void focusGained(RFXComponent prev); @Override void focusLost(RFXComponent next); @Override String _getText(); }
RFXDatePicker extends RFXComponent { @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); } RFXDatePicker(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder); @Override void focusGained(RFXComponent prev); @Override void focusLost(RFXComponent next); @Override String _getText(); static final Logger LOGGER; }