@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]); }
@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; }