Search in sources :

Example 46 with JavaFXLibraryNonFatalException

use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.

the class HelperFunctions method waitUntilEnabled.

public static Node waitUntilEnabled(Object target, int timeout) {
    if (target instanceof String)
        target = waitUntilExists((String) target, timeout, "SECONDS");
    final Object finalTarget = target;
    robotLog("TRACE", "Waiting until target \"" + target.toString() + "\" becomes enabled, timeout=" + Integer.toString(timeout));
    try {
        WaitForAsyncUtils.waitFor((long) timeout, TimeUnit.SECONDS, () -> Matchers.is(isEnabled()).matches(finalTarget));
        return (Node) target;
    } catch (JavaFXLibraryNonFatalException nfe) {
        throw nfe;
    } catch (TimeoutException te) {
        throw new JavaFXLibraryNonFatalException("Given target \"" + target.toString() + "\" did not become enabled within given timeout of " + Integer.toString(timeout) + " seconds.");
    } catch (Exception e) {
        throw new JavaFXLibraryNonFatalException("Something went wrong while waiting target to be enabled: " + e.getMessage());
    }
}
Also used : JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) Node(javafx.scene.Node) TimeoutException(java.util.concurrent.TimeoutException) JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ConditionTimeoutException(org.awaitility.core.ConditionTimeoutException) TimeoutException(java.util.concurrent.TimeoutException) ConditionTimeoutException(org.awaitility.core.ConditionTimeoutException)

Aggregations

JavaFXLibraryNonFatalException (javafxlibrary.exceptions.JavaFXLibraryNonFatalException)46 RobotKeyword (org.robotframework.javalib.annotation.RobotKeyword)32 ArgumentNames (org.robotframework.javalib.annotation.ArgumentNames)28 Node (javafx.scene.Node)15 Method (java.lang.reflect.Method)6 TimeoutException (java.util.concurrent.TimeoutException)6 ConditionTimeoutException (org.awaitility.core.ConditionTimeoutException)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 PseudoClass (javafx.css.PseudoClass)5 Window (javafx.stage.Window)5 Scene (javafx.scene.Scene)4 JavaFXLibraryFatalException (javafxlibrary.exceptions.JavaFXLibraryFatalException)4 BoundingBox (javafx.geometry.BoundingBox)3 Image (javafx.scene.image.Image)3 TableViewSkin (com.sun.javafx.scene.control.skin.TableViewSkin)2 VirtualFlow (com.sun.javafx.scene.control.skin.VirtualFlow)2 URL (java.net.URL)2 URLClassLoader (java.net.URLClassLoader)2 JarFile (java.util.jar.JarFile)2 ObservableList (javafx.collections.ObservableList)2