Examples of EventQueue


Examples of java.awt.EventQueue

    Map<Window, Boolean> map = newWeakHashMap();
    queueMap.put(toolkit.getSystemEventQueue(), map);
  }

  void addQueueFor(@Nonnull Component component) {
    EventQueue queue = component.getToolkit().getSystemEventQueue();
    Map<Window, Boolean> windowMapping = queueMap.get(queue);
    if (windowMapping == null) {
      windowMapping = createWindowMapping(queue);
    }
    if (!(component instanceof Window) || parentOf(component) != null) {
View Full Code Here

Examples of java.awt.EventQueue

    return windowMapping;
  }

  @RunsInCurrentThread
  void removeMappingFor(@Nonnull Component component) {
    EventQueue queue = component.getToolkit().getSystemEventQueue();
    removeComponent(component, queue);
    for (EventQueue q : queueMap.keySet()) {
      removeComponent(component, q);
    }
  }
View Full Code Here

Examples of java.awt.EventQueue

*/
public class Context_eventQueueFor_Test extends Context_TestCase {
  @Test
  public void should_return_EventQueue_for_Component() {
    when(eventQueueMapping.queueFor(window)).thenReturn(eventQueue);
    EventQueue storedEventQueue = context.eventQueueFor(window);
    assertThat(storedEventQueue).isSameAs(eventQueue);
  }
View Full Code Here

Examples of java.awt.EventQueue

   *
   * @throws EmptyStackException if no previous push was made on this {@code EventQueue}.
   */
  @Override
  public void pop() throws EmptyStackException {
    EventQueue systemEventQueue = toolkit.getSystemEventQueue();
    if (systemEventQueue == this) {
      super.pop();
    }
  }
View Full Code Here

Examples of java.awt.EventQueue

*/
public class EventQueueMapping_addQueueFor_Test extends EventQueueMapping_TestCase {
  @Test
  public void should_add_EventQueue() {
    mapping.addQueueFor(component);
    EventQueue storedEventQueue = queueMap.get(component).get();
    assertThat(storedEventQueue).isSameAs(eventQueue);
  }
View Full Code Here

Examples of java.awt.EventQueue

  EventQueueMapping mapping;
  Map<Component, WeakReference<EventQueue>> queueMap;

  @Before
  public final void setUp() {
    eventQueue = new EventQueue();
    toolkit = newToolkitStub(eventQueue);
    component = new ComponentWithCustomEventQueue(toolkit);
    mapping = new EventQueueMapping();
    queueMap = mapping.queueMap;
  }
View Full Code Here

Examples of java.awt.EventQueue

    verifyZeroInteractions(windows);
  }

  @Test
  public void shouldAddToContextIfComponentEventQueueNotEqualToSystemEventQueue() {
    when(context.storedQueueFor(window)).thenReturn(new EventQueue());
    monitor.eventDispatched(new ComponentEvent(window, WINDOW_CLOSING));
    verify(context).addContextFor(window);
  }
View Full Code Here

Examples of java.awt.EventQueue

    queue.pop();
  }

  @Test
  public void should_not_pop_if_SystemEventQueue_is_not_same_as_queue_under_test() {
    toolkit.eventQueue(new EventQueue());
    queue.pop(); // if really pops should throw an EmptyStackException
  }
View Full Code Here

Examples of java.awt.EventQueue

  // Post the given event to the corresponding event queue for the given component.
  void postEvent(@Nullable Component c, @Nonnull AWTEvent event) {
    // Force an update of the input state, so that we're in synch internally. Otherwise we might post more events before
    // this one gets processed and end up using stale values for those events.
    inputState.update(event);
    EventQueue eventQueue = eventQueueFor(c);
    if (eventQueue != null) {
      eventQueue.postEvent(event);
    }
    pause(settings.delayBetweenEvents());
  }
View Full Code Here

Examples of java.awt.EventQueue

  public void close(@Nonnull Window w) {
    WindowEvent event = new WindowEvent(w, WINDOW_CLOSING);
    // If the window contains an applet, send the event on the applet's queue instead to ensure a shutdown from the
    // applet's context (assists AppletViewer cleanup).
    Component applet = findAppletDescendent(w);
    EventQueue eventQueue = windowMonitor.eventQueueFor(applet != null ? applet : w);
    checkNotNull(eventQueue).postEvent(event);
    waitForIdle();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.