public void setControl(Control control) { maxWidthProperty().bind(control.maxWidthProperty()); prefWidthProperty().bind(control.prefWidthProperty()); prefHeightProperty().bind(control.prefHeightProperty()); errorContainer.setMaxWidth(control.getMaxWidth() > -1 ? control.getMaxWidth() : control.getPrefWidth()); errorContainer.prefWidthProperty().bind(control.widthProperty()); errorContainer.prefHeightProperty().bind(control.heightProperty()); getChildren().clear(); getChildren().add(control); getChildren().add(errorContainer); this.controlProperty.set(control); }
/** * will retrieve icons from the glyphs map for a certain glyphName * * @param glyphName the glyph name * @return SVGGlyph node */ public static SVGGlyph getIcoMoonGlyph(String glyphName) throws Exception{ SVGGlyphBuilder builder = glyphsMap.get(glyphName); if(builder == null) throw new Exception("Glyph '" + glyphName + "' not found!"); SVGGlyph glyph = builder.build(); // we need to apply transformation to correct the icon since // its being inverted after importing from icomoon glyph.getTransforms().add(new Scale(1, -1)); Translate height = new Translate(); height.yProperty().bind(Bindings.createDoubleBinding(() -> -glyph.getHeight(), glyph.heightProperty())); glyph.getTransforms().add(height); return glyph; }
innerCircleCurve.startXProperty().bind(curves.get(0).startXProperty()); innerCircleCurve.startYProperty().bind(curves.get(0).startYProperty()); innerCircleCurve.endXProperty().bind(curves.get(1).startXProperty()); innerCircleCurve.endYProperty().bind(curves.get(1).startYProperty()); curves.get(0).startXProperty().addListener((o, oldVal, newVal) -> { final Point2D controlPoint = makeControlPoint(newVal.doubleValue(), outerCircleCurve.startXProperty().bind(curves.get(0).endXProperty()); outerCircleCurve.startYProperty().bind(curves.get(0).endYProperty()); outerCircleCurve.endXProperty().bind(curves.get(1).endXProperty()); outerCircleCurve.endYProperty().bind(curves.get(1).endYProperty()); controlPoint = makeControlPoint(curves.get(0).getEndX(), curves.get(0).getEndY(), startPoint.xProperty().bind(curves.get(0).startXProperty()); startPoint.yProperty().bind(curves.get(0).startYProperty()); curve0To.controlX1Property().bind(curves.get(0).controlX1Property()); curve0To.controlY1Property().bind(curves.get(0).controlY1Property()); curve0To.controlX2Property().bind(curves.get(0).controlX2Property()); curve0To.controlY2Property().bind(curves.get(0).controlY2Property()); curve0To.xProperty().bind(curves.get(0).endXProperty()); curve0To.yProperty().bind(curves.get(0).endYProperty()); outerCircleCurveTo.controlX1Property().bind(outerCircleCurve.controlX1Property()); outerCircleCurveTo.controlY1Property().bind(outerCircleCurve.controlY1Property()); outerCircleCurveTo.controlX2Property().bind(outerCircleCurve.controlX2Property()); outerCircleCurveTo.controlY2Property().bind(outerCircleCurve.controlY2Property()); outerCircleCurveTo.xProperty().bind(outerCircleCurve.endXProperty());
final double curveTheta = 2 * curves.indexOf(curvedLine) * Math.PI / shapesNumber; curvedLine.controlX1Property().bind(Bindings.createDoubleBinding(() -> { final double a = firstCurve.getControlX1() - centerX; final double b = Math.sin(curveTheta) * (firstCurve.getControlY1() - centerY); }, firstCurve.controlX1Property(), firstCurve.controlY1Property())); curvedLine.controlY1Property().bind(Bindings.createDoubleBinding(() -> { final double a = Math.sin(curveTheta) * (firstCurve.getControlX1() - centerX); final double b = Math.cos(curveTheta) * (firstCurve.getControlY1() - centerY); curvedLine.controlX2Property().bind(Bindings.createDoubleBinding(() -> { final double a = firstCurve.getControlX2() - centerX; final double b = firstCurve.getControlY2() - centerY; }, firstCurve.controlX2Property(), firstCurve.controlY2Property())); curvedLine.controlY2Property().bind(Bindings.createDoubleBinding(() -> { final double a = Math.sin(curveTheta) * (firstCurve.getControlX2() - centerX); final double b = Math.cos(curveTheta) * (firstCurve.getControlY2() - centerY);
/** * set mini drawer mode (the drawer will be animated by changing the size instead * of translation).You can disable this mode, by setting the size value <= 0 * * @param size value */ public void setMiniDrawerSize(double size) { this.miniDrawerSize.set(size); if (size > 0) { updateSize(size); initTranslate.unbind(); initTranslate.set(0); paddingSizeProperty.set(size); } else { updateSize(getDefaultDrawerSize()); initTranslate.bind(initTranslateBinding); paddingSizeProperty.set(0); } resizeTo = size; }
public ToolbarTitledPane() { getStyleClass().add("tool-bar-title"); // change the default setCollapsible(false); toolBar.setPadding(Insets.EMPTY); Label titleLabel = new Label("Title"); titleLabel.textProperty().bind(title); titleLabel.getStyleClass().add("title-label"); toolBar.getItems().add(titleLabel); setGraphic(toolBar); // should be an empty string, binding prevents to set it textProperty().bind(Val.constant("")); // The toolbar is too large for the title region and is not // centered unless we bind the height, like follows Val.wrap(toolBar.parentProperty()) .values() .filter(Objects::nonNull) .subscribe(parent -> { // The title region is provided by the skin, // this is the only way to access it outside of css StackPane titleRegion = (StackPane) parent; toolBar.maxHeightProperty().unbind(); toolBar.maxHeightProperty().bind(titleRegion.heightProperty()); toolBar.minHeightProperty().unbind(); toolBar.minHeightProperty().bind(titleRegion.heightProperty()); toolBar.prefHeightProperty().unbind(); toolBar.prefHeightProperty().bind(titleRegion.heightProperty()); }); }
clip.widthProperty().bind(this.widthProperty()); clip.heightProperty().bind(this.heightProperty()); bottomBar.setMaxHeight(64); bottomBar.getTransforms().add(scale); scale.pivotYProperty().bind(bottomBar.heightProperty().divide(2)); bottomBar.setPickOnBounds(false); header.maxHeightProperty().bind(header.prefHeightProperty()); header.getChildren().setAll(bgContainer, barsContainer); StackPane.setAlignment(header, Pos.TOP_CENTER); headerSpace.minHeightProperty().bind(header.prefHeightProperty()); headerSpace.maxHeightProperty().bind(header.prefHeightProperty()); headerSpace.setFocusTraversable(true);
Region toggleNode = getToggleNode(); newVal.layoutXProperty() .bind(Bindings.createDoubleBinding(() -> toggleNode.getLayoutX() + toggleNode.getWidth() / 2, toggleNode.widthProperty(), toggleNode.layoutXProperty())); newVal.layoutYProperty() .bind(Bindings.createDoubleBinding(() -> toggleNode.getLayoutY() + toggleNode.getHeight() / 2, toggleNode.heightProperty(), toggleNode.layoutYProperty())); getClip().layoutYProperty().unbind(); getClip().layoutXProperty() .bind(Bindings.createDoubleBinding(() -> newVal.getLayoutX() + newVal.getWidth() / 2, newVal.widthProperty(), newVal.layoutXProperty())); getClip().layoutYProperty() .bind(Bindings.createDoubleBinding(() -> newVal.getLayoutY() + newVal.getHeight() / 2, newVal.heightProperty(), newVal.layoutYProperty()));
actionContainer.setPadding(new Insets(0, 10, 0, 0)); toast.prefWidthProperty().bind(Bindings.createDoubleBinding(() -> { if (getPrefWidth() == -1) { return getPrefWidth();
glyph.setSize(20, 20); button.setGraphic(glyph); button.translateYProperty().bind(Bindings.createDoubleBinding(() -> { return header.getBoundsInParent().getHeight() - button.getHeight() / 2; }, header.boundsInParentProperty(), button.heightProperty()));
TableCell<LogEntry, String> cell = new TableCell<>(); Text text = new Text(); text.wrappingWidthProperty().bind(cell.widthProperty()); text.textProperty().bind(cell.itemProperty()); cell.setGraphic(text); .bind(eventLogTableView.widthProperty() .subtract(logCategoryColumn.getPrefWidth()) .subtract(logDateColumn.getPrefWidth())
toggleAnimation.setOnFinished((finish) -> { if (toggleAnimation.getRate() == 1) { this.getClip().scaleXProperty().bind(Bindings.createDoubleBinding(() -> { double X = this.getWidth() / getClip().getLayoutBounds().getWidth(); double Y = this.getHeight() / getClip().getLayoutBounds().getHeight(); }, this.widthProperty(), this.heightProperty())); this.getClip().scaleYProperty().bind(Bindings.createDoubleBinding(() -> { double X = this.getWidth() / getClip().getLayoutBounds().getWidth(); double Y = this.getHeight() / getClip().getLayoutBounds().getHeight();
clip.widthProperty().bind(promptContainer.widthProperty()); promptContainer.setClip(clip);
initTranslate.bind(initTranslateBinding);
sizeSlider.getStyleClass().add("svg-slider"); HBox sizeControl = new HBox(5, sizeLabel, sizeSlider); sizeControl.prefWidthProperty().bind(colorPicker.widthProperty());
linesWrapper.clip.widthProperty().bind(linesWrapper.promptContainer.widthProperty().subtract(arrowButton.widthProperty()));