KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtriver > open > vectorvisuals > task > KeepAliveTask


1 /*
2  * KeepAliveTask.java
3  *
4  * Created on 14 October 2005, 14:50
5  */

6
7 package com.thoughtriver.open.vectorvisuals.task;
8
9 /**
10  * This task does nothing forever. It can be used to cause a <CODE>Component</CODE>
11  * to be repainted at regular intervals indefinitely, by causing the <CODE>TaskManager</CODE>
12  * to never stop running cycles. It can also be used for keeping a <CODE>TaskChain</CODE>
13  * alive when it has no "real" tasks to execute.
14  *
15  * @author Brandon Franklin
16  * @version $Date: 2006/11/25 09:15:42 $
17  */

18 public class KeepAliveTask extends AnimationTask {
19
20     /** The total amount of progress that has been recorded by this task */
21     private double total = 0.0;
22
23     /**
24      * Creates a new instance of <CODE>KeepAliveTask</CODE>.
25      */

26     public KeepAliveTask() {
27         super(-1);
28     }
29
30     /**
31      * Accumulates the amount of progress that has been made, then returns.
32      *
33      * @param progress the amount of progress this <CODE>AnimationTask</CODE>
34      * should be changed to reflect
35      */

36     @Override JavaDoc
37     protected void update(final double progress) {
38
39         // Keep track of the total amount of progress
40
total += progress;
41     }
42
43     /**
44      * Returns the total amount of progress that has been recorded by this task.
45      *
46      * @return the total amount of progress that has been recorded by this task
47      */

48     public double getTotal() {
49         return total;
50     }
51
52 }
53
Popular Tags