|
Side of Software Wizard Library 1.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--sos.wizard.AbstractModel
|
+--sos.wizard.AbstractTask
A partial implementation of the Task interface. A subclass
need only implement run. The run method
should invoke setProgress whenever it makes progress
toward completing the task.
If a subclass wishes to
be interruptible, it should override isInterruptible
to return true, and it should
periodically invoke shouldAbort.
If shouldAbort returns true, it should
gracefully unwind and return.
This class handles the notification of progress listeners, the notification of subtask listeners, the setting and retrieving of the progress, and the suspending and resuming of the execution.
| Constructor Summary | |
AbstractTask()
Creates an AbstractTask with no name. |
|
AbstractTask(java.lang.String name)
Creates an AbstractTask with the specified name. |
|
| Method Summary | |
void |
addListDataListener(javax.swing.event.ListDataListener l)
Adds a listener to the list that's notified each time a change to the data model occurs. |
void |
addProgressListener(ProgressListener listener)
Registers the specified listener to get notified when this task's progress changes. |
protected void |
fireProgressChange(double newProgressValue)
Notifies progress listeners that this task's progress has changed to newProgressValue. |
protected void |
fireSubTasksAdded(int index0,
int index1)
Notifies all listeners that there are additional sub-tasks need to complete this task. |
protected void |
fireSubTasksChanged(int index0,
int index1)
Notifies all listeners that the sub-tasks have changed or that the current sub-task has changed. |
protected void |
fireSubTasksRemoved(int index0,
int index1)
Notifies all listeners that some sub-tasks are no longer needed to complete this task. |
java.lang.Object |
getElementAt(int index)
Returns the value at the specified index. |
java.lang.String |
getName()
Returns the (localized) name of this task. |
double |
getProgress()
Returns a number between 0 and 100 that estimates this task's percentage complete. |
java.lang.Object |
getSelectedItem()
Returns the selected item |
int |
getSize()
Returns the length of the list. |
boolean |
isInterruptible()
Returns true if this task can be interrupted. |
boolean |
isPaused()
Returns true is this task is paused. |
void |
pause()
Pauses this task. |
void |
removeListDataListener(javax.swing.event.ListDataListener l)
Removes a listener from the list that's notified each time a change to the data model occurs. |
void |
removeProgressListener(ProgressListener listener)
Unregisters the specified listener for getting notified when this task's progress changes. |
void |
resume()
Resumes this task if it is paused. |
void |
setName(java.lang.String name)
Sets this task's name. |
void |
setProgress(double progress)
Sets this task's progress and notifies progress listeners. |
void |
setSelectedItem(java.lang.Object anItem)
Set the selected item. |
protected boolean |
shouldAbort()
Returns true if this task should abort. |
| Methods inherited from class sos.wizard.AbstractModel |
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface sos.wizard.Task |
run |
| Methods inherited from interface sos.wizard.Model |
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
| Constructor Detail |
public AbstractTask()
AbstractTask with no name.
AbstractTask(String)public AbstractTask(java.lang.String name)
AbstractTask with the specified name.
name - name of this task| Method Detail |
public void addListDataListener(javax.swing.event.ListDataListener l)
addListDataListener in interface javax.swing.ListModell - the ListDataListener to be addedpublic void addProgressListener(ProgressListener listener)
Task
addProgressListener in interface Tasklistener - object wishing to get notified
protected void fireSubTasksChanged(int index0,
int index1)
index0 and index1.
index0 - start index of the changeindex1 - end index (inclusive) of the changefireSubTasksAdded(int, int)
protected void fireSubTasksAdded(int index0,
int index1)
index0 - start index of the changeindex1 - end index (inclusive) of the changefireSubTasksChanged(int, int)
protected void fireSubTasksRemoved(int index0,
int index1)
index0 - start index of the changeindex1 - end index (inclusive) of the changefireSubTasksChanged(int, int)protected void fireProgressChange(double newProgressValue)
newProgressValue.
newProgressValue - a number between 0 and 100 indicating
this task's progress (as a percentage)public java.lang.Object getElementAt(int index)
getElementAt in interface javax.swing.ListModelindex - the requested index
indexpublic java.lang.String getName()
Task
getName in interface Taskpublic double getProgress()
Task
getProgress in interface Taskpublic java.lang.Object getSelectedItem()
getSelectedItem in interface javax.swing.ComboBoxModelnull if there is no selectionpublic int getSize()
getSize in interface javax.swing.ListModelpublic boolean isInterruptible()
Tasktrue if this task can be interrupted.
isInterruptible in interface Tasktrue if this task can be interruptedpublic boolean isPaused()
Tasktrue is this task is paused.
isPaused in interface Tasktrue is this task is paused.public void pause()
Task
pause in interface TaskTask.resume(),
Task.isInterruptible()public void removeListDataListener(javax.swing.event.ListDataListener l)
removeListDataListener in interface javax.swing.ListModell - the ListDataListener to be removedpublic void removeProgressListener(ProgressListener listener)
Task
removeProgressListener in interface Tasklistener - object that no longer wishes to be notifiedpublic void resume()
Task
resume in interface TaskTask.pause(),
Task.isInterruptible()public void setName(java.lang.String name)
name - name of this taskpublic void setProgress(double progress)
progress - this task's current progress, as a percentage
between 0.0 and 100.0, inclusivegetProgress()public void setSelectedItem(java.lang.Object anItem)
ListDataListeners that the contents
have changed.
setSelectedItem in interface javax.swing.ComboBoxModelanItem - the list object to select or null
to clear the selectionprotected boolean shouldAbort()
true if this task should abort. If this task
is paused, then this method blocks until it is resumed.
true if this task should abort
|
Side of Software Wizard Library 1.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||