Java Code Examples for javafx.beans.property.DoubleProperty#bind()
The following examples show how to use
javafx.beans.property.DoubleProperty#bind() .
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: TestDatatypes.java From mzmine3 with GNU General Public License v2.0 | 7 votes |
@Test public void simpleSumBinding() { DoubleProperty a = new SimpleDoubleProperty(); DoubleProperty b = new SimpleDoubleProperty(); DoubleProperty sum = new SimpleDoubleProperty(); sum.bind(a.add(b)); sum.add(b); logger.info("Sum=" + sum.get() + " " + sum.getValue()); a.set(10); logger.info("Sum=" + sum.get() + " " + sum.getValue()); b.set(5); logger.info("Sum=" + sum.get() + " " + sum.getValue()); }
Example 2
Source File: DemoUtil.java From RadialFx with GNU Lesser General Public License v3.0 | 6 votes |
private Slider addSliderControl(final String title, final DoubleProperty prop) { final Slider slider = new Slider(); slider.setValue(prop.get()); prop.bind(slider.valueProperty()); final VBox box = new VBox(); final Text titleText = new Text(title); titleText.textProperty().bind(new StringBinding() { { super.bind(slider.valueProperty()); } @Override protected String computeValue() { return title + " : " + twoDForm.format(slider.getValue()); } }); box.getChildren().addAll(titleText, slider); getChildren().add(box); return slider; }
Example 3
Source File: SearchController.java From Noexes with GNU General Public License v3.0 | 5 votes |
private void initService(Service<?> service) { DoubleProperty p = mc.getProgressBar().progressProperty(); p.unbind(); p.bind(service.progressProperty()); service.messageProperty().addListener((observable, oldValue, newValue) -> mc.setStatus(newValue)); this.runningService = service; runningService.restart(); }
Example 4
Source File: PluginParametersPane.java From constellation with Apache License 2.0 | 4 votes |
@Override public Pane getParamPane(final PluginParametersNode node) { if (node.getChildren().isEmpty()) { return null; } final GridPane paramGroupPane = new PluginParametersPane(); paramGroupPane.setMinHeight(0); GridPane.setHalignment(paramGroupPane, HPos.LEFT); paramGroupPane.setPadding(Insets.EMPTY); int row = 0; final DoubleProperty descriptionWidth = new SimpleDoubleProperty(); DoubleProperty maxLabelWidth = new SimpleDoubleProperty(); for (final PluginParametersNode child : node.getChildren()) { while (child.getFormatter().nextElement(child)) { final RowConstraints rowConstraints = new RowConstraints(); rowConstraints.setVgrow(Priority.NEVER); rowConstraints.setFillHeight(true); paramGroupPane.getRowConstraints().addAll(rowConstraints); final LabelDescriptionBox label = child.getFormatter().getParamLabel(child); if (label != null) { paramGroupPane.add(label, 0, row); GridPane.setValignment(label, VPos.TOP); GridPane.setHgrow(label, Priority.ALWAYS); GridPane.setFillHeight(label, false); label.bindDescriptionToProperty(descriptionWidth); maxLabelWidth = label.updateBindingWithLabelWidth(maxLabelWidth); } final Pane paramPane = child.getFormatter().getParamPane(child); if (paramPane != null) { paramPane.setStyle("-fx-padding: " + PADDING); GridPane.setValignment(paramPane, VPos.TOP); GridPane.setFillHeight(paramPane, false); if (label == null) { paramGroupPane.add(paramPane, 0, row, 2, 1); } else { paramGroupPane.add(paramPane, 1, row); } } final Button paramHelp = child.getFormatter().getParamHelp(child); if (paramHelp != null) { paramGroupPane.add(paramHelp, 2, row); GridPane.setMargin(paramHelp, new Insets(PADDING, PADDING, 0, 0)); GridPane.setValignment(paramHelp, VPos.TOP); GridPane.setFillHeight(paramHelp, false); } row++; } } descriptionWidth.bind(Bindings.max(50, maxLabelWidth)); return paramGroupPane; }
Example 5
Source File: PluginParametersPane.java From constellation with Apache License 2.0 | 4 votes |
public DoubleProperty updateBindingWithLabelWidth(DoubleProperty property) { DoubleProperty newBinding = new SimpleDoubleProperty(); newBinding.bind(Bindings.max(property, label.widthProperty())); return newBinding; }
Example 6
Source File: CompletableService.java From mokka7 with Eclipse Public License 1.0 | 4 votes |
/** * {@link #progressProperty()} */ public CompletableService<T> bindProgress(DoubleProperty progress) { progress.bind(progressProperty()); return this; }