Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## contrib.ch.randelshofer.quaqua.util
Class Worker

    java.lang.Object
      contrib.ch.randelshofer.quaqua.util.Worker

All Implemented Interfaces:
  java.lang.Runnable

    public abstract class Worker

extends java.lang.Object
implements java.lang.Runnable

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

This class is similar to SwingWorker but less complex. Like a SwingWorker it can run using an an internal worker thread but it can also be like a Runnable object.

Version:
  2.1 2005-10-16 Method start() added.
  2.0 2005-09-27 Revised.
  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
`Worker()`

Method Summary
`abstract java.lang.Object` | `construct()` Compute the value to be returned by the `get` method.
`abstract void` | `finished(java.lang.Object value)` 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.
`void` | `run()` Calls #construct on the current thread and invokes #finished on the AWT event dispatcher thread.
`void` | `start()` Starts the Worker on an internal worker thread.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Worker

    public Worker()

Method Detail

### run

    public final void run()

  Calls #construct on the current thread and invokes #finished on the AWT event dispatcher thread.

  Specified by:
    `run` in interface `java.lang.Runnable`

### construct

    public abstract java.lang.Object construct()

  Compute the value to be returned by the `get` method.

### finished

    public abstract void finished(java.lang.Object value)

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

  Parameters:
    `value` - The return value of the construct method.

### getValue

    protected java.lang.Object getValue()

  Get the value produced by the worker thread, or null if it hasn't been constructed yet.

### start

    public void start()

  Starts the Worker on an internal worker thread.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD