/*************************************************************************** * * Public API * * **************************************************************************/ public void registerSnackbarContainer(Pane snackbarContainer) { if (snackbarContainer != null) { if (this.snackbarContainer != null) { //since listeners are added the container should be properly registered/unregistered throw new IllegalArgumentException("Snackbar Container already set"); } this.snackbarContainer = snackbarContainer; this.snackbarContainer.getChildren().add(this); this.snackbarContainer.heightProperty().addListener(weakSizeListener); this.snackbarContainer.widthProperty().addListener(weakSizeListener); } }
private void updateTempDrawerSize() { if (sizeProperty.get() > getDefaultDrawerSize()) { tempDrawerSize = prefSizeProperty.get(); } else { tempDrawerSize = getDefaultDrawerSize(); } }
@Override public void invalidated(Observable ignored) { if (Double.isNaN(dialog.getWidth()) || Double.isNaN(dialog.getHeight())) { return; } dialog.widthProperty().removeListener(positionAdjuster); dialog.heightProperty().removeListener(positionAdjuster); fixPosition(); } };
ownerWindow.xProperty().removeListener(weakXListener); ownerWindow.yProperty().removeListener(weakYListener); ownerWindow.widthProperty().removeListener(weakHideListener); ownerWindow.heightProperty().removeListener(weakHideListener); ownerWindow.xProperty().addListener(weakXListener); ownerWindow.yProperty().addListener(weakYListener); ownerWindow.widthProperty().addListener(weakHideListener); ownerWindow.heightProperty().addListener(weakHideListener);
@Nonnull public static TextField textFieldDoubleReadonly(@Nonnull ReadOnlyDoubleProperty doubleProperty, @Nonnull NumberStringConverterForFloatingPointNumbers floatConverter) { TextField textField = new TextField(); doubleProperty.addListener((observable, oldValue, newValue) -> textField.setText(floatConverter.toString(newValue))); textField.setText(floatConverter.toString(doubleProperty.get())); textField.setEditable(false); return textField; }
linesWrapper.clip.widthProperty().bind(linesWrapper.promptContainer.widthProperty().subtract(arrowButton.widthProperty()));
bottomBar.setMaxHeight(64); bottomBar.getTransforms().add(scale); scale.pivotYProperty().bind(bottomBar.heightProperty().divide(2)); bottomBar.setPickOnBounds(false);
public void bindHorizontalScrollbar(ScrollBar bar) { bar.setMin(0); DoubleBinding max = this.contentBody.widthProperty().subtract(widthProperty()); DoubleBinding factor = this.contentBody.widthProperty().divide(max); bar.maxProperty().bind(this.contentBody.widthProperty().divide(factor)); bar.visibleAmountProperty().bind(widthProperty().divide(factor)); this.offsetX.bind(bar.valueProperty()); }
barGroup.setTranslateX(0); barGroup.setTranslateY(0); label.translateXProperty().bind(width.divide(2).subtract(label.widthProperty().divide(2))); label.translateYProperty().bind(height); break; case LEFT: barGroup.translateXProperty().bind(label.widthProperty().add(10)); barGroup.setTranslateY(0); label.setTranslateX(0); label.translateYProperty().bind(height.divide(2).subtract(label.heightProperty().divide(2))); break; case RIGHT: barGroup.setTranslateY(0); label.translateXProperty().bind(width.add(10)); label.translateYProperty().bind(height.divide(2).subtract(label.heightProperty().divide(2))); break; case TOP: barGroup.setTranslateX(0); barGroup.translateYProperty().bind(label.heightProperty()); label.translateXProperty().bind(width.divide(2).subtract(label.widthProperty().divide(2))); label.setTranslateY(0); break;
this.icon.layoutXProperty().bind(this.icon.widthProperty().divide(-2)); this.icon.layoutYProperty().bind(this.icon.heightProperty().divide(-2)); } else if( location == Location.TOP_RIGHT ) { this.icon.layoutXProperty().bind(Bindings.createDoubleBinding(() -> { return Double.valueOf(c.getWidth() - this.icon.widthProperty().get() / 2); },this.icon.widthProperty(), c.widthProperty())); this.icon.layoutYProperty().bind(this.icon.heightProperty().divide(-2)); } else if( location == Location.BOTTOM_LEFT ) { this.icon.layoutXProperty().bind(this.icon.widthProperty().divide(-2)); this.icon.layoutYProperty().bind(Bindings.createDoubleBinding(() -> { return Double.valueOf(c.getHeight() - this.icon.heightProperty().get() / 2); }, this.icon.heightProperty(), c.heightProperty())); } else if( location == Location.BOTTOM_RIGHT ) { this.icon.layoutXProperty().bind(Bindings.createDoubleBinding(() -> { return Double.valueOf(c.getWidth() - this.icon.widthProperty().get() / 2); },this.icon.widthProperty(), c.widthProperty())); this.icon.layoutYProperty().bind(Bindings.createDoubleBinding(() -> { return Double.valueOf(c.getHeight() - this.icon.heightProperty().get() / 2); }, this.icon.heightProperty(), c.heightProperty()));
public CoinPriceAlwaysVisible() { amount = new SimpleStringProperty(this, "amount", ""); getStylesheets().add(this.getClass().getResource("icons.css").toExternalForm()); final ImageView imageView = new ImageView(img); final Label text = new Label(); text.getStyleClass().add("iconText"); text.textProperty().bind(amount); imageView.layoutXProperty().bind(text.widthProperty().add(3)); getChildren().addAll(text, imageView); } public void setAmount(Integer amount) {
this.windowProperty.addListener((o, oldV, newV) -> { if (oldV != null) { oldV.widthProperty().removeListener(this::handleStageChange); oldV.heightProperty().removeListener(this::handleStageChange); oldV.xProperty().removeListener(this::handleStageChange); oldV.yProperty().removeListener(this::handleStageChange); newV.widthProperty().addListener(this::handleStageChange); newV.heightProperty().addListener(this::handleStageChange); newV.xProperty().addListener(this::handleStageChange); newV.yProperty().addListener(this::handleStageChange);
@Override public void changed( ObservableValue<? extends Service<?>> observableValue, Service<?> oldValue, Service<?> newValue) { try { if (oldValue != null) { taskTitleLabel.textProperty().unbind(); taskMessageLabel.textProperty().unbind(); taskProgress.progressProperty().unbind(); killTaskButton.visibleProperty().unbind(); } if (newValue != null) { taskTitleLabel.textProperty().bind(newValue.titleProperty()); taskMessageLabel.textProperty().bind(newValue.messageProperty()); taskProgress.progressProperty().bind(newValue.progressProperty()); newValue.progressProperty().addListener((e) -> System.out.println("Changed: " + newValue.progressProperty().get())); if (newValue instanceof DataFxService<?>) { killTaskButton.visibleProperty().bind(((DataFxService<?>) newValue).cancelableProperty()); } else { killTaskButton.visibleProperty().set(true); } anchorPane.setVisible(true); } else { anchorPane.setVisible(false); } } catch (Exception e) { e.printStackTrace(); } } });
.subtract(logCategoryColumn.getPrefWidth()) .subtract(logDateColumn.getPrefWidth()) .subtract(2)); // makes it work
scale = new Scale(1, 1, 0, 0); rotate = new Rotate(0, 0, 1); rotate.pivotYProperty().bind(selectedTabLine.heightProperty().divide(2));
barGroup.setTranslateX(0); barGroup.setTranslateY(0); label.translateXProperty().bind(width.divide(2).subtract(label.widthProperty().divide(2))); label.translateYProperty().bind(height); break; case LEFT: barGroup.translateXProperty().bind(label.widthProperty().add(10)); barGroup.setTranslateY(0); label.setTranslateX(0); label.translateYProperty().bind(height.divide(2).subtract(label.heightProperty().divide(2))); break; case RIGHT: barGroup.setTranslateY(0); label.translateXProperty().bind(width.add(10)); label.translateYProperty().bind(height.divide(2).subtract(label.heightProperty().divide(2))); break; case TOP: barGroup.setTranslateX(0); barGroup.translateYProperty().bind(label.heightProperty()); label.translateXProperty().bind(width.divide(2).subtract(label.widthProperty().divide(2))); label.setTranslateY(0); break;
public BaleAmountAlwaysVisible() { getStylesheets().add(this.getClass().getResource("icons.css").toExternalForm()); amount = new SimpleStringProperty(this, "amount", ""); final ImageView imageView = new ImageView(img); final Label text = new Label(); text.getStyleClass().add("iconText"); text.textProperty().bind(amount); imageView.layoutXProperty().bind(text.widthProperty().add(3)); getChildren().addAll(text, imageView); } public void setAmount(Integer amount) {