All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.loadui.testfx.utils.WindowUtils Maven / Gradle / Ivy

The newest version!
package org.loadui.testfx.utils;

import com.google.common.base.Predicate;
import javafx.stage.PopupWindow;
import javafx.stage.Stage;
import javafx.stage.Window;

public class WindowUtils {

    public static final Predicate isFocusedPopup = new Predicate() {
        @Override
        public boolean apply(Window window) {
            return window instanceof PopupWindow && window.isFocused();
        }
    };

    public static Predicate isDecendant(final Window window)
    {
        return new Predicate()
        {
            @Override
            public boolean apply( Window input )
            {
                Window parent = null;
                if( input instanceof Stage)
                {
                    parent = ( ( Stage )input ).getOwner();
                }
                else if( input instanceof PopupWindow)
                {
                    parent = ( ( PopupWindow )input ).getOwnerWindow();
                }

                return parent == window || parent != null && apply( parent );
            }
        };
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy