Java 类javafx.scene.control.SpinnerValueFactory 实例源码

项目:marathonv5    文件:JavaFXSpinnerElement.java   
@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;
}
项目:marathonv5    文件:SpinnerSample.java   
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;
}
项目:boutique-de-jus    文件:SpinnerUtil.java   
public  static void initializeSpinner(final Spinner<Integer> spinner, final int minValue, final int maxValue, final int initialValue) {
    spinner.getEditor().setOnKeyPressed(event -> {
        switch (event.getCode()) {
            case UP:
                spinner.increment(1);
                break;
            case DOWN:
                spinner.decrement(1);
                break;
        }
    });
    spinner.setOnScroll(e -> {
        spinner.increment((int) (e.getDeltaY() / e.getMultiplierY()));
    });

    SpinnerValueFactory<Integer> factory = new SpinnerValueFactory.IntegerSpinnerValueFactory(minValue, maxValue, initialValue);
    spinner.setValueFactory(factory);
    spinner.setEditable(true);

    TextFormatter<Integer> formatter = new TextFormatter<>(factory.getConverter(), factory.getValue());
    spinner.getEditor().setTextFormatter(formatter);
    factory.valueProperty().bindBidirectional(formatter.valueProperty());

}
项目:waterrower-workout    文件:SpinnerFocusChangeListener.java   
private void commitEditorText(Spinner<T> spinner) {
    if (!spinner.isEditable()) return;
    try {
        String text = spinner.getEditor().getText();
        SpinnerValueFactory<T> valueFactory = spinner.getValueFactory();
        if (valueFactory != null) {
            StringConverter<T> converter = valueFactory.getConverter();
            if (converter != null) {
                T value = converter.fromString(text);
                if (value == null)
                    return;
                valueFactory.setValue(value);
            }
        }
    } catch (NumberFormatException e) {
        // Ignore text input.
        return;
    }
}
项目:BudgetMaster    文件:DatePickerController.java   
@Override
public void init()
{
    SpinnerValueFactory<Integer> spinnerYearValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 3000, currentDate.getYear()); 
    spinnerYear.setValueFactory(spinnerYearValueFactory);
    spinnerYear.setEditable(false);
    spinnerYear.focusedProperty().addListener((observable, oldValue, newValue) -> {
        if(!newValue)
        {
            spinnerYear.increment(0); // won't change value, but will commit editor
        }
    });

    comboBoxMonth.getItems().addAll(Helpers.getMonthList());
    comboBoxMonth.setValue(Helpers.getMonthList().get(currentDate.getMonthOfYear()-1));

    applyStyle();
}
项目:Map-Projections    文件:MapApplication.java   
private void revealParameters(Projection proj) {
    this.suppressListeners.set();
    final String[] paramNames = proj.getParameterNames();
    final double[][] paramValues = proj.getParameterValues();
    paramGrid.getChildren().clear();
    for (int i = 0; i < proj.getNumParameters(); i ++) {
        paramLabels[i].setText(paramNames[i]+":");
        paramSliders[i].setMin(paramValues[i][0]);
        paramSliders[i].setMax(paramValues[i][1]);
        paramSliders[i].setValue(paramValues[i][2]);
        final SpinnerValueFactory.DoubleSpinnerValueFactory paramSpinVF =
                (DoubleSpinnerValueFactory) paramSpinners[i].getValueFactory();
        paramSpinVF.setMin(paramValues[i][0]);
        paramSpinVF.setMax(paramValues[i][1]);
        paramSpinVF.setValue(paramValues[i][2]);
        final Tooltip tt = new Tooltip(
                "Change the "+paramNames[i]+" of the map (default is " + paramValues[i][2]+")");
        paramSliders[i].setTooltip(tt);
        paramSpinners[i].setTooltip(tt);
        paramGrid.addRow(i, paramLabels[i], paramSliders[i], paramSpinners[i]);
    }
    this.suppressListeners.clear();
}
项目:GRIP    文件:NumberSpinnerInputSocketController.java   
/**
 * @param socket An <code>InputSocket</code> with a domain containing two <code>Number</code>s
 *               (the min and max slider values), or no domain at all.
 */
@Inject
NumberSpinnerInputSocketController(SocketHandleView.Factory socketHandleViewFactory,
                                   GripPlatform platform, @Assisted InputSocket<Number> socket) {
  super(socketHandleViewFactory, socket);
  this.platform = platform;

  final Number[] domain = socket.getSocketHint().getDomain().orElse(DEFAULT_DOMAIN);

  checkArgument(domain.length == 2, "Spinners must have a domain with two numbers (min and max)");

  final double min = domain[0].doubleValue();
  final double max = domain[1].doubleValue();
  final double initialValue = socket.getValue().get().doubleValue();
  this.valueFactory = new SpinnerValueFactory.DoubleSpinnerValueFactory(min, max, initialValue);
  this.updateSocketFromSpinner = o -> this.getSocket().setValue(this.valueFactory.getValue());
  this.valueFactory.valueProperty().addListener(this.updateSocketFromSpinner);
}
项目:GRIP    文件:ListSpinnerInputSocketController.java   
/**
 * @param socket an input socket where the domain contains all of the possible values to choose
 *               from.
 */
@Inject
ListSpinnerInputSocketController(EventBus eventBus, SocketHandleView.Factory
    socketHandleViewFactory, GripPlatform platform, @Assisted InputSocket<List> socket) {
  super(socketHandleViewFactory, socket);
  this.platform = platform;

  final Object[] domain = socket.getSocketHint().getDomain().get();

  @SuppressWarnings("unchecked")
  ObservableList<List> domainList = (ObservableList) FXCollections.observableList(
      Arrays.asList(domain));

  this.valueFactory = new SpinnerValueFactory.ListSpinnerValueFactory<>(domainList);
  this.updateSocketFromSpinner = o -> this.getSocket().setValue(this.valueFactory.getValue());
  this.valueFactory.setValue(socket.getValue().get());
  this.valueFactory.valueProperty().addListener(this.updateSocketFromSpinner);
}
项目:ColorPuzzleFX    文件:BenchmarkView.java   
public void initialize() {
    solverTable.setItems(viewModel.solverTableItems());

    activeColumn.setCellValueFactory(new PropertyValueFactory<>("active"));
    activeColumn.setCellFactory(CheckBoxTableCell.forTableColumn(activeColumn));
    nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
    averageColumn.setCellValueFactory(new PropertyValueFactory<>("average"));
    medianColumn.setCellValueFactory(new PropertyValueFactory<>("median"));
    maxColumn.setCellValueFactory(new PropertyValueFactory<>("max"));
    minColumn.setCellValueFactory(new PropertyValueFactory<>("min"));
    progressColumn.setCellValueFactory(new PropertyValueFactory<>("progress"));
    progressColumn.setCellFactory(ProgressBarTableCell.forTableColumn());

    sampleSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(viewModel.getMinSampleSize(), viewModel.getMaxSampleSize(), viewModel.getDefaultSampleSize(), viewModel.getStepSize()));
    viewModel.sampleSize().bind(sampleSpinner.valueProperty());
}
项目:Suji    文件:NewLocalGameController.java   
private void setupHandicapSpinner() {
    ObservableList<Integer> handicaps = FXCollections.observableArrayList(new ArrayList<>());
    handicaps.add(0);
    for (int i = 2; i < 10; i++)
        handicaps.add(i);

    SpinnerValueFactory<Integer> handicapFactory = new ListSpinnerValueFactory<>(handicaps);
    handicapFactory.setWrapAround(true);
    handicapFactory.setConverter(new HandicapConverter());

    handicapSpinner.setValueFactory(handicapFactory);
    handicapSpinner.setEditable(true);
}
项目:hygene    文件:GenomeNavigateController.java   
@Override
public void initialize(final URL location, final ResourceBundle resources) {
    base.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, Integer.MAX_VALUE));
    base.getValueFactory().setValue(1);
    // Commit changed values on manual edit of spinner
    base.focusedProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue) {
            base.increment(0); // won't change value, but will commit edited value
        }
    });

    genome.itemsProperty().bind(genomeNavigation.getGenomeNames());
}
项目:marathonv5    文件:SpinnerSample.java   
private Spinner<Double> createDoubleSpinner() {
    Spinner<Double> spinner = new Spinner<Double>();
    spinner.setId("double-spinner");
    spinner.setValueFactory(new SpinnerValueFactory.DoubleSpinnerValueFactory(25.50, 50.50));
    spinner.setEditable(true);
    return spinner;
}
项目:CSLMusicModStationCreator    文件:IntRangeEditor.java   
public void setTarget(IntRange target, IntRange borders) {

        this.target = null;
        exactFrom.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(borders.getFrom(), borders.getTo(), target.getFrom()));
        exactTo.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(borders.getFrom(), borders.getTo(), target.getTo()));
        slider.minProperty().set(borders.getFrom());
        slider.maxProperty().set(borders.getTo());
        slider.lowValueProperty().setValue(target.getFrom());
        slider.highValueProperty().setValue(target.getTo());
        slider.lowValueProperty().setValue(target.getFrom());
        slider.highValueProperty().setValue(target.getTo());
        this.target = target;
    }
项目:osrs-equipment-builder    文件:PlayerEditDialogController.java   
@FXML
private void initialize() {
    SpinnerValueFactory<Integer> attackValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
    SpinnerValueFactory<Integer> strengthValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
    SpinnerValueFactory<Integer> defenceValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
    SpinnerValueFactory<Integer> hitpointsValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(9, Integer.MAX_VALUE);
    SpinnerValueFactory<Integer> rangedValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
    SpinnerValueFactory<Integer> magicValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
    SpinnerValueFactory<Integer> prayerValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);

    attackSpinner.setValueFactory(attackValueFactory);
    strengthSpinner.setValueFactory(strengthValueFactory);
    defenceSpinner.setValueFactory(defenceValueFactory);
    rangedSpinner.setValueFactory(rangedValueFactory);
    magicSpinner.setValueFactory(magicValueFactory);
    hitpointsSpinner.setValueFactory(hitpointsValueFactory);
    prayerSpinner.setValueFactory(prayerValueFactory);

    attackSpinner.setEditable(true);
    strengthSpinner.setEditable(true);
    defenceSpinner.setEditable(true);
    rangedSpinner.setEditable(true);
    magicSpinner.setEditable(true);
    prayerSpinner.setEditable(true);
    hitpointsSpinner.setEditable(true);

}
项目:openjfx-8u-dev-tests    文件:SpinnerApp.java   
public void setSpinnerValueFactory(final Spinner _spinner, final String _newValue) {
    ObservableList<String> items = FXCollections.observableArrayList("Jonathan", "Julia", "Henry");
    switch (_newValue) {
        case "Integer": {
            _spinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(5, 10));
            break;
        }

        case "List<String>": {
            _spinner.setValueFactory(new SpinnerValueFactory.ListSpinnerValueFactory<>(items));
            break;
        }
        /*    postponed.  see https://javafx-jira.kenai.com/browse/RT-37968
        case "Calendar": {
            _spinner.setValueFactory(new SpinnerValueFactory.LocalDateSpinnerValueFactory());
            break;
        }
        */
        case "Double": {
            _spinner.setValueFactory(new SpinnerValueFactory.DoubleSpinnerValueFactory(0.0, 1.0, 0.5, 0.05));
            break;
        }
        default: {
            _spinner.setValueFactory(null);
            break;
        }

    }

}
项目:JttDesktop    文件:PropertySpinnerTest.java   
@Before public void initialiseSystemUnderTest(){
   TestApplication.startPlatform();
   PlatformImpl.runAndWait( () -> {
      systemUnderTest = new PropertySpinner<>();
      systemUnderTest.setValueFactory( new SpinnerValueFactory.IntegerSpinnerValueFactory( 1, 1000, 1 ) );
   } );

   property = new SimpleObjectProperty<>();
   boxToPropertyFunction = object -> { return object.toString(); };
   propertyToBoxFunction = object -> { return object == null ? null : Integer.valueOf( object ); };
}
项目:BudgetMaster    文件:NewPaymentController.java   
private void initSpinnerRepeatingPeriod()
{
    SpinnerValueFactory<Integer> valueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 1000, 0);
    spinnerRepeatingPeriod.setValueFactory(valueFactory);
    spinnerRepeatingPeriod.setEditable(false);
    spinnerRepeatingPeriod.focusedProperty().addListener((observable, oldValue, newValue) -> {
        if(!newValue)
        {
            spinnerRepeatingPeriod.increment(0); // won't change value, but will commit editor
        }
    });
}
项目:CMP    文件:DataDomainLayout.java   
@Override
public void initializeLayout()
{
    super.initializeLayout();

    objectCacheSizeSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, Integer.MAX_VALUE, DataRowStore.SNAPSHOT_CACHE_SIZE_DEFAULT, 100));

    useSharedCacheCheckBox.selectedProperty().addListener((obs, oldValue, newValue) ->
        {
            configureRemoteNotifications(newValue);
        });

    hide(javaGroupsConfiguration, jmsConfiguration, customConfiguration);

    remoteChangeNotificationsChoiceBox.getItems().addAll(remoteChangeNotificationOptions);
    remoteChangeNotificationsChoiceBox.getSelectionModel().select(0);
    remoteChangeNotificationsChoiceBox.valueProperty().addListener((observable, oldValue, newValue) ->
        {
            if (newValue == RCN_NONE)
            {
                hide(javaGroupsConfiguration, jmsConfiguration, customConfiguration);
            }
            else if (newValue == RCN_JAVA_GROUPS)
            {
                hide(jmsConfiguration, customConfiguration);
                show(javaGroupsConfiguration);
            }
            else if (newValue == RCN_JMS)
            {
                hide(javaGroupsConfiguration, customConfiguration);
                show(jmsConfiguration);
            }
            else if (newValue == RCN_CUSTOM)
            {
                hide(javaGroupsConfiguration, jmsConfiguration);
                show(customConfiguration);
            }
        });
}
项目:3DScanner.RaspberryPi    文件:UIController.java   
private void setUpSpinnerInt(Spinner<Integer> spinner, int pos, int min, int max, int increment, int savedSet ){
    IntegerSpinnerValueFactory oswFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(min, max, savedSet, increment);
    spinner.setValueFactory(oswFactory);
    spinner.valueProperty().addListener((obs, oldValue, newValue) -> {
    System.out.println("New value: "+newValue);
    // hier könnte es rundungsfehler von double auf Number geben
    setValueSettings(pos, newValue);
    });
}
项目:3DScanner.RaspberryPi    文件:UIController.java   
private void setUpSpinnerDouble(Spinner<Double> spinner, int pos, double min, double max, double increment, double savedSet){
    DoubleSpinnerValueFactory oswFactory = new SpinnerValueFactory.DoubleSpinnerValueFactory(min, max, savedSet, increment);
    spinner.setValueFactory(oswFactory);
    spinner.valueProperty().addListener((obs, oldValue, newValue) -> {
    System.out.println("New value: "+newValue);
    // hier könnte es rundungsfehler von double auf Number geben
    setValueSettings(pos, newValue);
    });

}
项目:HlaListener    文件:EvokeCallbackServiceController.java   
/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    logger.entry();
    SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, 0.1);
    MinWaitTime.setValueFactory(sVF);
    logger.exit();
}
项目:HlaListener    文件:EvokeMultipleCallbackServiceController.java   
/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    logger.entry();
    SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, 0.1);
    MinWaitTime.setValueFactory(sVF);
    MaxWaitTime.setValueFactory(sVF);
    logger.exit();
}
项目:HlaListener    文件:NextMessageRequestServiceController.java   
/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    logger.entry();
    double currentValue = 0;
    double step = .1;
    try {
        if (logicalTimeFactory != null) {
            switch (logicalTimeFactory.getName()) {
                case "HLAfloat64Time":
                    currentValue = ((HLAfloat64Time) currentLogicalTime).getValue();
                    break;
                case "HLAinteger64Time":
                    step = 1;
                    currentValue = ((HLAinteger64Time) currentLogicalTime).getValue();
                    break;
            }
        }
    } catch (Exception ex) {
        logger.log(Level.WARN, ex.getMessage(), ex);
    }

    SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, step);
    sVF.setValue(currentValue);
    LogicalTimeSpin.setValueFactory(sVF);
    logger.exit();
}
项目:HlaListener    文件:TimeAdvanceRequestServiceController.java   
/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    logger.entry();
    double currentValue = 0;
    double step = .1;
    try {
        if (logicalTimeFactory != null) {
            switch (logicalTimeFactory.getName()) {
                case "HLAfloat64Time":
                    currentValue = ((HLAfloat64Time) currentLogicalTime).getValue();
                    break;
                case "HLAinteger64Time":
                    step = 1;
                    currentValue = ((HLAinteger64Time) currentLogicalTime).getValue();
                    break;
            }
        }
    } catch (Exception ex) {
        logger.log(Level.WARN, ex.getMessage(), ex);
    }

    SpinnerValueFactory<Double> sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, step);
    sVF.setValue(currentValue);
    LogicalTimeSpin.setValueFactory(sVF);
    logger.exit();
}
项目:HlaListener    文件:FlushQueueMessageServiceController.java   
/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    logger.entry();
    double currentValue = 0;
    double step = .1;
    try {
        if (logicalTimeFactory != null) {
            switch (logicalTimeFactory.getName()) {
                case "HLAfloat64Time":
                    currentValue = ((HLAfloat64Time) currentLogicalTime).getValue();
                    break;
                case "HLAinteger64Time":
                    step = 1;
                    currentValue = ((HLAinteger64Time) currentLogicalTime).getValue();
                    break;
            }
        }
    } catch (Exception ex) {
        logger.log(Level.WARN, ex.getMessage(), ex);
    }

    SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, step);
    sVF.setValue(currentValue);
    LogicalTimeSpin.setValueFactory(sVF);
    logger.exit();
}
项目:HlaListener    文件:TimeAdvanceRequestAvailableServiceController.java   
/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    logger.entry();
    double currentValue = 0;
    double step = .1;
    try {
        if (logicalTimeFactory != null) {
            switch (logicalTimeFactory.getName()) {
                case "HLAfloat64Time":
                    currentValue = ((HLAfloat64Time) currentLogicalTime).getValue();
                    break;
                case "HLAinteger64Time":
                    step = 1;
                    currentValue = ((HLAinteger64Time) currentLogicalTime).getValue();
                    break;
            }
        }
    } catch (Exception ex) {
        logger.log(Level.WARN, ex.getMessage(), ex);
    }

    SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, step);
    sVF.setValue(currentValue);
    LogicalTimeSpin.setValueFactory(sVF);
    logger.exit();
}
项目:HlaListener    文件:NextMessageRequestAvailableServiceController.java   
/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    logger.entry();
    double currentValue = 0;
    double step = .1;
    try {
        if (logicalTimeFactory != null) {
            switch (logicalTimeFactory.getName()) {
                case "HLAfloat64Time":
                    currentValue = ((HLAfloat64Time) currentLogicalTime).getValue();
                    break;
                case "HLAinteger64Time":
                    step = 1;
                    currentValue = ((HLAinteger64Time) currentLogicalTime).getValue();
                    break;
            }
        }
    } catch (Exception ex) {
        logger.log(Level.WARN, ex.getMessage(), ex);
    }

    SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, step);
    sVF.setValue(currentValue);
    LogicalTimeSpin.setValueFactory(sVF);
    logger.exit();
}
项目:HlaListener    文件:ModifyLookaheadServiceController.java   
/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    logger.entry();
    SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, .1);
    Lookahead.setValueFactory(sVF);
    logger.exit();
}
项目:HlaListener    文件:EnableTimeRegulationServiceController.java   
/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    logger.entry();
    SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, .1);
    Lookahead.setValueFactory(sVF);
    logger.exit();
}
项目:markdown-writer-fx    文件:GeneralOptionsPane.java   
@SuppressWarnings("unchecked")
GeneralOptionsPane() {
    initComponents();

    Font titleFont = Font.font(16);
    editorSettingsLabel.setFont(titleFont);
    fileSettingsLabel.setFont(titleFont);

    // font family
    fontFamilyField.getItems().addAll(getMonospacedFonts());
    fontFamilyField.getSelectionModel().select(0);
    fontFamilyField.setButtonCell(new FontListCell());
    fontFamilyField.setCellFactory(p -> new FontListCell());

    // font size
    fontSizeField.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(Options.MIN_FONT_SIZE, Options.MAX_FONT_SIZE));

    // line separator
    String defaultLineSeparator = System.getProperty( "line.separator", "\n" );
    String defaultLineSeparatorStr = defaultLineSeparator.replace("\r", "CR").replace("\n", "LF");
    lineSeparatorField.getItems().addAll(
        new Item<>(Messages.get("GeneralOptionsPane.platformDefault", defaultLineSeparatorStr), null),
        new Item<>(Messages.get("GeneralOptionsPane.sepWindows"), "\r\n"),
        new Item<>(Messages.get("GeneralOptionsPane.sepUnix"), "\n"));

    // encoding
    encodingField.getItems().addAll(getAvailableEncodings());

    // file extensions
    markdownFileExtensionsField.setPromptText(Options.DEF_MARKDOWN_FILE_EXTENSIONS);
}
项目:mzmine3    文件:SpinnerAutoCommit.java   
private void commitEditorText() {
  if (!isEditable())
    return;
  String text = getEditor().getText();
  SpinnerValueFactory<T> valueFactory = getValueFactory();
  if (valueFactory != null) {
    StringConverter<T> converter = valueFactory.getConverter();
    if (converter != null) {
      T value = converter.fromString(text);
      valueFactory.setValue(value);
    }
  }
}
项目:aic-praise    文件:PRAiSEController.java   
private Node configureSettingsContent() {
    VBox configureMenu = new VBox(2);
    configureMenu.setPadding(new Insets(3,3,3,3));

    HBox displayPrecisionHBox = newButtonHBox();
    displayPrecisionSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 80, _displayPrecision.get()));
    displayPrecisionSpinner.setPrefWidth(60);
    _displayPrecision.bind(displayPrecisionSpinner.valueProperty());
    displayPrecisionHBox.getChildren().addAll(new Label("Display Numeric Precision:"), displayPrecisionSpinner);

    displayExactCheckBox.setSelected(_isDisplayExact.get());
    displayExactCheckBox.setText("Display Numerics Exactly");
    _isDisplayExact.bind(displayExactCheckBox.selectedProperty());

    HBox displayScientificHBox = newButtonHBox();
    displayScientificGreater.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(2, 80, _displayScientificGreater.get()));
    displayScientificGreater.setPrefWidth(60);
    _displayScientificGreater.bind(displayScientificGreater.valueProperty());   
    displayScientificAfter.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(2, 80, _displayScientificAfter.get()));
    displayScientificAfter.setPrefWidth(60);
    _displayScientificAfter.bind(displayScientificAfter.valueProperty());
    displayScientificHBox.getChildren().addAll(new Label("Use Scientific When Outside Range:"), displayScientificGreater, new Label("."), displayScientificAfter);

    debugModeCheckBox.setSelected(_inDebugMode.get());
    debugModeCheckBox.setText("In Debug Mode");
    _inDebugMode.bind(debugModeCheckBox.selectedProperty());

    configureMenu.getChildren().addAll(
                    displayPrecisionHBox,                       
                    displayScientificHBox,
                    displayExactCheckBox,
                    new Separator(Orientation.HORIZONTAL),
                    debugModeCheckBox
    );

    return configureMenu;
}
项目:org.csstudio.display.builder    文件:SpinnerDemo.java   
@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();
}
项目:subshare    文件:ValidityPane.java   
public ValidityPane(final CreatePgpKeyParam createPgpKeyParam) {
    this.createPgpKeyParam = assertNotNull(createPgpKeyParam, "createPgpKeyParam"); //$NON-NLS-1$
    loadDynamicComponentFxml(ValidityPane.class, this);

    validityNumberSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE));
    validityNumberSpinner.valueProperty().addListener((InvalidationListener) observable -> {
        updateValiditySeconds();
        updateComplete();
    });
    validityNumberSpinner.getEditor().setTextFormatter(new TextFormatter<String>(new UnaryOperator<Change>() {
        @Override
        public Change apply(Change change) {
            final String text = change.getControlNewText();
            // We cannot accept an empty String, because the IntegerValueFactory runs into an NPE, then :-(
            try {
                Integer.parseInt(text);
            } catch (NumberFormatException x) {
                return null;
            }
            return change;
        }
    }));

    validityTimeUnitComboBox.setItems(FXCollections.observableArrayList(TimeUnit.YEAR, TimeUnit.MONTH, TimeUnit.DAY));
    validityTimeUnitComboBox.setConverter(timeUnitStringConverter);
    validityTimeUnitComboBox.getSelectionModel().clearAndSelect(0);
    validityTimeUnitComboBox.valueProperty().addListener((InvalidationListener) observable -> updateValiditySeconds());

    createPgpKeyParam.addPropertyChangeListener(CreatePgpKeyParam.PropertyEnum.validitySeconds, validitySecondsPropertyChangeListener);
    updateValidityNumberSpinner();

    updateComplete();
}
项目:GRIP    文件:ListSpinnerInputSocketController.java   
private <T> 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) {
      T value = converter.fromString(text);
      valueFactory.setValue(value);
    }
  }
}
项目:LIMES    文件:MLPropertyMatchingView.java   
private void addSpinnerAndButton() {
    List<String> propertyTypeList = new ArrayList<String>();
    propertyTypeList.add("String");
    propertyTypeList.add("Number");
    propertyTypeList.add("Date");
    propertyTypeList.add("Pointset");
    ObservableList<String> obsPropTypeList = FXCollections.observableList(propertyTypeList);
    SpinnerValueFactory<String> svf = new SpinnerValueFactory.ListSpinnerValueFactory<>(obsPropTypeList);
    Spinner<String> propertyTypeSpinner = new Spinner<String>();
    propertyTypeSpinner.setValueFactory(svf);
    Button deleteRowButton = new Button("x");
    HBox spinnerAndButtonBox = new HBox();
    spinnerAndButtonBox.setAlignment(Pos.CENTER_RIGHT);
    HBox.setHgrow(spinnerAndButtonBox, Priority.ALWAYS);
    spinnerAndButtonBox.getChildren().addAll(propertyTypeSpinner, deleteRowButton);
    unmatchedPropertyBox.getChildren().add(spinnerAndButtonBox);
    unmatchedPropertyBox.setAlignment(Pos.CENTER_LEFT);
    unmatchedPropertyBox.setPrefWidth(stage.getWidth());
    deleteRowButton.setOnAction(e_ -> {
        HBox column = (HBox) deleteRowButton.getParent();
        String matchedSource = ((Label) ((VBox) column.getChildren().get(0)).getChildren().get(0)).getText();
        String matchedTarget = ((Label) ((VBox) column.getChildren().get(1)).getChildren().get(0)).getText();
        if (matchedSource != null) {
            sourcePropList.getItems().add(matchedSource);
        }
        if (matchedTarget != null) {
            targetPropList.getItems().add(matchedTarget);
        }
        VBox row = (VBox) deleteRowButton.getParent().getParent();
        row.getChildren().remove(deleteRowButton.getParent());
    });
}
项目:interval-music-compositor    文件:WidgetTools.java   
/**
 * Links a spinners value property to its factory's value property which has the effect, that it also is notified on manual updates
 * (as opposed to pressing the spinner buttons).
 */
private <T> void makeListeningForManualValueUpdates(Spinner<T> spinner) {
  SpinnerValueFactory<T> valueFactory = spinner.getValueFactory();
  TextFormatter<T> formatter = new TextFormatter<>(valueFactory.getConverter(), valueFactory.getValue());
  spinner.getEditor().setTextFormatter(formatter);
  valueFactory.valueProperty().bindBidirectional(formatter.valueProperty());
}
项目:interval-music-compositor    文件:WidgetTools.java   
/**
 * Links a spinners value property to its factory's value property which has the effect, that it also is notified on manual updates
 * (as opposed to pressing the spinner buttons).
 */
private <T> void makeListeningForManualValueUpdates(Spinner<T> spinner) {
  SpinnerValueFactory<T> valueFactory = spinner.getValueFactory();
  TextFormatter<T> formatter = new TextFormatter<>(valueFactory.getConverter(), valueFactory.getValue());
  spinner.getEditor().setTextFormatter(formatter);
  valueFactory.valueProperty().bindBidirectional(formatter.valueProperty());
}
项目:OpenDiabetes    文件:MainGuiController.java   
@Override
public void initialize(URL url, ResourceBundle rb) {
    // TODO

    // IMPORT
    medtronicTextField.setText(loadMultiFileSelection(
            Constants.IMPORTER_MEDTRONIC_IMPORT_PATH_KEY,
            Constants.IMPORTER_MEDTRONIC_IMPORT_PATH_COUNT_KEY));
    medtronicCheckBox.setSelected(prefs.getBoolean(
            Constants.IMPORTER_MEDRTONIC_IMPORT_CHECKBOX_KEY, false));
    abbottTextField.setText(loadMultiFileSelection(
            Constants.IMPORTER_ABBOTT_IMPORT_PATH_KEY,
            Constants.IMPORTER_ABBOTT_IMPORT_PATH_COUNT_KEY));
    abbottCheckBox.setSelected(prefs.getBoolean(
            Constants.IMPORTER_ABBOTT_IMPORT_CHECKBOX_KEY, false));
    googleFitTextField.setText(loadMultiFileSelection(
            Constants.IMPORTER_GOOGLE_FIT_IMPORT_PATH_KEY,
            Constants.IMPORTER_GOOGLE_FIT_IMPORT_PATH_COUNT_KEY));
    googleFitCheckBox.setSelected(prefs.getBoolean(
            Constants.IMPORTER_GOOGLE_FIT_IMPORT_CHECKBOX_KEY, false));
    googleGatheredTextField.setText(loadMultiFileSelection(
            Constants.IMPORTER_GOOGLE_TRACKS_IMPORT_PATH_KEY,
            Constants.IMPORTER_GOOGLE_TRACKS_IMPORT_PATH_COUNT_KEY));
    googleGatheredCheckBox.setSelected(prefs.getBoolean(
            Constants.IMPORTER_GOOGLE_TRACKS_IMPORT_CHECKBOX_KEY, false));
    sonyTextField.setText(loadMultiFileSelection(
            Constants.IMPORTER_ROCHE_IMPORT_PATH_KEY,
            Constants.IMPORTER_ROCHE_IMPORT_PATH_COUNT_KEY));
    sonyCheckBox.setSelected(prefs.getBoolean(
            Constants.IMPORTER_ROCHE_IMPORT_CHECKBOX_KEY, false));
    odvTextField.setText(loadMultiFileSelection(
            Constants.IMPORTER_ODV_IMPORT_PATH_KEY,
            Constants.IMPORTER_ODV_IMPORT_PATH_COUNT_KEY));
    odvCheckBox.setSelected(prefs.getBoolean(
            Constants.IMPORTER_ODV_IMPORT_CHECKBOX_KEY, false));

    importPeriodToPicker.setValue(LocalDate.now());
    importPeriodFromPicker.setValue(LocalDate.now().minusWeeks(4));
    boolean periodAll = prefs.getBoolean(Constants.IMPORTER_PERIOD_ALL_KEY, false);
    importPeriodAllCheckbox.setSelected(periodAll);
    importPeriodToPicker.setDisable(periodAll);
    importPeriodFromPicker.setDisable(periodAll);

    // EXPORT
    exportOdvCheckBox.setSelected(prefs.getBoolean(Constants.EXPORTER_ODV_CHECKBOX_KEY, false));
    exportPlotDailyCheckBox.setSelected(prefs.getBoolean(Constants.EXPORTER_PLOT_DAILY_CHECKBOX_KEY, false));
    exportOdvTextField.setText(prefs.get(Constants.EXPORTER_ODV_PATH_KEY, ""));
    exportPlotDailyTextField.setText(prefs.get(Constants.EXPORTER_PLOT_DAILY_PATH_KEY, ""));

    exportPeriodToPicker.setValue(LocalDate.now());
    exportPeriodFromPicker.setValue(LocalDate.now().minusWeeks(4));
    periodAll = prefs.getBoolean(Constants.EXPORTER_PERIOD_ALL_KEY, false);
    exportPeriodAllCheckbox.setSelected(periodAll);
    exportPeriodToPicker.setDisable(periodAll);
    exportPeriodFromPicker.setDisable(periodAll);

    // INTERPRETER
    cooldownTimeSpinner.setValueFactory(
            new SpinnerValueFactory.IntegerSpinnerValueFactory(10, 300,
                    prefs.getInt(Constants.INTERPRETER_FILL_AS_KAT_COOLDOWN_KEY, 60),
                    10));
    boolean fillAsKat = prefs.getBoolean(Constants.INTERPRETER_FILL_AS_KAT_KEY, false);
    fillAsNewKathederCheckbox.setSelected(fillAsKat);
    cooldownTimeSpinner.setDisable(!fillAsKat);
}
项目:marathonv5    文件:SpinnerSample.java   
private Spinner<Integer> createIntegerSpinner() {
    Spinner<Integer> spinner = new Spinner<>();
    spinner.setId("integer-spinner");
    spinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 50));
    return spinner;
}