@Test public void selectOptionWithQuotes() { @SuppressWarnings("unchecked") ChoiceBox<String> choiceBox = (ChoiceBox<String>) getPrimaryStage().getScene().getRoot().lookup(".choice-box"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { RFXChoiceBox rfxChoiceBox = new RFXChoiceBox(choiceBox, null, null, lr); choiceBox.getItems().add(" \"Mouse \" "); choiceBox.getSelectionModel().select(" \"Mouse \" "); rfxChoiceBox.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals(" \"Mouse \" ", recording.getParameters()[0]); }
@Override public void focusLost(RFXComponent next) { ChoiceBox<?> choiceBox = (ChoiceBox<?>) node; Object selectedItem = choiceBox.getSelectionModel().getSelectedItem(); if (selectedItem != null && selectedItem.equals(prevSelectedItem)) { return; } String text = getChoiceBoxText(choiceBox, choiceBox.getSelectionModel().getSelectedIndex()); if (text != null) { recorder.recordSelect(this, text); } }
RFXChoiceBox extends RFXComponent { @Override public void focusLost(RFXComponent next) { ChoiceBox<?> choiceBox = (ChoiceBox<?>) node; Object selectedItem = choiceBox.getSelectionModel().getSelectedItem(); if (selectedItem != null && selectedItem.equals(prevSelectedItem)) { return; } String text = getChoiceBoxText(choiceBox, choiceBox.getSelectionModel().getSelectedIndex()); if (text != null) { recorder.recordSelect(this, text); } } }
RFXChoiceBox extends RFXComponent { @Override public void focusLost(RFXComponent next) { ChoiceBox<?> choiceBox = (ChoiceBox<?>) node; Object selectedItem = choiceBox.getSelectionModel().getSelectedItem(); if (selectedItem != null && selectedItem.equals(prevSelectedItem)) { return; } String text = getChoiceBoxText(choiceBox, choiceBox.getSelectionModel().getSelectedIndex()); if (text != null) { recorder.recordSelect(this, text); } } RFXChoiceBox(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder); }
RFXChoiceBox extends RFXComponent { @Override public void focusLost(RFXComponent next) { ChoiceBox<?> choiceBox = (ChoiceBox<?>) node; Object selectedItem = choiceBox.getSelectionModel().getSelectedItem(); if (selectedItem != null && selectedItem.equals(prevSelectedItem)) { return; } String text = getChoiceBoxText(choiceBox, choiceBox.getSelectionModel().getSelectedIndex()); if (text != null) { recorder.recordSelect(this, text); } } RFXChoiceBox(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder); @Override void focusGained(RFXComponent prev); @Override void focusLost(RFXComponent next); @Override String _getText(); }
RFXChoiceBox extends RFXComponent { @Override public void focusLost(RFXComponent next) { ChoiceBox<?> choiceBox = (ChoiceBox<?>) node; Object selectedItem = choiceBox.getSelectionModel().getSelectedItem(); if (selectedItem != null && selectedItem.equals(prevSelectedItem)) { return; } String text = getChoiceBoxText(choiceBox, choiceBox.getSelectionModel().getSelectedIndex()); if (text != null) { recorder.recordSelect(this, text); } } RFXChoiceBox(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; }