Class ComponentShownWaiter

java.lang.Object
java.awt.event.ComponentAdapter
org.fest.swing.driver.ComponentShownWaiter
All Implemented Interfaces:
ComponentListener, EventListener

public final class ComponentShownWaiter extends ComponentAdapter
Understands waiting for a Component to be shown.
  • Field Details

    • DEFAULT_TIMEOUT

      private static final int DEFAULT_TIMEOUT
      See Also:
    • DEFAULT_SLEEP_TIME

      private static final int DEFAULT_SLEEP_TIME
      See Also:
    • toWaitFor

      private Component toWaitFor
    • shown

      private volatile boolean shown
  • Constructor Details

    • ComponentShownWaiter

      private ComponentShownWaiter(Component toWaitFor)
  • Method Details

    • waitTillShown

      public static void waitTillShown(Component toWaitFor)
      Waits until the given component is shown on the screen, using a timeout of 5 seconds.
      Parameters:
      toWaitFor - the component to wait for.
      Throws:
      WaitTimedOutError - if the component is not shown before the default timeout of 5 seconds.
    • waitTillShown

      public static void waitTillShown(Component toWaitFor, long timeout)
      Waits until the given component is shown on the screen.
      Parameters:
      toWaitFor - the component to wait for.
      timeout - the amount to time (in milliseconds) to wait for the component to be shown.
      Throws:
      WaitTimedOutError - if the component is not shown before the given timeout expires.
    • startWaiting

      private void startWaiting(long timeout)
    • alreadyVisible

      private boolean alreadyVisible()
    • componentShown

      @RunsInEDT public void componentShown(ComponentEvent e)
      Notification that the component to wait for is finally shown on the screen.
      Specified by:
      componentShown in interface ComponentListener
      Overrides:
      componentShown in class ComponentAdapter
      Parameters:
      e - the event raised when the component has been made visible.
    • done

      private void done()