/** * Asserts that this fixture's {@code Component} is enabled. * * @param timeout the time this fixture will wait for the component to be enabled. * @return this fixture. * @throws org.assertj.swing.exception.WaitTimedOutError if this fixture's {@code Component} is never enabled. */ public final @Nonnull S requireEnabled(@Nonnull Timeout timeout) { driver.requireEnabled(target(), timeout); return myself(); }
/** * Asserts that this fixture's {@code Component} has input focus. * * @return this fixture. * @throws AssertionError if this fixture's {@code Component} does not have input focus. */ public final @Nonnull S requireFocused() { driver.requireFocused(target()); return myself(); }
/** * Asserts that this fixture's {@code Component} is disabled. * * @return this fixture. * @throws AssertionError if this fixture's {@code Component} is enabled. */ public final @Nonnull S requireDisabled() { driver.requireDisabled(target()); return myself(); }
/** * Simulates a user double-clicking this fixture's {@code Component}. * * @return this fixture. * @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this * fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. */ @Override public final @Nonnull S doubleClick() { driver.doubleClick(target()); return myself(); }
/** * Simulates a user clicking this fixture's {@code Component}. * * @return this fixture. * @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this * fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. */ @Override public final @Nonnull S click() { driver.click(target()); return myself(); }
/** * Simulates a user right-clicking this fixture's {@code Component}. * * @return this fixture. * @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this * fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. */ @Override public final @Nonnull S rightClick() { driver.rightClick(target()); return myself(); }
/** * Simulates a user pressing and releasing the given keys on this fixture's {@code Component}. * * @param keyCodes one or more codes of the keys to press. * @return this fixture. * @throws NullPointerException if the given array of codes is {@code null}. * @throws IllegalArgumentException if any of the given code is not a valid key code. * @throws IllegalStateException if this fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. * @see java.awt.event.KeyEvent */ public final @Nonnull S pressAndReleaseKeys(@Nonnull int... keyCodes) { driver.pressAndReleaseKeys(target(), keyCodes); return myself(); }
/** * Simulates a user pressing the given key on this fixture's {@code Component}, running the given runnable and * releasing the key again. * * @param keyCode the code of the key to press. * @return this fixture. * @throws IllegalArgumentException if any of the given code is not a valid key code. * @throws IllegalStateException if this fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. * @see #pressKey(int) * @see java.awt.event.KeyEvent */ public final @Nonnull S pressKeyWhileRunning(int keyCode, @Nonnull Runnable runnable) { driver.pressKeyWhileRunning(target(), keyCode, runnable); return myself(); }
/** * Gives input focus to this fixture's {@code Component}. * * @return this fixture. * @throws IllegalStateException if this fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. */ public final @Nonnull S focus() { driver.focus(target()); return myself(); }
/** * Asserts that this fixture's {@code Component} is enabled. * * @return this fixture. * @throws AssertionError if this fixture's {@code Component} is disabled. */ public final @Nonnull S requireEnabled() { driver.requireEnabled(target()); return myself(); }
/** * Asserts that this fixture's {@code Component} is visible. * * @return this fixture. * @throws AssertionError if this fixture's {@code Component} is not visible. */ public final @Nonnull S requireVisible() { driver.requireVisible(target()); return myself(); }
/** * Asserts that this fixture's {@code Component} is not visible. * * @return this fixture. * @throws AssertionError if this fixture's {@code Component} is visible. */ public final @Nonnull S requireNotVisible() { driver.requireNotVisible(target()); return myself(); }
/** * Simulates a user clicking this fixture's {@code Component}. * * @param button the button to click. * @return this fixture. * @throws NullPointerException if the given {@code MouseButton} is {@code null}. * @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this * fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. */ @Override public final @Nonnull S click(@Nonnull MouseButton button) { driver.click(target(), button); return myself(); }
/** * Simulates a user clicking this fixture's {@code Component}. * * @param mouseClickInfo specifies the button to click and the times the button should be clicked. * @return this fixture. * @throws NullPointerException if the given {@code MouseClickInfo} is {@code null}. * @throws IllegalStateException if {@link org.assertj.swing.core.Settings#clickOnDisabledComponentsAllowed()} is <code>false</code> and this * fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. */ @Override public final @Nonnull S click(@Nonnull MouseClickInfo mouseClickInfo) { driver.click(target(), mouseClickInfo); return myself(); }
/** * Simulates a user pressing given key with the given modifiers on this fixture's {@code Component}. Modifiers is a * mask from the available AWT {@code InputEvent} masks. * * @param keyPressInfo specifies the key and modifiers to press. * @return this fixture. * @throws NullPointerException if the given {@code KeyPressInfo} is {@code null}. * @throws IllegalArgumentException if the given code is not a valid key code. * @throws IllegalStateException if this fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. * @see KeyPressInfo */ public final @Nonnull S pressAndReleaseKey(@Nonnull KeyPressInfo keyPressInfo) { driver.pressAndReleaseKey(target(), keyPressInfo); return myself(); }
/** * Simulates a user releasing the given key on this fixture's {@code Component}. * * @param keyCode the code of the key to release. * @return this fixture. * @throws IllegalArgumentException if any of the given code is not a valid key code. * @throws IllegalStateException if this fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. * @see java.awt.event.KeyEvent */ public final @Nonnull S releaseKey(int keyCode) { driver.releaseKey(target(), keyCode); return myself(); }
/** * Simulates a user pressing the given key on this fixture's {@code Component}. * * @param keyCode the code of the key to press. * @return this fixture. * @throws IllegalArgumentException if any of the given code is not a valid key code. * @throws IllegalStateException if this fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. * @see #pressKeyWhileRunning(int, Runnable) * @see java.awt.event.KeyEvent */ public final @Nonnull S pressKey(int keyCode) { driver.pressKey(target(), keyCode); return myself(); }
/** * Simulates a user dropping an item to this fixture's {@code Component}. * * @return this fixture. * @throws IllegalStateException if this fixture's {@code Component} is disabled. * @throws IllegalStateException if this fixture's {@code Component} is not showing on the screen. * @throws org.assertj.swing.exception.ActionFailedException if there is no drag action in effect. */ public final @Nonnull S drop() { driver().drop(target()); return myself(); }