foxtrot.pumps
Class SunJDK141ConditionalEventPump

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

public class SunJDK141ConditionalEventPump
extends SunJDK14ConditionalEventPump

Specialized ConditionalEventPump for Sun's JDK 1.4.1, 1.4.2, 5.0 and 6.0. This class used to implement a workaround for bug #4531693 that has been fixed in JDK 1.4.2 and backported to 1.4.1. However, the handling of sequenced events is very difficult in the JDK itself (especially in conjunction with usage of modal dialogs, which use the same mechanism used by Foxtrot) and various reincarnations of the bug reappeared in JDK 5 and 6. Basically it is dangerous to pump events when the pump starts as a consequence of events delivered with SequencedEvents (such as focus events and window focus events). SequencedEvents must be delivered in sequence, so it is not good to pump the second event in the sequence from the listener of the first event, and this class avoids just that.

Version:
$Revision: 259 $

Nested Class Summary
 
Nested classes/interfaces inherited from class foxtrot.pumps.ConditionalEventPump
ConditionalEventPump.ThrowableHandler
 
Constructor Summary
SunJDK141ConditionalEventPump()
           
 
Method Summary
protected  boolean canPumpEvent(AWTEvent event)
          Returns whether this event can be pumped from the EventQueue.
 
Methods inherited from class foxtrot.pumps.SunJDK14ConditionalEventPump
waitForEvent
 
Methods inherited from class foxtrot.pumps.ConditionalEventPump
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

SunJDK141ConditionalEventPump

public SunJDK141ConditionalEventPump()
Method Detail

canPumpEvent

protected boolean canPumpEvent(AWTEvent event)
Description copied from class: ConditionalEventPump
Returns whether this event can be pumped from the EventQueue. JDK 1.4 introduced SequencedEvent, which is an event holding a list SequencedEvents that should be dispatched in order. Bug #4531693 was caused by the fact that the first SequencedEvent of a list, when dispatched, might end up calling an event listener that displayed a dialog (or called Foxtrot, that uses the same event pumping mechanism); the new event pump might try to dispatch the SequencedEvent second in the list (while the first wasn't completely dispatched yet), causing the application to hang. Bug #4531693 has been fixed in JDK 1.4.2, and backported to 1.4.1, but seems to be sneaking in again in JDK 5 and JDK 6.

Overrides:
canPumpEvent in class ConditionalEventPump


Copyright © 2011 KnowledgePlaza. All Rights Reserved.