Java 类javafx.util.converter.DoubleStringConverter 实例源码

项目:slogo    文件:Variables.java   
@SuppressWarnings("unchecked")
private void initializeTable () {
    this.setEditable(true);
    this.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    TableColumn<IVariable, String> nameColumn = new TableColumn<IVariable, String>("Name");
    TableColumn<IVariable, Double> valueColumn = new TableColumn<IVariable, Double>("Value");

    // set where to read values from
    nameColumn.setCellValueFactory(new PropertyValueFactory<IVariable, String>("name"));
    valueColumn.setCellValueFactory(new PropertyValueFactory<IVariable, Double>("value"));

    // set editable column (valueColumn)
    valueColumn.setCellFactory(TextFieldTableCell
            .<IVariable, Double> forTableColumn(new DoubleStringConverter()));

    // Set listener to execute when on edit commit runs
    valueColumn.setOnEditCommit( (CellEditEvent<IVariable, Double> event) -> setVariableValue(event));
    valueColumn.setEditable(true);

    this.getColumns().addAll(nameColumn, valueColumn);
}
项目:slogo    文件:TableWindow.java   
@SuppressWarnings("unchecked")
private void initializeTable () {
    this.setEditable(true);
    this.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    TableColumn<Object, String> nameColumn = new TableColumn<Object, String>("Name");
    TableColumn<Object, Double> valueColumn = new TableColumn<Object, Double>("Value");

    // set where to read values from
    nameColumn.setCellValueFactory(new PropertyValueFactory<Object, String>("name"));
    valueColumn.setCellValueFactory(new PropertyValueFactory<Object, Double>("value"));

    // set editable column (valueColumn)
    valueColumn.setCellFactory(TextFieldTableCell.<Object, Double> forTableColumn(new DoubleStringConverter()));

    // Set listener to execute when on edit commit runs
    valueColumn.setOnEditCommit( (CellEditEvent<Object, Double> event) -> setVariableValue(event));
    valueColumn.setEditable(true);

    this.getColumns().addAll(nameColumn, valueColumn);
}
项目:x-facteur    文件:MapView.java   
protected void makeInteractivity() {
    // default field values and format
    postOfficeStreet.setText(PathController.getWalkingPO().getStreet());
    postOfficeCity.setText(PathController.getWalkingPO().getCity());
    maxTime.setTextFormatter(new TextFormatter<Double>(new DoubleStringConverter(), PathController.getMaxTime()));

    // genBtn disabled state
    genBtn.setDisable(postOfficeStreet.getLength() == 0 || postOfficeCity.getLength() == 0 || maxTime.getLength() == 0);
    postOfficeStreet.setOnKeyReleased(e -> {
        genBtn.setDisable(postOfficeStreet.getLength() == 0 || postOfficeCity.getLength() == 0 || maxTime.getLength() == 0);
    });
    postOfficeCity.setOnKeyReleased(e -> {
        genBtn.setDisable(postOfficeStreet.getLength() == 0 || postOfficeCity.getLength() == 0 || maxTime.getLength() == 0);
    });
    maxTime.setOnKeyReleased(e -> {
        genBtn.setDisable(postOfficeStreet.getLength() == 0 || postOfficeCity.getLength() == 0 || maxTime.getLength() == 0);
    });

    // genBtn action
    genBtn.setOnAction(e -> {
        PathController.setPostOffice(new Shipment(postOfficeStreet.getText(), postOfficeCity.getText(), false));
        PathController.setMaxTime(Double.parseDouble(maxTime.getText()));
        PathController.generate();
        PathController.display();
    });

    // wView config
    wView.getEngine().load("https://www.google.fr/maps");
}
项目:factoryfx    文件:DoubleAttributeVisualisation.java   
@Override
public Node createVisualisation(SimpleObjectProperty<Double> boundTo, boolean readonly) {
    TextField textField = new TextField();
    TypedTextFieldHelper.setupDoubleTextField(textField);
    textField.textProperty().bindBidirectional(boundTo, new DoubleStringConverter());
    textField.setEditable(!readonly);
    return textField;
}
项目:Map-Projections    文件:MapApplication.java   
/**
 * Create a block of niche options - specifically International Dateline cropping and whether
 * there should be a graticule
 * @param cropAtIDL The mutable boolean value to which to bind the "Crop at Dateline" CheckBox
 * @param graticule The mutable double value to which to bind the "Graticule" Spinner
 * @return the full formatted Region
 */
protected Region buildOptionPane(Flag cropAtIDL, MutableDouble graticule) {
    final CheckBox cropBox = new CheckBox("Crop at International Dateline"); //the CheckBox for whether there should be shown imagery outside the International Dateline
    cropBox.setSelected(cropAtIDL.isSet());
    cropBox.setTooltip(new Tooltip("Show every point exactly once."));
    cropBox.selectedProperty().addListener((observable, old, now) -> {
            cropAtIDL.set(now);
        });

    final ObservableList<Double> factorsOf90 = FXCollections.observableArrayList();
    for (double f = 1; f <= 90; f += 0.5)
        if (90%f == 0)
            factorsOf90.add((double)f);
    final Spinner<Double> gratSpinner = new Spinner<Double>(factorsOf90); //spinner for the graticule value
    gratSpinner.getValueFactory().setConverter(new DoubleStringConverter());
    gratSpinner.getValueFactory().setValue(graticule.get());
    gratSpinner.setDisable(graticule.isZero());
    gratSpinner.setEditable(true);
    gratSpinner.setTooltip(new Tooltip("The spacing in degrees between shown parallels and meridians."));
    gratSpinner.setPrefWidth(SPINNER_WIDTH);
    gratSpinner.valueProperty().addListener((observable, old, now) -> {
            graticule.set(now); //which is tied to the mutable graticule spacing variable
        });

    final CheckBox gratBox = new CheckBox("Graticule: "); //the CheckBox for whether there should be a graticule
    gratBox.setSelected(!graticule.isZero());
    gratBox.setTooltip(new Tooltip("Overlay a mesh of parallels and meridians."));
    gratBox.selectedProperty().addListener((observable, old, now) -> {
            if (now)
                graticule.set(gratSpinner.getValue()); //set the value of graticule appropriately when checked
            else
                graticule.set(0); //when not checked, represent "no graticule" as a spacing of 0
            gratSpinner.setDisable(!now); //disable the graticule Spinner when appropriate
        });

    final HBox gratRow = new HBox(H_SPACE, gratBox, gratSpinner);
    gratRow.setAlignment(Pos.CENTER_LEFT);
    return new VBox(V_SPACE, cropBox, gratRow);
}
项目:tornadofx-controls    文件:FormFxmlDemo.java   
public void initialize(URL location, ResourceBundle resources) {
    wrapAt.textProperty().bindBidirectional(responsiveFieldset.wrapWidthProperty(), new DoubleStringConverter());
}