Search in sources :

Example 6 with Pos

use of javafx.geometry.Pos in project TestFX by TestFX.

the class FxRobot method point.

@Override
public PointQuery point(Scene scene) {
    PointLocator pointLocator = context.getPointLocator();
    Pos pointPosition = context.getPointPosition();
    targetWindow(scene.getWindow());
    return pointLocator.point(scene).atPosition(pointPosition);
}
Also used : Pos(javafx.geometry.Pos) PointLocator(org.testfx.service.locator.PointLocator)

Example 7 with Pos

use of javafx.geometry.Pos in project TestFX by TestFX.

the class FxRobot method point.

@Override
public PointQuery point(Point2D point) {
    PointLocator pointLocator = context.getPointLocator();
    Pos pointPosition = context.getPointPosition();
    return pointLocator.point(point).atPosition(pointPosition);
}
Also used : Pos(javafx.geometry.Pos) PointLocator(org.testfx.service.locator.PointLocator)

Example 8 with Pos

use of javafx.geometry.Pos in project JFoenix by jfoenixadmin.

the class JFXNodesList method layoutChildren.

@Override
protected void layoutChildren() {
    performingLayout = true;
    List<Node> children = getChildren();
    Insets insets = getInsets();
    double width = getWidth();
    double rotate = getRotate();
    double height = getHeight();
    double left = snapSpace(insets.getLeft());
    double right = snapSpace(insets.getRight());
    double space = snapSpace(getSpacing());
    boolean isFillWidth = isFillWidth();
    double contentWidth = width - left - right;
    Pos alignment = getAlignment();
    alignment = alignment == null ? Pos.TOP_CENTER : alignment;
    final HPos hpos = alignment.getHpos();
    final VPos vpos = alignment.getVpos();
    double y = 0;
    for (int i = 0, size = children.size(); i < size; i++) {
        Node child = children.get(i);
        child.autosize();
        child.setRotate(rotate % 180 == 0 ? rotate : -rotate);
        // init child node if not added using addAnimatedChild method
        if (!animationsMap.containsKey(child)) {
            if (child instanceof JFXNodesList) {
                StackPane container = new StackPane(child);
                container.setPickOnBounds(false);
                getChildren().set(i, container);
            }
            initChild(child, i, null, true);
        }
        double x = 0;
        double childWidth = child.getLayoutBounds().getWidth();
        double childHeight = child.getLayoutBounds().getHeight();
        if (childWidth > width) {
            switch(hpos) {
                case CENTER:
                    x = snapPosition(contentWidth - childWidth) / 2;
                    break;
            }
            Node alignToChild = getAlignNodeToChild(child);
            if (alignToChild != null && child instanceof Parent) {
                ((Parent) child).layout();
                double alignedWidth = alignToChild.getLayoutBounds().getWidth();
                double alignedX = alignToChild.getLayoutX();
                if (childWidth / 2 > alignedX + alignedWidth) {
                    alignedWidth = -(childWidth / 2 - (alignedWidth / 2 + alignedX));
                } else {
                    alignedWidth = alignedWidth / 2 + alignedX - childWidth / 2;
                }
                child.setTranslateX(-alignedWidth * Math.cos(Math.toRadians(rotate)));
                child.setTranslateY(alignedWidth * Math.cos(Math.toRadians(90 - rotate)));
            }
        } else {
            childWidth = contentWidth;
        }
        final Insets margin = getMargin(child);
        if (margin != null) {
            childWidth += margin.getLeft() + margin.getRight();
            childHeight += margin.getTop() + margin.getRight();
        }
        layoutInArea(child, x, y, childWidth, childHeight, /* baseline shouldn't matter */
        0, margin, isFillWidth, true, hpos, vpos);
        y += child.getLayoutBounds().getHeight() + space;
        if (margin != null) {
            y += margin.getTop() + margin.getBottom();
        }
        y = snapPosition(y);
    }
    performingLayout = false;
}
Also used : Insets(javafx.geometry.Insets) HPos(javafx.geometry.HPos) Pos(javafx.geometry.Pos) VPos(javafx.geometry.VPos) Parent(javafx.scene.Parent) VPos(javafx.geometry.VPos) Node(javafx.scene.Node) HPos(javafx.geometry.HPos) StackPane(javafx.scene.layout.StackPane)

Example 9 with Pos

use of javafx.geometry.Pos in project TestFX by TestFX.

the class FxRobot method point.

@Override
public PointQuery point(Window window) {
    PointLocator pointLocator = context.getPointLocator();
    Pos pointPosition = context.getPointPosition();
    targetWindow(window);
    return pointLocator.point(window).atPosition(pointPosition);
}
Also used : Pos(javafx.geometry.Pos) PointLocator(org.testfx.service.locator.PointLocator)

Example 10 with Pos

use of javafx.geometry.Pos in project TestFX by TestFX.

the class FxRobot method point.

@Override
public PointQuery point(Node node) {
    PointLocator pointLocator = context.getPointLocator();
    Pos pointPosition = context.getPointPosition();
    targetWindow(node.getScene().getWindow());
    return pointLocator.point(node).onNode(node).atPosition(pointPosition);
}
Also used : Pos(javafx.geometry.Pos) PointLocator(org.testfx.service.locator.PointLocator)

Aggregations

Pos (javafx.geometry.Pos)13 PointLocator (org.testfx.service.locator.PointLocator)6 Node (javafx.scene.Node)3 List (java.util.List)2 EventHandler (javafx.event.EventHandler)2 Insets (javafx.geometry.Insets)2 Color (javafx.scene.paint.Color)2 Font (javafx.scene.text.Font)2 Actor (com.ixale.starparse.domain.Actor)1 Combat (com.ixale.starparse.domain.Combat)1 CombatStats (com.ixale.starparse.domain.stats.CombatStats)1 ActorState (com.ixale.starparse.parser.Parser.ActorState)1 TimeUtils (com.ixale.starparse.time.TimeUtils)1 JFXTreeTableCell (com.jfoenix.controls.cells.editors.base.JFXTreeTableCell)1 ImageMask (eu.hansolo.tilesfx.Tile.ImageMask)1 ItemSortingTopic (eu.hansolo.tilesfx.Tile.ItemSortingTopic)1 SkinType (eu.hansolo.tilesfx.Tile.SkinType)1 TextSize (eu.hansolo.tilesfx.Tile.TextSize)1 TileColor (eu.hansolo.tilesfx.Tile.TileColor)1 TextOrientation (eu.hansolo.tilesfx.chart.SunburstChart.TextOrientation)1