|
juife v0.1a |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.juife.AbstractTask<R>
public abstract class AbstractTask<R>
Provides default implementation of the Task
interface.
This class can be used to facilitate the monitoring of time-consuming task.
Note that all event notifications are done on the event dispatching thread. This means
that the event handlers can safely perform operations on Swing components.
Field Summary | |
---|---|
static int |
UNKNOWN_ERROR
|
Constructor Summary | |
---|---|
AbstractTask()
|
Method Summary | |
---|---|
void |
addTaskListener(TaskListener l)
Registers the specified TaskListener to be
notified when task is done. |
boolean |
done()
Determines whether the task has finished execution. |
boolean |
doneWithErrors()
Determines whether the task has finished its execution successfully. |
java.lang.String |
getDescription()
Gets a short description about this task. |
int |
getErrorCode()
Gets an appropriate error code identifying the failure of the task. |
java.lang.String |
getErrorMessage()
Gets an appropriate error message when the task fails. |
R |
getResult()
Gets the result of the task execution. |
java.lang.String |
getTitle()
Gets the title of this task. |
void |
invoke()
Starts the execution of this task. |
void |
invokeAndWait()
Starts the execution of this task. |
boolean |
isStarted()
Determines whether the task has been started. |
void |
removeTaskListener(TaskListener l)
Removes the specified listener. |
void |
setDescription(java.lang.String desc)
Sets the description of this task. |
void |
setDone(boolean b)
Sets whether the task has finished execution. |
void |
setDoneWithErrors(boolean b)
Sets whether the execution of the task fails. |
void |
setErrorCode(int code)
Sets an error code identifying the failure of the task. |
void |
setErrorMessage(java.lang.String msg)
Set the error message of this task. |
void |
setResult(R result)
Sets the result of the task execution. |
void |
setTitle(java.lang.String title)
Sets the title of this task. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.juife.Task |
---|
stop |
Methods inherited from interface java.lang.Runnable |
---|
run |
Field Detail |
---|
public static int UNKNOWN_ERROR
Constructor Detail |
---|
public AbstractTask()
Method Detail |
---|
public boolean done()
done
in interface Task<R>
true
if the task has finished execution,
false
otherwise.public void setDone(boolean b)
b
- Specify true
to indicate that the task has
finished execution and false
otherwise.public boolean doneWithErrors()
doneWithErrors
in interface Task<R>
true
if the task has not finished its
execution successfully; false
otherwisepublic void setDoneWithErrors(boolean b)
b
- Specify true
to indicate that the execution of the task fails.public int getErrorCode()
getErrorCode
in interface Task<R>
doneWithErrors
public void setErrorCode(int code)
code
- Specifies the error code identifying the failure of the task.public java.lang.String getErrorMessage()
getErrorMessage
in interface Task<R>
doneWithErrors
public void setErrorMessage(java.lang.String msg)
msg
- Specifies the error message describing the failure of the task.public java.lang.String getTitle()
getTitle
in interface Task<R>
public void setTitle(java.lang.String title)
setTitle
in interface Task<R>
title
- Specifies the title text of this task.public java.lang.String getDescription()
getDescription
in interface Task<R>
public void setDescription(java.lang.String desc)
desc
- An arbitrary text describing the task.public void invoke()
invokeAndWait()
. Notice that every task can be started only once.
invoke
in interface Task<R>
java.lang.IllegalStateException
- if the task has been started already.invokeAndWait()
public void invokeAndWait()
invoke()
if you don't want this method to wait until the end of the task execution.
Notice that every task can be started only once.
invokeAndWait
in interface Task<R>
java.lang.IllegalStateException
- if the task has been started already.invoke()
public boolean isStarted()
isStarted
in interface Task<R>
true
if the task is already started and false
if the task is not started yet.public R getResult()
getResult
in interface Task<R>
R
instance providing the result of the task execution.public void setResult(R result)
result
- R
instance providing the result of the task execution.public void addTaskListener(TaskListener l)
TaskListener
to be
notified when task is done.
addTaskListener
in interface Task<R>
l
- The TaskListener
to register.public void removeTaskListener(TaskListener l)
removeTaskListener
in interface Task<R>
l
- The TaskListener
to remove.
|
juife v0.1a |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2005 Grigor Iliev. All rights reserved. |