public void layoutLines(double x, double y, double w, double h, double controlHeight, double translateY) { this.contentHeight = translateY; clip.setY(-contentHeight); clip.setHeight(controlHeight + contentHeight); focusedLine.resizeRelocate(x, controlHeight, w, focusedLine.prefHeight(-1)); line.resizeRelocate(x, controlHeight, w, line.prefHeight(-1)); promptContainer.resizeRelocate(x, y, w, h); scale.setPivotX(w / 2); }
private void updateHeaderContainerClip() { final double clipOffset = getClipOffset(); final Side side = getSkinnable().getSide(); double controlPrefWidth = 2 * snapSize(rightControlButton.prefWidth(-1)); // Add the spacer if the control buttons are shown // controlPrefWidth = controlPrefWidth > 0 ? controlPrefWidth + SPACER : controlPrefWidth; measureClosingTabs = true; final double headersPrefWidth = snapSize(headersRegion.prefWidth(-1)); final double headersPrefHeight = snapSize(headersRegion.prefHeight(-1)); measureClosingTabs = false; final double maxWidth = snapSize(getWidth()) - controlPrefWidth - clipOffset; final double clipWidth = headersPrefWidth < maxWidth ? headersPrefWidth : maxWidth; final double clipHeight = headersPrefHeight; clip.setX((side == Side.LEFT || side == Side.BOTTOM) && headersPrefWidth >= maxWidth ? headersPrefWidth - maxWidth : 0); clip.setY(0); clip.setWidth(clipWidth); clip.setHeight(clipHeight); }
clip.setY(gap / 2); clip.setHeight(getHeight() - gap); gapAnimation = new Timeline(new KeyFrame(Duration.millis(240), playExpandAnimation = false; } else if (selectionChanged) { clip.setY(0); clip.setHeight(getHeight()); gapAnimation = new Timeline( clip.setY(gap / 2); clip.setHeight(getHeight() - gap); clip.setY(0); clip.setHeight(getHeight());
/** * Resized the specified rectangle so that its upper left point is {@code (0, 0)} and its width and height are * both 0. * * @param rectangle * the {@link Rectangle} which will be resized */ private static void resizeRectangleToZero(Rectangle rectangle) { rectangle.setX(0); rectangle.setY(0); rectangle.setWidth(0); rectangle.setHeight(0); }
/** * Updates the position and size of {@link #selectedArea} (and by binding that of {@link #unselectedArea}) to the * specified arguments. * * @param x * the new x coordinate of the upper left corner * @param y * the new y coordinate of the upper left corner * @param width * the new width * @param height * the new height */ private void setSelection(double x, double y, double width, double height) { selectedArea.setX(x); selectedArea.setY(y); selectedArea.setWidth(width); selectedArea.setHeight(height); }
@Override protected void layoutChildren(double x, double y, double w, double h) { final double notificationBarHeight = notificationBar.prefHeight(w); notificationBar.resize(w, notificationBarHeight); // layout the content if (content != null) { content.resizeRelocate(x, y, w, h); } // and update the clip so that the notification bar does not draw outside // the bounds of the notification pane clip.setX(x); clip.setY(y); clip.setWidth(w); clip.setHeight(h); }
public void layoutLines(double x, double y, double w, double h, double controlHeight, double translateY) { this.contentHeight = translateY; clip.setY(-contentHeight); clip.setHeight(controlHeight + contentHeight); focusedLine.resizeRelocate(x, controlHeight, w, focusedLine.prefHeight(-1)); line.resizeRelocate(x, controlHeight, w, line.prefHeight(-1)); promptContainer.resizeRelocate(x, y, w, h); scale.setPivotX(w / 2); }
public void performDrag( Parent root, MouseEvent event) { rectangle.setVisible(true); final double parentScaleX = root. localToSceneTransformProperty().getValue().getMxx(); final double parentScaleY = root. localToSceneTransformProperty().getValue().getMyy(); final double translateX = -root. localToSceneTransformProperty().getValue().getTx(); final double translateY = -root. localToSceneTransformProperty().getValue().getTy(); secondX = event.getSceneX(); secondY = event.getSceneY(); firstX = Math.max(firstX, 0); firstY = Math.max(firstY, 0); secondX = Math.max(secondX, 0); secondY = Math.max(secondY, 0); double x = Math.min(firstX, secondX); double y = Math.min(firstY, secondY); double width = Math.abs(secondX - firstX); double height = Math.abs(secondY - firstY); rectangle.setX(x / parentScaleX + translateX / parentScaleX); rectangle.setY(y / parentScaleY + translateY / parentScaleY); rectangle.setWidth(width / parentScaleX); rectangle.setHeight(height / parentScaleY); selectIntersectingNodes(root, !event.isControlDown()); }
private Shape createSegmentedShape(double width, double heigth, List<Integer> visibleSegments) { double segmentWidth = width/3; double segmentHeight = heigth/3; Shape shape = new Rectangle(); for (Integer visibleSegment : visibleSegments) { Rectangle rect = new Rectangle(); rect.setWidth(segmentWidth); rect.setHeight(segmentHeight); int row = (visibleSegment-1) / 3; int col = (visibleSegment-1) % 3; rect.setY(row * segmentHeight); rect.setX(col * segmentWidth); shape = Shape.union(shape, rect); } return shape; }
/** * Resized the specified rectangle so that it matches the specified bounds, i.e. it will have the same upper * left point and width and height. * * @param rectangle * the {@link Rectangle} which will be resized * @param bounds * the {@link Bounds} to which the rectangle will be resized */ private static void resizeRectangleToBounds(Rectangle rectangle, Bounds bounds) { rectangle.setX(bounds.getMinX()); rectangle.setY(bounds.getMinY()); rectangle.setWidth(bounds.getWidth()); rectangle.setHeight(bounds.getHeight()); }
@Override protected void layoutChildren() { double size = Math.min(getWidth(), getHeight()); leg1.setStartX(size / 2); leg1.setStartY(size * MARGIN); leg1.setEndX(size / 2); leg1.setEndY(size * BOX_MARGIN); leg2.setStartX(size / 2); leg2.setStartY(size * (1 - MARGIN)); leg2.setEndX(size / 2); leg2.setEndY(size * (1 - BOX_MARGIN)); box.setX(size * BOX_MARGIN); box.setY(size * BOX_MARGIN); box.setWidth(size * (1 - 2 * BOX_MARGIN)); box.setHeight(size * (1 - 2 * BOX_MARGIN)); } }
shadowRectangle.setHeight(h - SHADOW_WIDTH * 2); shadowRectangle.setX(SHADOW_WIDTH); shadowRectangle.setY(SHADOW_WIDTH); } else if (node == backgroundRect) { backgroundRect.setWidth(w - SHADOW_WIDTH * 2); backgroundRect.setHeight(h - SHADOW_WIDTH * 2); backgroundRect.setX(SHADOW_WIDTH); backgroundRect.setY(SHADOW_WIDTH); } else if (node == stageDecoration) { stageDecoration.resize(w - SHADOW_WIDTH * 2 - ROUNDED_DELTA * 2, h - SHADOW_WIDTH * 2 - ROUNDED_DELTA * 2);
(observable, oldValue, newValue) -> slaveClip.setY(newValue.doubleValue())); clip.widthProperty().addListener((observable, oldValue, newValue) -> { slaveClip.setWidth(newValue.doubleValue());
@Override protected void layoutChildren() { int space = 0; int w = 16; this.horizontal.resizeRelocate(0, getHeight() - w, getWidth() - w , w); this.vertical.resizeRelocate(getWidth() - w, 0, w, getHeight()- w); if (this.center != null) { this.clip.setX(0); this.clip.setY(0); this.clip.setWidth(getWidth() - w - space); this.clip.setHeight(getHeight() - w - space); this.center.resizeRelocate(0, 0, getWidth() - w - space, getHeight() - w - space); } }
@SuppressWarnings("MethodDoesntCallSuperMethod") @Override protected void layoutChildren() { double width = getWidth(); double height = getHeight(); double labelPrefWidth = label.prefWidth(height); double labelPrefHeight = label.prefHeight(width); rectangle.setX(0); rectangle.setY(0); rectangle.setWidth(labelPrefWidth + 10); rectangle.setHeight(labelPrefHeight + 6); label.resizeRelocate(5, 3, labelPrefWidth, labelPrefHeight); line.setStartX(width / 2.0); line.setEndX(line.getStartX()); line.setStartY(rectangle.getHeight()); line.setEndY(height); }
private void updateHeaderContainerClip() { final double clipOffset = getClipOffset(); final Side side = getSkinnable().getSide(); double controlPrefWidth = 2 * snapSize(rightControlButton.prefWidth(-1)); // Add the spacer if the control buttons are shown // controlPrefWidth = controlPrefWidth > 0 ? controlPrefWidth + SPACER : controlPrefWidth; measureClosingTabs = true; final double headersPrefWidth = snapSize(headersRegion.prefWidth(-1)); final double headersPrefHeight = snapSize(headersRegion.prefHeight(-1)); measureClosingTabs = false; final double maxWidth = snapSize(getWidth()) - controlPrefWidth - clipOffset; final double clipWidth = headersPrefWidth < maxWidth ? headersPrefWidth : maxWidth; final double clipHeight = headersPrefHeight; clip.setX((side == Side.LEFT || side == Side.BOTTOM) && headersPrefWidth >= maxWidth ? headersPrefWidth - maxWidth : 0); clip.setY(0); clip.setWidth(clipWidth); clip.setHeight(clipHeight); }
clip.setY(gap / 2); clip.setHeight(getHeight() - gap); gapAnimation = new Timeline(new KeyFrame(Duration.millis(240), playExpandAnimation = false; } else if (selectionChanged) { clip.setY(0); clip.setHeight(getHeight()); gapAnimation = new Timeline( clip.setY(gap / 2); clip.setHeight(getHeight() - gap); clip.setY(0); clip.setHeight(getHeight());
/** * Compute the needed clip for stage's shadow border * * @param newBounds * @param shadowVisible */ void setShadowClip(Bounds newBounds) { external.relocate(newBounds.getMinX() - SHADOW_WIDTH, newBounds.getMinY() - SHADOW_WIDTH); internal.setX(SHADOW_WIDTH); internal.setY(SHADOW_WIDTH); internal.setWidth(newBounds.getWidth()); internal.setHeight(newBounds.getHeight()); internal.setArcWidth(shadowRectangle.getArcWidth()); // shadowRectangle // CSS cannot be // applied on // this internal.setArcHeight(shadowRectangle.getArcHeight()); external.setWidth(newBounds.getWidth() + SHADOW_WIDTH * 2); external.setHeight(newBounds.getHeight() + SHADOW_WIDTH * 2); Shape clip = Shape.subtract(external, internal); shadowRectangle.setClip(clip); }
/** * Activate dock feedback on screen's bounds * * @param x * @param y */ public void setDockFeedbackVisible(double x, double y, double width, double height) { dockFeedbackPopup.setX(x); dockFeedbackPopup.setY(y); dockFeedback.setX(SHADOW_WIDTH); dockFeedback.setY(SHADOW_WIDTH); dockFeedback.setHeight(height - SHADOW_WIDTH * 2); dockFeedback.setWidth(width - SHADOW_WIDTH * 2); dockFeedbackPopup.setWidth(width); dockFeedbackPopup.setHeight(height); dockFeedback.setOpacity(1); dockFeedbackPopup.show(); dockFadeTransition = new FadeTransition(); dockFadeTransition.setDuration(Duration.millis(200)); dockFadeTransition.setNode(dockFeedback); dockFadeTransition.setFromValue(0); dockFadeTransition.setToValue(1); dockFadeTransition.setAutoReverse(true); dockFadeTransition.setCycleCount(3); dockFadeTransition.play(); }
clip.setY(0); clip.widthProperty().bind(getSkinnable().widthProperty()); clip.heightProperty().bind(getSkinnable().heightProperty());