public static void main(String[] args) throws Exception { MyEventQueueDelegate delegate = new MyEventQueueDelegate(); EventQueueDelegate.setDelegate(delegate); runTest(delegate); delegate = new MyEventQueueDelegate(); SwingUtilities3.setEventQueueDelegate(getObjectMap(delegate)); runTest(delegate); }
void pumpOneEventForFilters(int id) { AWTEvent event = null; boolean eventOK = false; try { EventQueue eq = null; EventQueueDelegate.Delegate delegate = null; do { // EventQueue may change during the dispatching eq = getEventQueue(); delegate = EventQueueDelegate.getDelegate(); if (delegate != null && id == ANY_EVENT) { event = delegate.getNextEvent(eq); } else { event = (id == ANY_EVENT) ? eq.getNextEvent() : eq.getNextEvent(id); } eventOK = true; synchronized (eventFilters) { for (int i = eventFilters.size() - 1; i >= 0; i--) { EventFilter f = eventFilters.get(i); EventFilter.FilterAction accept = f.acceptEvent(event); if (accept == EventFilter.FilterAction.REJECT) { eventOK = false; break; } else if (accept == EventFilter.FilterAction.ACCEPT_IMMEDIATELY) { break; } } } eventOK = eventOK && SunDragSourceContextPeer.checkEvent(event); if (!eventOK) { event.consume(); } } while (eventOK == false); if (eventLog.isLoggable(PlatformLogger.Level.FINEST)) { eventLog.finest("Dispatching: " + event); } Object handle = null; if (delegate != null) { handle = delegate.beforeDispatch(event); } eq.dispatchEvent(event); if (delegate != null) { delegate.afterDispatch(event, handle); } } catch (ThreadDeath death) { doDispatch = false; throw death; } catch (InterruptedException interruptedException) { doDispatch = false; // AppContext.dispose() interrupts all // Threads in the AppContext } catch (Throwable e) { processException(e); } }
public static void setEventQueueDelegate( Map<String, Map<String, Object>> map) { EventQueueDelegate.setDelegate(new EventQueueDelegateFromMap(map)); }
void pumpOneEventForFilters(int id) { AWTEvent event = null; boolean eventOK = false; try { EventQueue eq = null; EventQueueDelegate.Delegate delegate = null; do { // EventQueue may change during the dispatching eq = getEventQueue(); delegate = EventQueueDelegate.getDelegate(); if (delegate != null && id == ANY_EVENT) { event = delegate.getNextEvent(eq); } else { event = (id == ANY_EVENT) ? eq.getNextEvent() : eq.getNextEvent(id); } eventOK = true; synchronized (eventFilters) { for (int i = eventFilters.size() - 1; i >= 0; i--) { EventFilter f = eventFilters.get(i); EventFilter.FilterAction accept = f.acceptEvent(event); if (accept == EventFilter.FilterAction.REJECT) { eventOK = false; break; } else if (accept == EventFilter.FilterAction.ACCEPT_IMMEDIATELY) { break; } } } eventOK = eventOK && SunDragSourceContextPeer.checkEvent(event); if (!eventOK) { event.consume(); } } while (eventOK == false); if (eventLog.isLoggable(PlatformLogger.FINEST)) { eventLog.finest("Dispatching: " + event); } Object handle = null; if (delegate != null) { handle = delegate.beforeDispatch(event); } eq.dispatchEvent(event); if (delegate != null) { delegate.afterDispatch(event, handle); } } catch (ThreadDeath death) { doDispatch = false; throw death; } catch (InterruptedException interruptedException) { doDispatch = false; // AppContext.dispose() interrupts all // Threads in the AppContext } catch (Throwable e) { processException(e); } }
boolean pumpOneEventForFilters(int id) { AWTEvent event = null; boolean eventOK = false; try { EventQueue eq = null; EventQueueDelegate.Delegate delegate = null; do { // EventQueue may change during the dispatching eq = getEventQueue(); delegate = EventQueueDelegate.getDelegate(); if (delegate != null && id == ANY_EVENT) { event = delegate.getNextEvent(eq); } else { event = (id == ANY_EVENT) ? eq.getNextEvent() : eq.getNextEvent(id); } eventOK = true; synchronized (eventFilters) { for (int i = eventFilters.size() - 1; i >= 0; i--) { EventFilter f = eventFilters.get(i); EventFilter.FilterAction accept = f.acceptEvent(event); if (accept == EventFilter.FilterAction.REJECT) { eventOK = false; break; } else if (accept == EventFilter.FilterAction.ACCEPT_IMMEDIATELY) { break; } } } eventOK = eventOK && SunDragSourceContextPeer.checkEvent(event); if (!eventOK) { event.consume(); } } while (eventOK == false); if (eventLog.isLoggable(PlatformLogger.FINEST)) { eventLog.finest("Dispatching: " + event); } Object handle = null; if (delegate != null) { handle = delegate.beforeDispatch(event); } eq.dispatchEvent(event); if (delegate != null) { delegate.afterDispatch(event, handle); } return true; } catch (ThreadDeath death) { threadDeathCaught = true; return false; } catch (InterruptedException interruptedException) { return false; // AppContext.dispose() interrupts all // Threads in the AppContext } catch (Throwable e) { processException(e); } return true; }