@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()); }
((Parent) child).layout(); double alignedWidth = alignToChild.getLayoutBounds().getWidth(); double alignedX = alignToChild.getLayoutX(); if(childWidth / 2 > alignedX + alignedWidth){ alignedWidth = -(childWidth / 2 - (alignedWidth/2 + alignedX));
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)); } }
double minX = Double.MAX_VALUE; double maxX = Double.MIN_VALUE; for (int i = 0; i < children.size(); i++) { Node node = children.get(i); if (node.isManaged()) { final double x = node.getLayoutBounds().getMinX() + node.getLayoutX(); minX = Math.min(minX, x); maxX = Math.max(maxX, x + node.minWidth(-1)); } }
@Override public double layoutY(Node node) { return node.getLayoutX(); }
@Override public double layoutX(Node node) { return node.getLayoutX(); }
import javafx.scene.Node; import javafx.scene.paint.Paint; import javafx.scene.shape.Rectangle; public class City extends Rectangle { public City(final Node node) { super(node.getLayoutX(), node.getLayoutY(), 32, 32); this.setFill(Paint.valueOf("BLUE")); } }
//gets the display region of the chart Node chartPlotArea = chart.lookup(".chart-plot-background"); double chartZeroX = chartPlotArea.getLayoutX(); double chartZeroY = chartPlotArea.getLayoutY();
private void clickOnMe(ObservableList<Node> nodes){ for(Node n : nodes){ n.fireEvent(new MouseEvent(MouseEvent.MOUSE_CLICKED, n.getLayoutX(), n.getLayoutY(), n.getLayoutX(), n.getLayoutY(), MouseButton.PRIMARY, 1, true, true, true, true, true, true, true, true, true, true, null)); } }
@Override protected double computeValue() { return senderNode.getLayoutX() + senderNode.getTranslateX() + senderShape.getRadius(); } };
@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()); }
private static Rectangle2D getBounds(Node node) { Bounds lBounds = node.getLayoutBounds(); return new Rectangle2D( node.getLayoutX(), node.getLayoutY(), lBounds.getWidth(), lBounds.getHeight() ); }
@Override protected void layoutChildren() { getParent().requestLayout(); super.layoutChildren(); for (Node n : getManagedChildren()) { if (n instanceof Region) { Region p = (Region) n; double width = Math.max(p.getMinWidth(), p.getPrefWidth()); double height = Math.max(p.getMinHeight(), p.getPrefHeight()); n.resize(width, height); double nX = Math.min(0, n.getLayoutX()); double nY = Math.min(0, n.getLayoutY()); n.relocate(nX, nY); } } }
protected void mouseClicked(MouseEvent mouseEvent) { if (axisEventHandler != null) { Node node = (Node) mouseEvent.getSource(); double position = node.getLayoutX() + node.getLayoutBounds().getWidth() / 2; DateTime clickedDate = getValueForDisplay(position); AxisEvent<DateTime> event = new AxisEvent<>(clickedDate); axisEventHandler.handle(event); } }
public AssertNode assertXYWH(double x, double y, double w, double h, double accuracy) { Assert.assertEquals(description + ", X", x, node.getLayoutX(), accuracy); Assert.assertEquals(description + ", Y", y, node.getLayoutY(), accuracy); Assert.assertEquals(description + ", W", w, width(node), accuracy); Assert.assertEquals(description + ", H", h, height(node), accuracy); return this; }
EventHandler<MouseEvent> onMouseReleasedEventHandler = new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { fixPosition((Node) t.getSource()); } }; resource.setOnMouseReleased(onMouseReleasedEventHandler); private void fixPosition( Node node) { double x = node.getTranslateX(); double y = node.getTranslateY(); node.relocate(node.getLayoutX() + x, node.getLayoutY() + y); node.setTranslateX(0); node.setTranslateY(0); }
protected void initSenderAndReceiver() { receiverConnectorUI = new Circle(15); final VNode sender = getSender().getNode(); final FXFlowNodeSkin senderSkin = (FXFlowNodeSkin) getController(). getNodeSkinLookup().getById(skinFactory, sender.getId()); senderShape = senderSkin.getConnectorShape(getSender()); final Node senderNode = senderShape.getNode(); senderConnectorUI = senderShape; receiverConnectorUI.setLayoutX(senderNode.getLayoutX() +receiverConnectorUI.getRadius()); receiverConnectorUI.setLayoutY(senderNode.getLayoutY() +receiverConnectorUI.getRadius()); }
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)); } }