- java.lang.Object
-
- com.iamsoft.util.ui.swing.EnhancedSwingWorker<T,V>
-
- Type Parameters:
T- Result type returned by thisEnhancedSwingWorker'sdoInBackgroundandgetmethods.V- Type used for carrying out intermediate results by thisEnhancedSwingWorker'spublishandprocessmethods.
public abstract class EnhancedSwingWorker<T,V> extends Object
Wrap a real SwingWorker.
-
-
Constructor Summary
Constructors Constructor Description EnhancedSwingWorker()Deprecated.EnhancedSwingWorker(String pName)EnhancedSwingWorker(String pName, Map.Entry<Integer,Integer> pDelay)EnhancedSwingWorker(String pName, Map.Entry<Integer,Integer> pDelay, boolean pMultithread)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(PropertyChangeListener pListener)'progress' property not yet implemented.voidcancel(boolean pMayInterruptIfRunning)protected abstract TdoInBackground()protected voiddone()voidexecute()This method should only be called from the event queue thread.Tget()SwingWorker.StateValuegetState()Unlike SwingWorker.getState(), this method will never return SwingWorker.StateValue.PENDING after SwingWorker.execute() has been called.booleanisCancelled()booleanisDone()static booleanisSuppressingThreading()voidremovePropertyChangeListener(PropertyChangeListener pListener)static voidsetSuppressingThreading(boolean pSuppressingThreading)Can disable multithreading.
-
-
-
Field Detail
-
STATE_PROPERTY
public static final String STATE_PROPERTY
- See Also:
getState(), Constant Field Values
-
-
Constructor Detail
-
EnhancedSwingWorker
@Deprecated public EnhancedSwingWorker()
Deprecated.
-
EnhancedSwingWorker
public EnhancedSwingWorker(String pName)
-
EnhancedSwingWorker
public EnhancedSwingWorker(String pName, Map.Entry<Integer,Integer> pDelay, boolean pMultithread)
- Parameters:
pName- Friendly name used along with System.identityHashCode(Object) to construct identifier.pDelay- Min/max delay in milliseconds.pMultithread- If true, perform work in separate thread.
-
-
Method Detail
-
isSuppressingThreading
public static boolean isSuppressingThreading()
-
setSuppressingThreading
public static void setSuppressingThreading(boolean pSuppressingThreading)
Can disable multithreading. Provided for unit testing. Standard classes should not call.
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener pListener)
'progress' property not yet implemented.- See Also:
STATE_PROPERTY
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener pListener)
-
doInBackground
protected abstract T doInBackground() throws Exception
- Throws:
Exception- See Also:
SwingWorker.doInBackground()
-
done
protected void done()
- See Also:
SwingWorker.done()
-
get
public final T get() throws InterruptedException, ExecutionException
- Throws:
InterruptedExceptionExecutionException- See Also:
SwingWorker.get()
-
execute
public final void execute()
This method should only be called from the event queue thread.- See Also:
SwingWorker.execute()
-
cancel
public void cancel(boolean pMayInterruptIfRunning)
- See Also:
SwingWorker.cancel(boolean)
-
getState
public SwingWorker.StateValue getState()
Unlike SwingWorker.getState(), this method will never return SwingWorker.StateValue.PENDING after SwingWorker.execute() has been called. The decorated worker may be 'pending', but we consider it to be in progress for simplicity's sake? May wish to revisit this.
-
isCancelled
public boolean isCancelled()
- See Also:
SwingWorker.isCancelled()
-
isDone
public boolean isDone()
- See Also:
SwingWorker.isDone()
-
-