KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > dataset > provider > AbstractTask


1 /*
2  * $Id: AbstractTask.java,v 1.1 2005/02/27 00:24:56 rbair Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7
8 package org.jdesktop.dataset.provider;
9
10 /**
11  *
12  * @author rb156199
13  */

14 public abstract class AbstractTask implements Task {
15         private int min = 0;
16         private int max = 100;
17         private int progress = 0;
18         private boolean indeterminate = true;
19         private boolean cancellable = false;
20         private boolean modal = true;
21
22         protected void setMinimum(int val) {
23             min = val < 0 || val > max ? 0 : val;
24         }
25         
26         protected void setMaximum(int val) {
27             max = val < 0 || val < min ? min : val;
28         }
29         
30         protected void setProgress(int progress) {
31             this.progress = progress < 0 ? 0 : progress;
32         }
33         
34         protected void setIndeterminate(boolean b) {
35             indeterminate = b;
36         }
37
38         public int getMinimum() {
39             return min;
40         }
41
42         public int getMaximum() {
43             return max;
44         }
45
46         public int getProgress() {
47             return progress;
48         }
49
50         public boolean isIndeterminate() {
51             return indeterminate;
52         }
53
54         public boolean isModal() {
55             return modal;
56         }
57
58         public boolean canCancel() {
59             return cancellable;
60         }
61         
62         public void setModel(boolean b) {
63             modal = b;
64         }
65         
66         public void setCanCancel(boolean b) {
67             cancellable = b;
68         }
69 }
70
Popular Tags