Class EventQueueDispatcher

java.lang.Object
com.nomagic.ui.EventQueueDispatcher

@OpenApi public abstract class EventQueueDispatcher extends Object
AWT event dispatcher which dispatches events in the event queue thread until done condition is encountered.
  • Constructor Details

    • EventQueueDispatcher

      protected EventQueueDispatcher()
      Creates a EventQueueDispatcher and resets done condition.
  • Method Details

    • reset

      protected void reset()
      Resets done condition.

      The method has to be called from event thread.

    • dispatchEvents

      protected void dispatchEvents()
      Dispatches AWT events until done condition is encountered.

      The method has to be called from event thread.

    • dispatchEvents

      protected boolean dispatchEvents(int timeout)
      Dispatches AWT events until done condition is encountered or timeout is reached whatever happens first.

      The method has to be called from event thread.

      Parameters:
      timeout - the timeout or -1 if there is no timeout
      Returns:
      true if dispatching has stopped because of done condition, false if dispatching has stopped because timeout was reached.
    • disposeSequencedEvent

      public static void disposeSequencedEvent()
      This is required to avoid hang.
    • doneDispatching

      public void doneDispatching()
      Sets done condition which causes dispatchEvents method to exit.
    • forceTimeout

      public void forceTimeout()
      Forcefully sets timeout condition which causes dispatchEvents method to exit.
    • isDoneDispatching

      protected boolean isDoneDispatching()

      The method has to be called from event thread.

      Returns:
      true if done condition was encountered.
    • customDispatchMouseEvent

      protected boolean customDispatchMouseEvent(com.nomagic.ui.EventQueueDispatcher.Dispatcher dispatcher, EventQueue eventQueue, MouseEvent mouseEvent)
    • setDispatchTheseEvents

      public final void setDispatchTheseEvents(Predicate<AWTEvent> dispatchTheseEvents)
      Set verification which events needs to be dispatched. For normal UI only invocation events are dispatched.
      Parameters:
      dispatchTheseEvents - predicate to check if event needs to be dispatched
    • getDispatchTheseEvents

      public final Predicate<AWTEvent> getDispatchTheseEvents()