List of usage examples for javafx.util.converter NumberStringConverter NumberStringConverter
public NumberStringConverter(NumberFormat numberFormat)
From source file:io.github.mzmine.util.jfreechart.ManualZoomDialog.java
@FXML public void initialize() { NumberFormat xAxisFormatter;/* w ww . j a va 2 s .com*/ if (xAxis instanceof NumberAxis) xAxisFormatter = ((NumberAxis) xAxis).getNumberFormatOverride(); else xAxisFormatter = NumberFormat.getNumberInstance(); NumberFormat yAxisFormatter; if (yAxis instanceof NumberAxis) yAxisFormatter = ((NumberAxis) yAxis).getNumberFormatOverride(); else yAxisFormatter = NumberFormat.getNumberInstance(); xAxisLabel.setText(xAxis.getLabel()); yAxisLabel.setText(yAxis.getLabel()); xAxisRangeMin.setTextFormatter(new TextFormatter<>(new NumberStringConverter(xAxisFormatter))); xAxisRangeMin.disableProperty().bind(xAxisAutoRange.selectedProperty()); xAxisRangeMin.setText(String.valueOf(xAxis.getLowerBound())); xAxisRangeMax.setTextFormatter(new TextFormatter<>(new NumberStringConverter(xAxisFormatter))); xAxisRangeMax.disableProperty().bind(xAxisAutoRange.selectedProperty()); xAxisRangeMax.setText(String.valueOf(xAxis.getUpperBound())); xAxisAutoRange.setSelected(xAxis.isAutoRange()); yAxisRangeMin.setTextFormatter(new TextFormatter<>(new NumberStringConverter(yAxisFormatter))); yAxisRangeMin.setText(String.valueOf(yAxis.getLowerBound())); yAxisRangeMin.disableProperty().bind(yAxisAutoRange.selectedProperty()); yAxisRangeMax.setTextFormatter(new TextFormatter<>(new NumberStringConverter(yAxisFormatter))); yAxisRangeMax.setText(String.valueOf(yAxis.getUpperBound())); yAxisRangeMax.disableProperty().bind(yAxisAutoRange.selectedProperty()); yAxisAutoRange.setSelected(yAxis.isAutoRange()); xAxisTickSize.disableProperty().bind(xAxisAutoTickSize.selectedProperty()); xAxisTickSize.setText(String.valueOf(xAxis.getTickUnit().getSize())); xAxisAutoTickSize.setSelected(xAxis.isAutoTickUnitSelection()); yAxisTickSize.setTextFormatter(new TextFormatter<>(new NumberStringConverter(yAxisFormatter))); yAxisTickSize.setText(String.valueOf(yAxis.getTickUnit().getSize())); yAxisTickSize.disableProperty().bind(yAxisAutoTickSize.selectedProperty()); yAxisAutoTickSize.setSelected(yAxis.isAutoTickUnitSelection()); }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private void addRowFees(final Pane content, final BookingBean be) { final HBox box = new HBox(); // configure box box.setSpacing(8);// ww w .j a v a 2s.c o m box.setPadding(boxPadding); box.setAlignment(Pos.CENTER); box.setFillHeight(true); // add cleaning fees final TextField cleaningFeesTextField = new TextField(); Bindings.bindBidirectional(cleaningFeesTextField.textProperty(), be.cleaningFeesProperty(), new NumberStringConverter(decimalFormat)); cleaningFeesTextField.setPrefWidth(prefTextInputFieldWidth); final TextFlow cleaningFeesTextFlow = new TextFlow(new Text("Cleaning Fees: "), cleaningFeesTextField, new Text(" ")); box.getChildren().add(cleaningFeesTextFlow); // add cleaning costs final CleaningEntry ce = be.getCleaning(); if (ce != null) { final TextField cleaningCostsTextField = new TextField(); Bindings.bindBidirectional(cleaningCostsTextField.textProperty(), ce.cleaningCostsProperty(), new NumberStringConverter(decimalFormat)); cleaningCostsTextField.setPrefWidth(prefTextInputFieldWidth); final TextFlow cleaningCostsTextFlow = new TextFlow(new Text("Cleaning Costs: "), cleaningCostsTextField, new Text(" ")); box.getChildren().add(cleaningCostsTextFlow); } else { final TextField cleaningCostsTextField = new TextField("No Cleaning"); cleaningCostsTextField.setEditable(false); cleaningCostsTextField.setPrefWidth(prefTextInputFieldWidth); final TextFlow cleaningCostsTextFlow = new TextFlow(new Text("Cleaning Costs: "), cleaningCostsTextField); cleaningCostsTextField.getStyleClass().add("warning"); box.getChildren().add(cleaningCostsTextFlow); } // add service fees final TextField serviceFeesTextField = new TextField(); Bindings.bindBidirectional(serviceFeesTextField.textProperty(), be.serviceFeeProperty(), new NumberStringConverter(decimalFormat)); serviceFeesTextField.setPrefWidth(prefTextInputFieldWidth); final TextFlow serviceFeesAbsTextFlow = new TextFlow(new Text("Service Fees: "), serviceFeesTextField, new Text(" ")); box.getChildren().add(serviceFeesAbsTextFlow); // add service fees percent final TextField serviceFeesPercentTextField = new TextField(); Bindings.bindBidirectional(serviceFeesPercentTextField.textProperty(), be.serviceFeesPercentProperty(), new NumberStringConverter(decimalFormat)); serviceFeesPercentTextField.setPrefWidth(prefTextInputFieldWidth); final TextFlow serviceFeesPercentTextFlow = new TextFlow(new Text("Service Fees: "), serviceFeesPercentTextField, new Text(" %")); box.getChildren().add(serviceFeesPercentTextFlow); // add box to parent content.getChildren().add(box); }