foxtrot.pumps
Class SunJDK14ConditionalEventPump

java.lang.Object
  extended by foxtrot.pumps.ConditionalEventPump
      extended by foxtrot.pumps.SunJDK14ConditionalEventPump
All Implemented Interfaces:
EventPump, EventFilterable
Direct Known Subclasses:
SunJDK140ConditionalEventPump, SunJDK141ConditionalEventPump

public class SunJDK14ConditionalEventPump
extends ConditionalEventPump

Specialized ConditionalEventPump for Sun's JDK 1.4, 5.0 and 6.0. It fixes what I think is a misbehavior of EventQueue.peekEvent(), that does not flush pending events to the EventQueue before peeking for them. The implementation of EventQueue.getNextEvent() calls SunToolkit.flushPendingEvents() before returning the next event, thus ensuring that all events are flushed to the EventQueue. However, the implementation of EventQueue.peekEvent() does not call SunToolkit.flushPendingEvents() resulting in peekEvents() returning null (no events available) while getNextEvent() returns not null (a flushed event).

Version:
$Revision: 255 $

Nested Class Summary
 
Nested classes/interfaces inherited from class foxtrot.pumps.ConditionalEventPump
ConditionalEventPump.ThrowableHandler
 
Constructor Summary
SunJDK14ConditionalEventPump()
           
 
Method Summary
protected  AWTEvent waitForEvent()
          Flushes pending events before waiting for the next event.
 
Methods inherited from class foxtrot.pumps.ConditionalEventPump
canPumpEvent, getEventFilter, getEventQueue, peekEvent, pumpEvents, setEventFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SunJDK14ConditionalEventPump

public SunJDK14ConditionalEventPump()
Method Detail

waitForEvent

protected AWTEvent waitForEvent()
Flushes pending events before waiting for the next event. There is a mismatch between the behavior of EventQueue.getNextEvent() and EventQueue.peekEvent(): the first always flushes pending events, the second does not. This missing flushing is the reason why peekEvent() returns null causing the proxy implementation of Conditional.evaluate() to never return

Overrides:
waitForEvent in class ConditionalEventPump


Copyright © 2011 KnowledgePlaza. All Rights Reserved.