javafx.scene.control.Spinner Java Examples
The following examples show how to use
javafx.scene.control.Spinner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaFXSpinnerElementTest.java From marathonv5 with Apache License 2.0 | 7 votes |
@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"); } }; }
Example #2
Source File: GemsPanel_Controller.java From Path-of-Leveling with MIT License | 7 votes |
@Override public void initialize(URL url, ResourceBundle rb) { // TODO rootPane.setVisible(false); /* Initializes the controller class. */ /** * Initializes the controller class. */ SpinnerValueFactory<Integer> valueFactoryFrom = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 100, 1); SpinnerValueFactory<Integer> valueFactoryUntil = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 100, 1); fromLevel.setValueFactory(valueFactoryFrom); fromLevel.setStyle(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); untilLevel.setValueFactory(valueFactoryUntil); untilLevel.setStyle(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); fromLevel.setEditable(true); untilLevel.setEditable(true); Util.addIntegerLimiterToIntegerSpinner(fromLevel, valueFactoryFrom); Util.addIntegerLimiterToIntegerSpinner(untilLevel, valueFactoryUntil); valueFactoryFrom.valueProperty().addListener((arg0, arg1, arg2) -> groupSliderChange(fromLevel.getValue(),0)); valueFactoryUntil.valueProperty().addListener((arg0, arg1, arg2) -> groupSliderChange(untilLevel.getValue(),1)); }
Example #3
Source File: SpinnerTableCell.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
public SpinnerTableCell(TableColumn<T, Integer> column, int min, int max) { spinner = new Spinner<>(min, max, 1); spinner.editableProperty().bind(column.editableProperty()); spinner.disableProperty().bind(column.editableProperty().not()); tableRowProperty().addListener(e -> { TableRow<?> row = getTableRow(); if (row == null) return; MsSpectrumDataSet dataSet = (MsSpectrumDataSet) row.getItem(); if (dataSet == null) return; spinner.getValueFactory().valueProperty().bindBidirectional(dataSet.lineThicknessProperty()); disableProperty().bind(dataSet.renderingTypeProperty().isEqualTo(MsSpectrumType.CENTROIDED)); }); }
Example #4
Source File: JavaFXSpinnerElementTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void listSpinnerWithInvalidValue() { IJavaFXElement spinner = driver.findElementByName("list-spinner"); Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#list-spinner"); Platform.runLater(() -> { spinnerNode.setEditable(true); spinner.marathon_select("Decem"); }); new Wait("Spinner was not reset.") { @Override public boolean until() { Object value = spinnerNode.getValue(); return value.toString().equals("January"); } }; }
Example #5
Source File: JavaFXSpinnerElement.java From marathonv5 with Apache License 2.0 | 6 votes |
@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; }
Example #6
Source File: JavaFXSpinnerElementTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void selectDoubleSpinner() { IJavaFXElement spinner = driver.findElementByName("double-spinner"); Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#double-spinner"); Platform.runLater(() -> { spinnerNode.setEditable(false); spinner.marathon_select("38.9"); }); new Wait("Waiting for spinner to set value") { @Override public boolean until() { Double value = (Double) spinnerNode.getValue(); return value == 38.9; } }; }
Example #7
Source File: NumericSpinner.java From beatoraja with GNU General Public License v3.0 | 6 votes |
private void commitEditorText(Spinner<T> spinner) { if (!spinner.isEditable()) { return; } String text = spinner.getEditor().getText(); SpinnerValueFactory<T> valueFactory = spinner.getValueFactory(); if (valueFactory != null) { StringConverter<T> converter = valueFactory.getConverter(); if (converter != null) { try { T value = converter.fromString(text); setValue(valueFactory, value); } catch (Exception e) { spinner.getEditor().setText(valueFactory.getValue().toString()); } } } }
Example #8
Source File: RFXSpinnerTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void getText() { Spinner<?> spinner = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup(".spinner"); LoggingRecorder lr = new LoggingRecorder(); List<String> text = new ArrayList<>(); Platform.runLater(() -> { RFXSpinner rfxSpinner = new RFXSpinner(spinner, null, null, lr); spinner.getEditor().setText("March"); rfxSpinner.focusLost(null); text.add(rfxSpinner.getAttribute("text")); }); new Wait("Waiting for spinner text.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("March", text.get(0)); }
Example #9
Source File: FormPane.java From marathonv5 with Apache License 2.0 | 6 votes |
private void setFormConstraints(Node field) { if (field instanceof ISetConstraints) { ((ISetConstraints) field).setFormConstraints(this); } else if (field instanceof Button) { _setFormConstraints((Button) field); } else if (field instanceof TextField) { _setFormConstraints((TextField) field); } else if (field instanceof TextArea) { _setFormConstraints((TextArea) field); } else if (field instanceof ComboBox<?>) { _setFormConstraints((ComboBox<?>) field); } else if (field instanceof ChoiceBox<?>) { _setFormConstraints((ChoiceBox<?>) field); } else if (field instanceof CheckBox) { _setFormConstraints((CheckBox) field); } else if (field instanceof Spinner<?>) { _setFormConstraints((Spinner<?>) field); } else if (field instanceof VBox) { _setFormConstraints((VBox) field); } else if (field instanceof Label) { _setFormConstraints((Label) field); } else { LOGGER.info("FormPane.setFormConstraints(): unknown field type: " + field.getClass().getName()); } }
Example #10
Source File: SpinnerTableCell.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
public SpinnerTableCell(TableColumn<T, Integer> column, int min, int max) { spinner = new Spinner<>(min, max, 1); spinner.editableProperty().bind(column.editableProperty()); spinner.disableProperty().bind(column.editableProperty().not()); tableRowProperty().addListener(e -> { TableRow<?> row = getTableRow(); if (row == null) return; ChromatogramPlotDataSet dataSet = (ChromatogramPlotDataSet) row.getItem(); if (dataSet == null) return; spinner.getValueFactory().valueProperty().bindBidirectional(dataSet.lineThicknessProperty()); }); }
Example #11
Source File: SpinnerSample.java From marathonv5 with Apache License 2.0 | 6 votes |
private Spinner<Object> createListSpinner() { Spinner<Object> spinner = new Spinner<>(); spinner.setId("list-spinner"); List<Object> names = new ArrayList<Object>(); names.add("January"); names.add("February"); names.add("March"); names.add("April"); names.add("May"); names.add("June"); names.add("July"); names.add("August"); names.add("September"); names.add("October"); names.add("November"); names.add("December"); spinner.setValueFactory(new SpinnerValueFactory.ListSpinnerValueFactory<Object>(FXCollections.observableArrayList(names))); return spinner; }
Example #12
Source File: ShapePropertyCustomiser.java From latexdraw with GNU General Public License v3.0 | 6 votes |
protected void addSpinnerAnglePropBinding(final @NotNull Spinner<Double> spinner, final @NotNull ShapeProperties<Double> prop) { final var spinnerBaseBinder = spinnerBinder() .on(spinner) .end(() -> update()); spinnerBaseBinder .toProduce(() -> createModShProp(null, prop)) .then((i, c) -> c.setValue(Math.toRadians((Double) i.getWidget().getValue()))) .when(handActiv) .bind(); spinnerBaseBinder .toProduce(() -> firstPropPen(null, prop)) .then((i, c) -> c.setValue(Math.toRadians((Double) i.getWidget().getValue()))) .when(pencilActiv) .bind(); }
Example #13
Source File: ShapePropertyCustomiser.java From latexdraw with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("unchecked") protected <T extends Number> void addSpinnerPropBinding(final @NotNull Spinner<T> spinner, final @NotNull ShapeProperties<T> prop) { final var spinnerBaseBinder = spinnerBinder() .on(spinner) .end(() -> update()); spinnerBaseBinder .toProduce(() -> createModShProp(null, prop)) .then((i, c) -> c.setValue((T) i.getWidget().getValue())) .when(handActiv) .bind(); spinnerBaseBinder .toProduce(() -> firstPropPen(null, prop)) .then((i, c) -> c.setValue((T) i.getWidget().getValue())) .when(pencilActiv) .bind(); }
Example #14
Source File: ShapePropertyCustomiser.java From latexdraw with GNU General Public License v3.0 | 6 votes |
protected void addSpinnerXYPropBinding(final @NotNull Spinner<Double> spinnerX, final @NotNull Spinner<Double> spinnerY, final @NotNull ShapeProperties<Point> property) { final var baseBinder = spinnerBinder() .on(spinnerX, spinnerY) .end(() -> update()); baseBinder .toProduce(() -> new ModifyShapeProperty<>(property, canvas.getDrawing().getSelection().duplicateDeep(false), null)) .then(c -> c.setValue(ShapeFactory.INST.createPoint(spinnerX.getValue(), spinnerY.getValue()))) .when(handActiv) .bind(); baseBinder .toProduce(() -> new ModifyEditingParameter<>(property, editing, null)) .then(c -> c.setValue(ShapeFactory.INST.createPoint(spinnerX.getValue(), spinnerY.getValue()))) .when(pencilActiv) .bind(); }
Example #15
Source File: TestCanvasSelection.java From latexdraw with GNU General Public License v3.0 | 6 votes |
@Test public void testEditPlotDoesNotCreateANewOne() { when(editing.getCurrentChoice()).thenReturn(EditionChoice.PLOT); when(editing.createShapeInstance()).thenReturn(ShapeFactory.INST.createPlot(ShapeFactory.INST.createPoint(), 0, 5, "x", false)); final ShapePlotCustomiser plot = injector.getInstance(ShapePlotCustomiser.class); plot.maxXSpinner = Mockito.mock(Spinner.class); plot.minXSpinner = Mockito.mock(Spinner.class); plot.nbPtsSpinner = Mockito.mock(Spinner.class); when(plot.maxXSpinner.getValue()).thenReturn(10d); when(plot.minXSpinner.getValue()).thenReturn(0d); when(plot.nbPtsSpinner.getValue()).thenReturn(10); Cmds.of(addPlot).execute(); final ViewPlot v = (ViewPlot) canvas.getViews().getChildren().get(0); Cmds.of(() -> doubleClickOn(v), () -> type(KeyCode.DELETE).write("x 2 mul"), () -> type(KeyCode.ENTER)).execute(); assertEquals(1, canvas.getDrawing().size()); assertEquals(1, canvas.getViews().getChildren().size()); }
Example #16
Source File: DateTimePane.java From phoebus with Eclipse Public License 1.0 | 5 votes |
private static Spinner<Integer> createSpinner(final int max, final Spinner<Integer> next) { final Spinner<Integer> spinner = new Spinner<>(0, max, 0); spinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_VERTICAL); spinner.setEditable(true); spinner.setValueFactory(new WraparoundValueFactory(0, max, next == null ? null : next.getValueFactory())); spinner.getValueFactory().setConverter(WraparoundValueFactory.TwoDigitStringConverter); spinner.setPrefWidth(45); return spinner; }
Example #17
Source File: RFXSpinnerTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectListSpinner() { Spinner<?> spinner = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup(".spinner"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { RFXSpinner rfxSpinner = new RFXSpinner(spinner, null, null, lr); spinner.getEditor().setText("March"); rfxSpinner.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("March", recording.getParameters()[0]); }
Example #18
Source File: RFXSpinnerTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectListEditableSpinner() { Spinner<?> spinner = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup(".spinner"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { spinner.setEditable(true); RFXSpinner rfxSpinner = new RFXSpinner(spinner, null, null, lr); spinner.getEditor().setText("April"); rfxSpinner.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("April", recording.getParameters()[0]); }
Example #19
Source File: RFXSpinnerTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectIntegerSpinner() { Spinner<?> spinner = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#integer-spinner"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { RFXSpinner rfxSpinner = new RFXSpinner(spinner, null, null, lr); spinner.getEditor().setText("25"); rfxSpinner.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("25", recording.getParameters()[0]); }
Example #20
Source File: RFXSpinnerTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectDoubleSpinner() { Spinner<?> spinner = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#double-spinner"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { RFXSpinner rfxSpinner = new RFXSpinner(spinner, null, null, lr); spinner.getEditor().setText("35.5"); rfxSpinner.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("35.5", recording.getParameters()[0]); }
Example #21
Source File: MountainRangeRendererSample.java From chart-fx with Apache License 2.0 | 5 votes |
@Override public void start(final Stage primaryStage) { primaryStage.setTitle(this.getClass().getSimpleName()); final DefaultNumericAxis xAxis = new DefaultNumericAxis("X Position"); final DefaultNumericAxis yAxis = new DefaultNumericAxis("Y Position"); final XYChart chart = new XYChart(xAxis, yAxis); chart.setTitle("Test data"); final MountainRangeRenderer mountainRangeRenderer = new MountainRangeRenderer(); chart.getRenderers().set(0, mountainRangeRenderer); // mountainRangeRenderer.getDatasets().add(readImage()); chart.getDatasets().setAll(createTestData(0.0)); // DataSet3D additionalData = createTestData(1.0); // additionalData.setStyle("strokeColor=red"); // chart.getDatasets().add(additionalData); chart.setLegendVisible(true); chart.getPlugins().add(new Zoomer()); chart.getPlugins().add(new Panner()); chart.getPlugins().add(new EditAxis()); final Spinner<Double> mountainRangeOffset = new Spinner<>(0.0, 10.0, mountainRangeRenderer.getMountainRangeOffset(), 0.1); mountainRangeRenderer.mountainRangeOffsetProperty().bind(mountainRangeOffset.valueProperty()); mountainRangeOffset.valueProperty().addListener((ch, o, n) -> { if (n.equals(o)) { return; } chart.requestLayout(); }); final Scene scene = new Scene( new BorderPane(chart, new ToolBar(new Label(""), mountainRangeOffset), null, null, null), 1200, 800); primaryStage.setScene(scene); primaryStage.show(); primaryStage.setOnCloseRequest(evt -> Platform.exit()); }
Example #22
Source File: SpinnerRepresentation.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public void updateChanges() { super.updateChanges(); if (dirty_style.checkAndClear()) { final String color = JFXUtil.webRGB(model_widget.propForegroundColor().getValue()); jfx_node.editorProperty().getValue().setStyle("-fx-text-fill:" + color); final Color background = JFXUtil.convert(model_widget.propBackgroundColor().getValue()); jfx_node.editorProperty().getValue().setBackground(new Background(new BackgroundFill(background, CornerRadii.EMPTY, Insets.EMPTY))); jfx_node.resize(model_widget.propWidth().getValue(), model_widget.propHeight().getValue()); final boolean enabled = model_widget.propEnabled().getValue(); Styles.update(jfx_node, Styles.NOT_ENABLED, !enabled); jfx_node.setEditable(!toolkit.isEditMode() && enabled); int x = jfx_node.getStyleClass().indexOf(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL); if (model_widget.propButtonsOnLeft().getValue()) { if (x < 0) jfx_node.getStyleClass().add(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL); } else if (x > 0) jfx_node.getStyleClass().remove(x); } if (dirty_content.checkAndClear()) { ( (TextSpinnerValueFactory)jfx_node.getValueFactory() ).setVTypeValue(value); jfx_node.getValueFactory().setValue(value_text); } jfx_node.layout(); }
Example #23
Source File: SpinnerDemo.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public void start(final Stage stage) { final Label label = new Label("Demo:"); SpinnerValueFactory<Double> svf = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, 1000); Spinner<Double> spinner = new Spinner<>(); spinner.setValueFactory(svf); spinner.editorProperty().getValue().setStyle("-fx-text-fill:" + "black"); spinner.editorProperty().getValue().setBackground( new Background(new BackgroundFill(Color.AZURE, CornerRadii.EMPTY, Insets.EMPTY))); //spinner.getStyleClass().add(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL); //int x = spinner.getStyleClass().indexOf(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL); //if (x > 0) spinner.getStyleClass().remove(x); spinner.setEditable(true); spinner.setPrefWidth(80); spinner.valueProperty().addListener((prop, old, value) -> { System.out.println("Value: " + value); }); final HBox root = new HBox(label, spinner); final Scene scene = new Scene(root, 800, 700); stage.setScene(scene); stage.setTitle("Spinner Demo"); stage.show(); }
Example #24
Source File: ArraySizePropertyBinding.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** @param panel_section Panel section for array elements * @param undo Undo support * @param node JFX node for array element count * @param widget_property {@link ArrayWidgetProperty} * @param other Widgets that also have this array property */ public ArraySizePropertyBinding(final PropertyPanelSection panel_section, final UndoableActionManager undo, final Spinner<Integer> node, final ArrayWidgetProperty<WidgetProperty<?>> widget_property, final List<Widget> other) { super(undo, node, widget_property, other); this.panel_section = panel_section; }
Example #25
Source File: RFXSpinner.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void focusLost(RFXComponent next) { Spinner<?> spinner = (Spinner<?>) node; String currentValue = getSpinnerText(spinner); if (!currentValue.equals(oldValue)) { recorder.recordSelect(this, currentValue); } }
Example #26
Source File: TemporalAmountPane.java From phoebus with Eclipse Public License 1.0 | 5 votes |
private static Spinner<Integer> createSpinner(final int max, final Spinner<Integer> next) { final Spinner<Integer> spinner = new Spinner<>(0, max, 0); spinner.setEditable(true); spinner.setValueFactory(new WraparoundValueFactory(0, max, next == null ? null : next.getValueFactory())); spinner.getValueFactory().setConverter(WraparoundValueFactory.TwoDigitStringConverter); spinner.getValueFactory().setValue(0); spinner.setPrefWidth(65); return spinner; }
Example #27
Source File: JFXSpinner.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public JFXSpinner(JFXContainer<? extends Region> parent) { super(new Spinner<Integer>(), parent); this.selectionListener = new JFXSelectionListenerChangeManager<Number>(this); this.valueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 100, 0); this.getControl().setValueFactory(this.valueFactory); }
Example #28
Source File: ItemAirBaseController.java From logbook-kai with MIT License | 5 votes |
/** * Spinnerの変更を即座に反映する * * @param spinner Spinner */ private <T> void spinnerHandller(Spinner<T> spinner) { spinner.getEditor().textProperty().addListener((ob, o, n) -> { SpinnerValueFactory<T> f = spinner.getValueFactory(); T value = f.getConverter().fromString("".equals(n) ? "0" : n); if (!value.equals(f.getValue())) { f.setValue(value); } }); }
Example #29
Source File: EditorConfigBean.java From AsciidocFX with Apache License 2.0 | 5 votes |
@Override public VBox createForm() { FXForm editorConfigForm = new FXFormBuilder<>() .resourceBundle(ResourceBundle.getBundle("editorConfig")) .includeAndReorder("editorTheme", "aceTheme", "detachedPreview", "validateDocbook", "fontSize", "scrollSpeed", "useWrapMode", "wrapLimit", "foldStyle", "showGutter", "defaultLanguage", "autoUpdate","showHiddenFiles", "clipboardImageFilePattern", "hangFileSizeLimit", "extensionImageScale") .build(); DefaultFactoryProvider editorConfigFormProvider = new DefaultFactoryProvider(); editorConfigFormProvider.addFactory(new NamedFieldHandler("aceTheme"), new ListChoiceBoxFactory()); editorConfigFormProvider.addFactory(new NamedFieldHandler("editorTheme"), new ListChoiceBoxFactory()); editorConfigFormProvider.addFactory(new NamedFieldHandler("defaultLanguage"), new ListChoiceBoxFactory()); editorConfigFormProvider.addFactory(new NamedFieldHandler("scrollSpeed"), new SliderFactory(SliderBuilt.create(0.0, 1, 0.1).step(0.1))); editorConfigFormProvider.addFactory(new NamedFieldHandler("fontSize"), new SpinnerFactory(new Spinner(8, 32, 14))); editorConfigFormProvider.addFactory(new NamedFieldHandler("wrapLimit"), new SpinnerFactory(new Spinner(0, 500, 0))); editorConfigFormProvider.addFactory(new NamedFieldHandler("hangFileSizeLimit"), new SpinnerFactory(new Spinner(0, Integer.MAX_VALUE, 3))); editorConfigFormProvider.addFactory(new NamedFieldHandler("extensionImageScale"), new SpinnerFactory(new Spinner(0, Integer.MAX_VALUE, 2))); FileChooserEditableFactory fileChooserEditableFactory = new FileChooserEditableFactory(); editorConfigForm.setEditorFactoryProvider(editorConfigFormProvider); fileChooserEditableFactory.setOnEdit(tabService::addTab); editorConfigForm.setSource(this); VBox vBox = new VBox(); vBox.getChildren().add(editorConfigForm); saveButton.setOnAction(this::save); loadButton.setOnAction(this::load); HBox box = new HBox(5, saveButton, loadButton, infoLabel); box.setPadding(new Insets(0, 0, 15, 5)); vBox.getChildren().add(box); return vBox; }
Example #30
Source File: FxRobotSpinner.java From latexdraw with GNU General Public License v3.0 | 5 votes |
default <T extends Number> void doTestSpinner(final CmdVoid cmdsConfig, final Spinner<T> spinner, final CmdVoid cmdSpinner, final List<Supplier<T>> oracles) { cmdsConfig.execute(); final T val = spinner.getValue(); cmdSpinner.execute(); HelperTest.waitForTimeoutTransitions(); oracles.forEach(oracle -> assertEquals(spinner.getValue().doubleValue(), oracle.get().doubleValue(), 0.0001)); assertNotEquals(val.doubleValue(), spinner.getValue().doubleValue(), 0.0001); }