Example usage for javafx.scene Node isVisible

List of usage examples for javafx.scene Node isVisible

Introduction

In this page you can find the example usage for javafx.scene Node isVisible.

Prototype

public final boolean isVisible() 

Source Link

Usage

From source file:com.eviware.loadui.ui.fx.util.NodeUtils.java

public static Node findFrontNodeAtCoordinate(Node root, Point2D point, Node... ignored) {
    if (!root.contains(root.sceneToLocal(point)) || !root.isVisible()) {
        return null;
    }/* w ww .  j av  a  2 s . com*/

    for (Node ignore : ignored) {
        if (isDescendant(ignore, root)) {
            return null;
        }
    }

    if (root instanceof Parent) {
        List<Node> children = ((Parent) root).getChildrenUnmodifiable();
        for (int i = children.size() - 1; i >= 0; i--) {
            Node result = findFrontNodeAtCoordinate(children.get(i), point, ignored);
            if (result != null) {
                return result;
            }
        }
    }

    return root;
}

From source file:com.github.vatbub.tictactoe.view.Main.java

private void updateMenuHeight(boolean includeAILevelSlider) {
    double toHeight = 0;
    int effectiveChildCount = 0;
    for (Node child : menuSubBox.getChildren()) {
        if (child.isVisible() && child != aiLevelTitleLabel && child != aiLevelSlider
                && child != aiLevelLabelPane) {
            toHeight = toHeight + child.getBoundsInParent().getHeight();
            effectiveChildCount = effectiveChildCount + 1;
        }// w  w w  .ja v a 2 s  . co  m
    }

    if (includeAILevelSlider) {
        toHeight = toHeight + aiLevelLabelPane.getPrefHeight();
        toHeight = toHeight + aiLevelSlider.getPrefHeight();
        toHeight = toHeight + aiLevelTitleLabel.getPrefHeight();
        effectiveChildCount = effectiveChildCount + 3;
    }

    toHeight = toHeight + menuSubBox.getSpacing() * (effectiveChildCount - 1);

    if (updateMenuHeightTimeline != null && updateMenuHeightTimeline.getStatus() == Animation.Status.RUNNING) {
        updateMenuHeightTimeline.stop();
    }

    updateMenuHeightTimeline = new Timeline();
    KeyValue keyValue0 = new KeyValue(menuSubBox.prefHeightProperty(), toHeight, Interpolator.EASE_BOTH);
    KeyFrame keyFrame0 = new KeyFrame(Duration.seconds(animationSpeed), keyValue0);
    updateMenuHeightTimeline.getKeyFrames().add(keyFrame0);

    updateMenuHeightTimeline.play();
}

From source file:com.github.vatbub.tictactoe.view.Main.java

private void fadeNode(Node node, double toValue, boolean block, Runnable onFinish) {
    guiAnimationQueue.submit(() -> {//from w ww .  j a v  a2  s .  c o  m
        if (block) {
            guiAnimationQueue.setBlocked(true);
        }
        if (!node.isVisible()) {
            node.setOpacity(0);
            node.setVisible(true);
        }

        FadeTransition fadeTransition = new FadeTransition();
        fadeTransition.setNode(node);
        fadeTransition.setFromValue(node.getOpacity());
        fadeTransition.setToValue(toValue);
        fadeTransition.setDuration(Duration.seconds(animationSpeed));
        fadeTransition.setAutoReverse(false);

        fadeTransition.setOnFinished((event) -> {
            if (toValue == 0) {
                node.setEffect(null);
                node.setVisible(false);
            }
            if (block) {
                guiAnimationQueue.setBlocked(false);
            }
            if (onFinish != null) {
                onFinish.run();
            }
        });

        fadeTransition.play();
    });
}