/** * 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; }
protected void setOverLayBounds(Rectangle overlay){ overlay.setWidth(control.getLayoutBounds().getWidth()); overlay.setHeight(control.getLayoutBounds().getHeight()); }
@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; }
@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 public void initAnimation(Node contentContainer, Node overlay) { overlay.setOpacity(0); contentContainer.setTranslateY(contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY()); }
@Override public void initAnimation(Node contentContainer, Node overlay) { overlay.setOpacity(0); contentContainer.setTranslateX(-(contentContainer.getLayoutX() + contentContainer.getLayoutBounds().getMaxX())); }
@Override public void initAnimation(Node contentContainer, Node overlay) { overlay.setOpacity(0); contentContainer.setTranslateX(contentContainer.getLayoutX() + contentContainer.getLayoutBounds().getMaxX()); }
@Override public void initAnimation(Node contentContainer, Node overlay) { overlay.setOpacity(0); contentContainer.setTranslateY(-(contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY())); }
/** * 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 () -> { }; }
OverLayRipple() { super(); setOverLayBounds(this); this.getStyleClass().add("jfx-rippler-overlay"); // update initial position if(JFXRippler.this.getChildrenUnmodifiable().contains(control)) { double diffMinX = Math.abs(control.getBoundsInLocal().getMinX() - control.getLayoutBounds().getMinX()); double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY()); Bounds bounds = control.getBoundsInParent(); this.setX(bounds.getMinX() + diffMinX - snappedLeftInset()); this.setY(bounds.getMinY() + diffMinY - snappedTopInset()); } // set initial attributes setOpacity(0); setCache(true); setCacheHint(CacheHint.SPEED); setCacheShape(true); setManaged(false); } }
@Override protected void layoutChildren(double x, double y, double w, double h) { updateDisclosureNode(); double disclosureWidth = 0; Node disclosureNode = ((JFXTreeTableCell<S, T>) getSkinnable()).getDisclosureNode(); if (disclosureNode.isVisible()) { Pos alignment = getSkinnable().getAlignment(); alignment = alignment == null ? Pos.CENTER_LEFT : alignment; layoutInArea(disclosureNode, x + 8, y, w, h, 0, Insets.EMPTY, false, false, HPos.LEFT, VPos.CENTER); disclosureWidth = disclosureNode.getLayoutBounds().getWidth() + 18; } super.layoutChildren(x + disclosureWidth, y, w - disclosureWidth, h); } }
double borderWidth = ripplerPane.getBorder() != null ? ripplerPane.getBorder().getInsets().getTop() : 0; Bounds bounds = control.getBoundsInParent(); double width = control.getLayoutBounds().getWidth(); double height = control.getLayoutBounds().getHeight(); double diffMinX = Math.abs(control.getBoundsInLocal().getMinX() - control.getLayoutBounds().getMinX()); double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY()); double diffMaxX = Math.abs(control.getBoundsInLocal().getMaxX() - control.getLayoutBounds().getMaxX()); double diffMaxY = Math.abs(control.getBoundsInLocal().getMaxY() - control.getLayoutBounds().getMaxY()); Node mask; switch (getMaskType()) {
private void updateTextPos() { double textWidth = textNode.getLayoutBounds().getWidth(); final double promptWidth = promptText == null ? 0 : promptText.getLayoutBounds().getWidth(); switch (getHAlignment()) { case CENTER: linesWrapper.promptTextScale.setPivotX(promptWidth / 2); double midPoint = textRight.get() / 2; double newX = midPoint - textWidth / 2; if (newX + textWidth <= textRight.get()) { textTranslateX.set(newX); } break; case LEFT: linesWrapper.promptTextScale.setPivotX(0); break; case RIGHT: linesWrapper.promptTextScale.setPivotX(promptWidth); break; } }
private void updateTextPos() { double textWidth = textNode.getLayoutBounds().getWidth(); final double promptWidth = promptText == null ? 0 : promptText.getLayoutBounds().getWidth(); switch (getHAlignment()) { case CENTER: linesWrapper.promptTextScale.setPivotX(promptWidth / 2); double midPoint = textRight.get() / 2; double newX = midPoint - textWidth / 2; if (newX + textWidth <= textRight.get()) { textTranslateX.set(newX); } break; case LEFT: linesWrapper.promptTextScale.setPivotX(0); break; case RIGHT: linesWrapper.promptTextScale.setPivotX(promptWidth); break; } }
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); } } }
return; double rateX = this.getWidth() / getClip().getLayoutBounds().getWidth(); double rateY = this.getHeight() / getClip().getLayoutBounds().getHeight(); double newRate = Math.max(rateX, rateY) * getScalingFactor(); double animationRate = toggleAnimation == null ? -1 : toggleAnimation.getRate(); if (toggleAnimation.getRate() == 1) { 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 X = this.getWidth() / getClip().getLayoutBounds().getWidth(); double Y = this.getHeight() / getClip().getLayoutBounds().getHeight(); return Math.max(X, Y) * getScalingFactor(); }, this.widthProperty(), this.heightProperty()));
public HorizontalTransition(boolean leftDirection, Node contentContainer, Node overlay) { super(contentContainer, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentContainer.translateXProperty(), (contentContainer.getLayoutX() + contentContainer.getLayoutBounds().getMaxX()) * (leftDirection? -1 : 1), Interpolator.LINEAR), new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(contentContainer.translateXProperty(), 0, Interpolator.EASE_OUT) ))); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }
public VerticalTransition(boolean topDirection, Node contentContainer, Node overlay) { super(contentContainer, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentContainer.translateYProperty(), (contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY()) * (topDirection? -1 : 1), Interpolator.LINEAR), new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(contentContainer.translateYProperty(), 0, Interpolator.EASE_OUT) ))); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }
private static Timeline createTimeline(JFXHamburger burger) { double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth(); double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren() .get(0)
private static Timeline createTimeline(JFXHamburger burger) { double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth(); double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren() .get(0)