de.bielefeld.umweltamt.aui.utils
Class SwingWorkerVariant

java.lang.Object
  extended by de.bielefeld.umweltamt.aui.utils.SwingWorkerVariant

public abstract class SwingWorkerVariant
extends java.lang.Object

This is a variant of the SwingWorker It works in conjunction with the GlassPane class to allow users to execute timeconsuming task on a separate thread The GlassPane addition can prevent users from executing another SwingWorker task while one SwingWorker task is already executing Ein bisschen von mir ans AUI-K angepasst und modifiziert um HibernateExceptions korrekt zu fangen.

Author:
Yexin Chen, David Klotz

Field Summary
protected  boolean fatalError
           
 
Constructor Summary
SwingWorkerVariant(java.awt.Component aComponent)
          Start a thread that will call the construct method and then exit.
 
Method Summary
protected abstract  void doNonUILogic()
          This method will be implemented by the inner class of SwingWorker It should only consist of the logic that's unrelated to UI
protected abstract  void doUIUpdateLogic()
          This method will be implemented by the inner class of SwingWorker It should only consist of the logic that's related to UI updating, after the doNonUILogic() method is done.
protected  void finished()
          Called on the event dispatching thread (not on the worker thread) after the construct method has returned.
protected  java.awt.Component getAComponent()
          Getter method
protected  GlassPane getGlassPane()
          Getter method
 void interrupt()
          A new method that interrupts the worker thread.
protected  void setAComponent(java.awt.Component newAComponent)
          Setter method
protected  void setGlassPane(GlassPane newGlassPane)
          Setter method
 void start()
          Start the worker thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fatalError

protected boolean fatalError
Constructor Detail

SwingWorkerVariant

public SwingWorkerVariant(java.awt.Component aComponent)
Start a thread that will call the construct method and then exit.

Parameters:
aComponent - a reference to the UI component that's directly using SwingWorker
Method Detail

doNonUILogic

protected abstract void doNonUILogic()
                              throws java.lang.RuntimeException
This method will be implemented by the inner class of SwingWorker It should only consist of the logic that's unrelated to UI

Throws:
java.lang.RuntimeException - thrown if there are any errors in the non-ui logic

doUIUpdateLogic

protected abstract void doUIUpdateLogic()
                                 throws java.lang.RuntimeException
This method will be implemented by the inner class of SwingWorker It should only consist of the logic that's related to UI updating, after the doNonUILogic() method is done.

Throws:
java.lang.RuntimeException - thrown if there are any problems executing the ui update logic

finished

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


getAComponent

protected java.awt.Component getAComponent()
Getter method

Returns:
java.awt.Component

getGlassPane

protected GlassPane getGlassPane()
Getter method

Returns:
GlassPane

interrupt

public void interrupt()
A new method that interrupts the worker thread. Call this method to force the worker to stop what it's doing.


setAComponent

protected void setAComponent(java.awt.Component newAComponent)
Setter method

Parameters:
newAComponent - java.awt.Component

setGlassPane

protected void setGlassPane(GlassPane newGlassPane)
Setter method

Parameters:
newGlassPane - GlassPane

start

public void start()
Start the worker thread.