|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectTask.AbstractTask
public abstract class AbstractTask
AbstractTask is a super class that encapsulates some common functionality between various types of tasks:
| Nested Class Summary | |
|---|---|
static class |
AbstractTask.PropertyNames
enumeration that holds list of properties that you can attach property change listeners for, right now there's only one, but you can add more in the future. |
static class |
AbstractTask.State
List of all the possible states that any kind of Task (Network, non network, etc) may have. |
static class |
AbstractTask.Type
identifies the type of the task |
| Field Summary | |
|---|---|
protected AutoShutdownSignals[] |
_autoShutdownRay
this holds all the AutoShutdownSignals types that this task will respond to |
protected java.beans.PropertyChangeSupport |
_boundProperties
|
protected java.util.concurrent.locks.Lock |
_boundPropertiesLock
|
protected boolean |
_shutdownCalled
|
protected AbstractTask.State |
_state
|
protected java.lang.String |
_status
|
protected TaskManager |
_taskManager
|
| Constructor Summary | |
|---|---|
AbstractTask()
|
|
| Method Summary | |
|---|---|
protected void |
_assertIsNotShutdown()
makes sure that shutdown() has not been called yet. |
protected void |
_assertNoSwingWorkerCurrentlyActive()
makes sure that an existing SwingWorker is not already in flight. also if cleared for execution (SwingWorker creation). |
void |
addStatusListener(java.beans.PropertyChangeListener l)
PropertyChangeEvent.getNewValue() contains the status message. |
void |
cancel()
This method causes the cancel() method to be called on the underlying SwingWorker object (and thread). |
void |
clearAllStatusListeners()
|
abstract void |
doShutdown()
subclass should implement this method as is appropriate for them. this is called when the task is stopped, based on the AutoShutdownSignals policy |
abstract void |
execute()
|
java.lang.String |
formattedString()
|
AutoShutdownSignals[] |
getAutoShutdownPolicy()
|
protected java.beans.PropertyChangeSupport |
getBoundProperties()
|
java.lang.String |
getDescription()
|
java.lang.String |
getName()
|
java.lang.Object |
getState()
|
java.lang.String |
getStatus()
|
abstract javax.swing.SwingWorker |
getSwingWorker()
|
protected TaskManager |
getTaskManager()
|
abstract AbstractTask.Type |
getType()
|
SwingUIHookAdapter |
getUIHook()
|
boolean |
hasAutoShutdownPolicy(AutoShutdownSignals policy)
returns true if this task has an autostop policy that matches the param |
boolean |
isShutdown()
|
void |
setAutoShutdownPolicy(AutoShutdownSignals... policy)
|
void |
setDescription(java.lang.String descr)
|
void |
setName(java.lang.String name)
|
void |
setState(AbstractTask.State stateValue)
|
void |
setStatus(java.lang.String s)
|
protected void |
setTaskManager(TaskManager container)
|
void |
shutdown()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected AutoShutdownSignals[] _autoShutdownRay
AutoShutdownSignals types that this task will respond to
protected boolean _shutdownCalled
protected TaskManager _taskManager
protected java.util.concurrent.locks.Lock _boundPropertiesLock
protected java.beans.PropertyChangeSupport _boundProperties
protected java.lang.String _status
protected AbstractTask.State _state
| Constructor Detail |
|---|
public AbstractTask()
| Method Detail |
|---|
public abstract AbstractTask.Type getType()
public SwingUIHookAdapter getUIHook()
public AutoShutdownSignals[] getAutoShutdownPolicy()
public void setAutoShutdownPolicy(AutoShutdownSignals... policy)
public boolean isShutdown()
public void shutdown()
public boolean hasAutoShutdownPolicy(AutoShutdownSignals policy)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic abstract void doShutdown()
AutoShutdownSignals policy
protected TaskManager getTaskManager()
protected void setTaskManager(TaskManager container)
public java.lang.String getStatus()
public java.lang.Object getState()
protected java.beans.PropertyChangeSupport getBoundProperties()
public void setStatus(java.lang.String s)
public void setState(AbstractTask.State stateValue)
public void addStatusListener(java.beans.PropertyChangeListener l)
public void propertyChange(PropertyChangeEvent evt) {
_setStatus(evt.getNewValue().toString());
}
public void clearAllStatusListeners()
public abstract javax.swing.SwingWorker getSwingWorker()
public abstract void execute()
throws TaskException
TaskExceptionpublic void cancel()
SwingWorker.isCancelled() in
order for this to work. The InterruptedException will be thrown when this method is called, if need
be.
protected void _assertNoSwingWorkerCurrentlyActive()
throws TaskException
SwingUIHookAdapter.resetCancelFlag(). if a task was cancelled previously,
then that cancellation is not longer active, since the getUIHook() is about to be bound to a new
execution environment (thread/swingworker).
TaskException - TaskException.Type.ExecutionAttemptAfterTaskIsShutdown
protected void _assertIsNotShutdown()
throws TaskException
shutdown() has not been called yet.
TaskException - TaskException.Type.ExecutionAttemptAfterTaskIsShutdownpublic java.lang.String getName()
public java.lang.String getDescription()
public void setName(java.lang.String name)
public void setDescription(java.lang.String descr)
public java.lang.String formattedString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||