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());
}
}
Aggregations