public static void smoothScrolling(ScrollPane scrollPane) { customScrolling(scrollPane, scrollPane.vvalueProperty(), bounds -> bounds.getHeight()); }
/** * compute the ripple radius * @return the ripple radius size */ protected double computeRippleRadius() { double width2 = control.getLayoutBounds().getWidth() * control.getLayoutBounds().getWidth(); double height2 = control.getLayoutBounds().getHeight() * control.getLayoutBounds().getHeight(); return Math.min(Math.sqrt(width2 + height2), RIPPLE_MAX_RADIUS) * 1.1 + 5; }
private void refreshPopup() { Bounds contentBound = this.getLayoutBounds(); double offsetX = Math.ceil(snackbarContainer.getWidth() / 2) - Math.ceil(contentBound.getWidth() / 2); double offsetY = snackbarContainer.getHeight() - contentBound.getHeight(); this.setLayoutX(offsetX); this.setLayoutY(offsetY); }
protected void setOverLayBounds(Rectangle overlay){ overlay.setWidth(control.getLayoutBounds().getWidth()); overlay.setHeight(control.getLayoutBounds().getHeight()); }
/** * set the dialog container * Note: the dialog container must be StackPane, its the container for the dialog to be shown in. * * @param dialogContainer */ public void setDialogContainer(StackPane dialogContainer) { if (dialogContainer != null) { this.dialogContainer = dialogContainer; // FIXME: need to be improved to consider only the parent boundary offsetX = dialogContainer.getBoundsInLocal().getWidth(); offsetY = dialogContainer.getBoundsInLocal().getHeight(); animation = getShowAnimation(transitionType.get()); } }
@Override public void cache(Pane node) { if (!cache.containsKey(node)) { SnapshotParameters snapShotparams = new SnapshotParameters(); snapShotparams.setFill(Color.TRANSPARENT); WritableImage temp = node.snapshot(snapShotparams, new WritableImage((int) node.getLayoutBounds().getWidth(), (int) node.getLayoutBounds().getHeight())); ImageView tempImage = new ImageView(temp); tempImage.setCache(true); tempImage.setCacheHint(CacheHint.SPEED); cache.put(node, new ArrayList<>(node.getChildren())); node.getChildren().setAll(tempImage); } }
@Override protected Node getMask() { Region clip = new Region(); JFXNodeUtils.updateBackground(JFXTreeCell.this.getBackground(), clip); double width = control.getLayoutBounds().getWidth(); double height = control.getLayoutBounds().getHeight(); clip.resize(width, height); return clip; }
@Override protected Node getMask() { Region clip = new Region(); JFXNodeUtils.updateBackground(JFXListCell.this.getBackground(), clip); double width = control.getLayoutBounds().getWidth(); double height = control.getLayoutBounds().getHeight(); clip.resize(width, height); return clip; }
rect.setY(boundingBox.getMinY()); rect.setWidth(boundingBox.getWidth()); rect.setHeight(boundingBox.getHeight()); rectangles.add(rect); allRectangles.add(rect);
/** * creates Ripple effect in the center of the control * @return a runnable to release the ripple when needed */ public Runnable createManualRipple() { if(!isRipplerDisabled()) { rippler.setGeneratorCenterX(control.getLayoutBounds().getWidth() / 2); rippler.setGeneratorCenterY(control.getLayoutBounds().getHeight() / 2); rippler.createRipple(); return () -> { // create fade out transition for the ripple releaseRipple(); }; } return () -> { }; }
/*************************************************************************** * * * Public API * * * **************************************************************************/ @Override protected void layoutChildren(final double x, final double y, final double w, final double h) { super.layoutChildren(x, y, w, h); final double height = getSkinnable().getHeight(); linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : snapPosition(promptText.getBaselineOffset() + promptText.getLayoutBounds().getHeight() * .36)); errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h); linesWrapper.updateLabelFloatLayout(); if (invalid) { invalid = false; // update validation container errorContainer.invalid(w); // focus linesWrapper.invalid(); } }
/** * {@inheritDoc} */ @Override protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) { final double strokeWidth = arc.getStrokeWidth(); final double radius = Math.min(contentWidth, contentHeight) / 2 - strokeWidth / 2; final double arcSize = snapSize(radius * 2 + strokeWidth); arcPane.resizeRelocate((contentWidth - arcSize) / 2 + 1, (contentHeight - arcSize) / 2 + 1, arcSize, arcSize); updateArcLayout(radius, arcSize); fillRect.setWidth(arcSize); fillRect.setHeight(arcSize); if (!isValid) { initialize(); isValid = true; } if (!getSkinnable().isIndeterminate()) { arc.setLength(arcLength); if (text.isVisible()) { final double progress = control.getProgress(); int intProgress = (int) Math.round(progress * 100.0); Font font = text.getFont(); text.setFont(Font.font(font.getFamily(), radius / 1.7)); text.setText((progress > 1 ? 100 : intProgress) + "%"); text.relocate((arcSize - text.getLayoutBounds().getWidth()) / 2, (arcSize - text.getLayoutBounds().getHeight()) / 2); } } }
private void createPromptNode() { if (promptText != null || !linesWrapper.usePromptText.get()) { return; } promptText = new Text(); StackPane.setAlignment(promptText, Pos.CENTER_LEFT); // create my custom pane for the prompt node promptText.textProperty().bind(getSkinnable().promptTextProperty()); promptText.fillProperty().bind(linesWrapper.animatedPromptTextFill); promptText.getStyleClass().addAll("text"); promptText.getTransforms().add(linesWrapper.promptTextScale); promptText.visibleProperty().bind(linesWrapper.usePromptText); promptText.setTranslateX(1); linesWrapper.promptContainer.getChildren().add(promptText); if (getSkinnable().isFocused() && ((JFXComboBox<T>) getSkinnable()).isLabelFloat()) { promptText.setTranslateY(-snapPosition(promptText.getBaselineOffset() + promptText.getLayoutBounds().getHeight() * .36)); linesWrapper.promptTextScale.setX(0.85); linesWrapper.promptTextScale.setY(0.85); } }
public void show(Node node) { if (text == null) { text = (Text) node.lookup(".text"); } node = text; if (!isShowing()) { if (node.getScene() == null || node.getScene().getWindow() == null) { throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window."); } Window parent = node.getScene().getWindow(); this.show(parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX(), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + node.getLayoutBounds().getHeight() + shift); ((JFXAutoCompletePopupSkin<T>) getSkin()).animate(); } else { // if already showing update location if needed Window parent = node.getScene().getWindow(); this.show(parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX(), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + node.getLayoutBounds().getHeight() + shift); } } }
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { super.layoutChildren(x, y, w, h); final double height = getSkinnable().getHeight(); linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3); errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h); linesWrapper.updateLabelFloatLayout(); if (invalid) { invalid = false; // set the default background of text area viewport to white Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0); viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); // reapply css of scroll pane in case set by the user viewPort.applyCss(); errorContainer.invalid(w); // focus linesWrapper.invalid(); } }
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { super.layoutChildren(x, y, w, h); final double height = getSkinnable().getHeight(); linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3); errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h); linesWrapper.updateLabelFloatLayout(); if (invalid) { invalid = false; // set the default background of text area viewport to white Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0); viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); // reapply css of scroll pane in case set by the user viewPort.applyCss(); errorContainer.invalid(w); // focus linesWrapper.invalid(); } }
.get(0) .getBoundsInLocal() .getHeight() / 2, Interpolator.EASE_BOTH), new KeyValue(burger.getChildren().get(2).rotateProperty(), -angle, Interpolator.EASE_BOTH), .get(0) .getBoundsInLocal() .getHeight() / 2), Interpolator.EASE_BOTH), new KeyValue(burger.getChildren().get(1).opacityProperty(), 0, Interpolator.EASE_BOTH)
double rateY = this.getHeight() / getClip().getLayoutBounds().getHeight(); double newRate = Math.max(rateX, rateY) * getScalingFactor(); double animationRate = toggleAnimation == null ? -1 : toggleAnimation.getRate(); this.getClip().scaleXProperty().bind(Bindings.createDoubleBinding(() -> { double X = this.getWidth() / getClip().getLayoutBounds().getWidth(); double Y = this.getHeight() / getClip().getLayoutBounds().getHeight(); return Math.max(X, Y) * getScalingFactor(); }, this.widthProperty(), this.heightProperty())); double Y = this.getHeight() / getClip().getLayoutBounds().getHeight(); return Math.max(X, Y) * getScalingFactor(); }, this.widthProperty(), this.heightProperty()));
new KeyValue(this.visibleProperty(), false, Interpolator.EASE_BOTH), new KeyValue(this.translateYProperty(), this.getLayoutBounds().getHeight(), easeInterpolator), new KeyValue(this.opacityProperty(), 0, easeInterpolator)
e -> this.toBack(), new KeyValue(this.visibleProperty(), false, Interpolator.EASE_BOTH), new KeyValue(this.translateYProperty(), this.getLayoutBounds().getHeight(), easeInterpolator), new KeyValue(this.opacityProperty(), 0, easeInterpolator) ),