foxtrot.pumps
Interface EventFilterable

All Known Implementing Classes:
ConditionalEventPump, QueueEventPump, SunJDK140ConditionalEventPump, SunJDK141ConditionalEventPump, SunJDK14ConditionalEventPump

public interface EventFilterable

EventPumps that implement this interface have the possibility to filter AWT events before they are dispatched. It is possible to retrieve the current EventPump used by Worker and test if implements this interface; if so, a custom EventFilter may be provided.
Example usage:

 EventPump pump = Worker.getEventPump();
 if (pump instanceof EventFilterable)
 {
    // Save the old filter
    EventFilter old = ((EventFilterable)pump).getEventFilter();
 

try { // Set the custom filter ((EventFilterable)pump).setEventFilter(new EventFilter() { public boolean accept(AWTEvent event) { // Do something with the event... System.out.println("Event:" + event); return true; } });

Worker.post(new Job() { public Object run() { // ... } }); } finally { // Restore the old filter ((EventFilterable)pump).setEventFilter(old); } }

Absolute care must be used when filtering AWT events, as your Swing application may not work properly if AWT events are not dispatched properly.

Version:
$Revision: 255 $

Method Summary
 EventFilter getEventFilter()
          Returns the EventFilter
 void setEventFilter(EventFilter filter)
          Sets the EventFilter
 

Method Detail

setEventFilter

void setEventFilter(EventFilter filter)
Sets the EventFilter

See Also:
getEventFilter()

getEventFilter

EventFilter getEventFilter()
Returns the EventFilter

See Also:
setEventFilter(foxtrot.pumps.EventFilter)


Copyright © 2011 KnowledgePlaza. All Rights Reserved.