@Test public void selectEditableListSpinner() { IJavaFXElement spinner = driver.findElementByName("list-spinner"); Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#list-spinner"); Platform.runLater(() -> { spinnerNode.setEditable(true); spinner.marathon_select("December"); }); new Wait("Waiting for spinner to set value") { @Override public boolean until() { Object value = spinnerNode.getValue(); return value.toString().equals("December"); } }; }
@SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { Spinner<?> spinner = (Spinner<?>) getComponent(); if (!spinner.isEditable()) { @SuppressWarnings("rawtypes") SpinnerValueFactory factory = ((Spinner<?>) getComponent()).getValueFactory(); Object convertedValue = factory.getConverter().fromString(value); factory.setValue(convertedValue); return true; } TextField spinnerEditor = spinner.getEditor(); if (spinnerEditor == null) { throw new JavaAgentException("Null value returned by getEditor() on spinner", null); } IJavaFXElement ele = JavaFXElementFactory.createElement(spinnerEditor, driver, window); spinnerEditor.getProperties().put("marathon.celleditor", true); ele.marathon_select(value); return true; }
JavaFXSpinnerElement extends JavaFXElement { @SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { Spinner<?> spinner = (Spinner<?>) getComponent(); if (!spinner.isEditable()) { @SuppressWarnings("rawtypes") SpinnerValueFactory factory = ((Spinner<?>) getComponent()).getValueFactory(); Object convertedValue = factory.getConverter().fromString(value); factory.setValue(convertedValue); return true; } TextField spinnerEditor = spinner.getEditor(); if (spinnerEditor == null) { throw new JavaAgentException("Null value returned by getEditor() on spinner", null); } IJavaFXElement ele = JavaFXElementFactory.createElement(spinnerEditor, driver, window); spinnerEditor.getProperties().put("marathon.celleditor", true); ele.marathon_select(value); return true; } }
JavaFXSpinnerElement extends JavaFXElement { @SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { Spinner<?> spinner = (Spinner<?>) getComponent(); if (!spinner.isEditable()) { @SuppressWarnings("rawtypes") SpinnerValueFactory factory = ((Spinner<?>) getComponent()).getValueFactory(); Object convertedValue = factory.getConverter().fromString(value); factory.setValue(convertedValue); return true; } TextField spinnerEditor = spinner.getEditor(); if (spinnerEditor == null) { throw new JavaAgentException("Null value returned by getEditor() on spinner", null); } IJavaFXElement ele = JavaFXElementFactory.createElement(spinnerEditor, driver, window); spinnerEditor.getProperties().put("marathon.celleditor", true); ele.marathon_select(value); return true; } JavaFXSpinnerElement(Node component, IJavaFXAgent driver, JFXWindow window); }
JavaFXSpinnerElement extends JavaFXElement { @SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { Spinner<?> spinner = (Spinner<?>) getComponent(); if (!spinner.isEditable()) { @SuppressWarnings("rawtypes") SpinnerValueFactory factory = ((Spinner<?>) getComponent()).getValueFactory(); Object convertedValue = factory.getConverter().fromString(value); factory.setValue(convertedValue); return true; } TextField spinnerEditor = spinner.getEditor(); if (spinnerEditor == null) { throw new JavaAgentException("Null value returned by getEditor() on spinner", null); } IJavaFXElement ele = JavaFXElementFactory.createElement(spinnerEditor, driver, window); spinnerEditor.getProperties().put("marathon.celleditor", true); ele.marathon_select(value); return true; } JavaFXSpinnerElement(Node component, IJavaFXAgent driver, JFXWindow window); @SuppressWarnings("unchecked") @Override boolean marathon_select(String value); @Override List<IJavaFXElement> getByPseudoElement(String selector, Object[] params); @Override String _getText(); }
JavaFXSpinnerElement extends JavaFXElement { @SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { Spinner<?> spinner = (Spinner<?>) getComponent(); if (!spinner.isEditable()) { @SuppressWarnings("rawtypes") SpinnerValueFactory factory = ((Spinner<?>) getComponent()).getValueFactory(); Object convertedValue = factory.getConverter().fromString(value); factory.setValue(convertedValue); return true; } TextField spinnerEditor = spinner.getEditor(); if (spinnerEditor == null) { throw new JavaAgentException("Null value returned by getEditor() on spinner", null); } IJavaFXElement ele = JavaFXElementFactory.createElement(spinnerEditor, driver, window); spinnerEditor.getProperties().put("marathon.celleditor", true); ele.marathon_select(value); return true; } JavaFXSpinnerElement(Node component, IJavaFXAgent driver, JFXWindow window); @SuppressWarnings("unchecked") @Override boolean marathon_select(String value); @Override List<IJavaFXElement> getByPseudoElement(String selector, Object[] params); @Override String _getText(); static final Logger LOGGER; }