/** * Indicates whether this fixture's {@code Component} is enabled. * * @return {@code true} if this fixture's {@code Component} is enabled; {@code false} otherwise. */ public final boolean isEnabled() { return ComponentEnabledQuery.isEnabled(target()); }
/** * 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 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 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 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(); }
/** * 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 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(); }
/** * 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 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 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(); }
/** * @return a fixture that checks properties of the font of this fixture's {@code Component}. */ public final @Nonnull FontFixture font() { Font font = driver.fontOf(target); return new FontFixture(font, propertyName(target(), FONT_PROPERTY)); }
/** * @return a fixture that checks properties of the foreground color of this fixture's {@code Component}. */ public final @Nonnull ColorFixture foreground() { Color foreground = driver.foregroundOf(target); return new ColorFixture(foreground, propertyName(target(), FOREGROUND_PROPERTY)); }
/** * @return a fixture that checks properties of the background color of this fixture's {@code Component}. */ public final @Nonnull ColorFixture background() { Color background = driver.backgroundOf(target); return new ColorFixture(background, propertyName(target(), BACKGROUND_PROPERTY)); }