Package java.awt

Examples of java.awt.EventQueue


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


  }

  @Test
  public void should_return_null_if_EventQueue_reference_is_null() {
    queueMap.put(component, null);
    EventQueue storedEventQueue = mapping.storedQueueFor(component);
    assertThat(storedEventQueue).isNull();
  }
View Full Code Here

  WindowEventQueueMapping mapping;
  Map<EventQueue, Map<Window, Boolean>> queueMap;

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

class EventQueueMapping {
  final Map<Component, WeakReference<EventQueue>> queueMap = newWeakHashMap();

  @RunsInCurrentThread
  void addQueueFor(@Nonnull Component c) {
    EventQueue queue = c.getToolkit().getSystemEventQueue();
    queueMap.put(c, new WeakReference<EventQueue>(queue));
  }
View Full Code Here

    queueMap.put(c, new WeakReference<EventQueue>(queue));
  }

  @RunsInCurrentThread
  @Nullable EventQueue queueFor(@Nonnull Component c) {
    EventQueue queue = storedQueueFor(c);
    if (queue == null) {
      return c.getToolkit().getSystemEventQueue();
    }
    return queue;
  }
View Full Code Here

  }

  @Nonnull Collection<EventQueue> eventQueues() {
    Set<EventQueue> eventQueues = newHashSet();
    for (WeakReference<EventQueue> reference : queueMap.values()) {
      EventQueue queue = queueFrom(reference);
      if (queue != null) {
        eventQueues.add(queue);
      }
    }
    return eventQueues;
View Full Code Here

    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

    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

*/
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

   *
   * @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

TOP

Related Classes of java.awt.EventQueue

Copyright © 2018 www.massapicom. 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.