Copyright 2012-02-25 Werner Randelshofer

ch.randelshofer.gui.event
Class EventWorker

java.lang.Object
  extended by ch.randelshofer.gui.event.EventWorker
All Implemented Interfaces:
java.awt.ActiveEvent

public abstract class EventWorker
extends java.lang.Object
implements java.awt.ActiveEvent

This is an abstract class that you subclass to perform GUI-related work in a dedicated event dispatcher.

This class is compatible with SwingWorker where it is reasonable to be so. Unlike a SwingWorker it does not use an internal worker thread but has to be dispatched by a dispatcher which handles java.awt.ActiveEvent's.

Version:
1.1.1 2001-08-24 Call finished() within finally block.
1.1 2001-08-24 Reworked for JDK 1.3.
1.0 1998-10-07 Created.
Author:
Werner Randelshofer

Constructor Summary
EventWorker()
           
 
Method Summary
abstract  java.lang.Object construct()
          Compute the value to be returned by the get method.
 void dispatch()
          Calls #construct on the current thread and invokes #finished on the AWT event dispatcher thread.
 void finished()
          Called on the event dispatching thread (not on the worker thread) after the construct method has returned.
protected  java.lang.Object getValue()
          Get the value produced by the worker thread, or null if it hasn't been constructed yet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventWorker

public EventWorker()
Method Detail

dispatch

public void dispatch()
Calls #construct on the current thread and invokes #finished on the AWT event dispatcher thread.

Specified by:
dispatch in interface java.awt.ActiveEvent

construct

public abstract java.lang.Object construct()
Compute the value to be returned by the get method.


finished

public void finished()
Called on the event dispatching thread (not on the worker thread) after the construct method has returned.


getValue

protected java.lang.Object getValue()
Get the value produced by the worker thread, or null if it hasn't been constructed yet.


Copyright 2012-02-25 Werner Randelshofer