org.brains2b.task
Class DefaultTask

java.lang.Object
  extended byorg.brains2b.task.DefaultTask
All Implemented Interfaces:
java.lang.Runnable, Task

public abstract class DefaultTask
extends java.lang.Object
implements Task

Implementing a Task as default Task Extra is the possibility to send an Event for use in progress bars and the like

Version:
0.12 [07-08-2005]
Author:
dennis@brains2b.nl

Field Summary
 
Fields inherited from interface org.brains2b.task.Task
RESULT_ERROR, RESULT_OK, RESULT_WARNING
 
Constructor Summary
DefaultTask()
          Constructor for DefaultTask.
 
Method Summary
protected  void addException(java.lang.Throwable t)
          Adds an exception to the reporting Stack
protected  void addMessage(java.lang.String s)
          Adds a message to the reporting Stack
 void addTaskListener(TaskListener listener)
          Method addTaskListener.
protected  void fireTaskEvent(TaskEvent e)
          Method fireTaskEvent.
 int getMax()
          Gets the maximum position.
 java.util.Stack getMessages()
           
 int getMin()
          Gets the mininum position.
 int getPosition()
          Gets the position.
 int getResult()
           
 boolean isFinished()
           
protected  void progress()
          Progresses the position by one, until the maximum given by max.
protected  void progress(int value)
           
 void removeTaskListener(TaskListener listener)
          Method removeTaskListener.
 void setFinished(boolean b)
           
protected  void setMax(int max)
          Sets the maximum position
protected  void setMin(int min)
          Sets the minimum position
protected  void setResult(int result)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Constructor Detail

DefaultTask

public DefaultTask()
Constructor for DefaultTask.

Method Detail

isFinished

public boolean isFinished()
Specified by:
isFinished in interface Task
See Also:
Task.isFinished()

setFinished

public void setFinished(boolean b)
Specified by:
setFinished in interface Task
See Also:
Task.setFinished(boolean)

getResult

public int getResult()
Specified by:
getResult in interface Task
See Also:
Task.getResult()

setResult

protected void setResult(int result)

getMessages

public java.util.Stack getMessages()
Specified by:
getMessages in interface Task
See Also:
Task.getMessages()

addMessage

protected void addMessage(java.lang.String s)
Adds a message to the reporting Stack

Parameters:
s - String, the message to add to the Stack

addException

protected void addException(java.lang.Throwable t)
Adds an exception to the reporting Stack

Parameters:
t - Throwable, the Exception or error that needs
Since:
Framework 0.31 to be added to the Stack.

getMax

public int getMax()
Gets the maximum position.

Returns:
Returns a int

getMin

public int getMin()
Gets the mininum position.

Returns:
Returns a int

getPosition

public int getPosition()
Gets the position.

Returns:
Returns a int

addTaskListener

public void addTaskListener(TaskListener listener)
Method addTaskListener.

Parameters:
listener - TaskListener

removeTaskListener

public void removeTaskListener(TaskListener listener)
Method removeTaskListener.

Parameters:
listener - TaskListener

progress

protected void progress()
Progresses the position by one, until the maximum given by max.


progress

protected void progress(int value)

fireTaskEvent

protected void fireTaskEvent(TaskEvent e)
Method fireTaskEvent.

Parameters:
e - TaskEvent

setMax

protected void setMax(int max)
Sets the maximum position

Parameters:
max - The max to set

setMin

protected void setMin(int min)
Sets the minimum position

Parameters:
min - The min to set