Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.utils / src / main / java / org / gvsig / utils / swing / threads / ProgressMonitorAdapter.java @ 40561

History | View | Annotate | Download (3.12 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/* CVS MESSAGES:
25
*
26
* $Id: ProgressMonitorAdapter.java 29631 2009-06-29 16:56:19Z jpiera $
27
* $Log$
28
* Revision 1.2  2006-04-18 15:16:44  azabala
29
* a?adido comentario de cabecera de la clase
30
*
31
* Revision 1.1  2006/03/14 19:23:42  azabala
32
* *** empty log message ***
33
*
34
*
35
*/
36
package org.gvsig.utils.swing.threads;
37

    
38
import java.awt.Component;
39

    
40
import javax.swing.ProgressMonitor;
41

    
42
/**
43
 * It is a try to launch tasks in background and to report its evolution
44
 * with javax.swing.ProgressMonitor.
45
 * It isnt satisfactory at all (because we cant control
46
 * when dialog is showed, etc)
47
 * @author azabala
48
 *
49
 */
50
public class ProgressMonitorAdapter implements IProgressMonitorIF {
51
        
52
        private ProgressMonitor progressMonitor;
53
        
54
        public ProgressMonitorAdapter(Component parent,
55
                        String statusMessage,
56
                        String note,
57
                        int minimum,
58
                        int maximum,
59
                        int currentValue){
60
                progressMonitor = new ProgressMonitor(parent,statusMessage,
61
                                note, minimum, maximum);
62
                progressMonitor.setProgress(currentValue);
63
                progressMonitor.setMillisToDecideToPopup(0);
64
                progressMonitor.setMillisToPopup(0);
65
                
66
        }
67
        
68
        
69
        public void setInitialStep(int step) {
70
                progressMonitor.setMinimum(step);
71

    
72
        }
73

    
74
        public void setLastStep(int step) {
75
                progressMonitor.setMaximum(step);
76
        }
77

    
78
        public void setCurrentStep(int step) {
79
                progressMonitor.setProgress(step);
80
        }
81

    
82
        public int getInitialStep() {
83
                return progressMonitor.getMinimum();
84
        }
85

    
86
        public int getLastStep() {
87
                return progressMonitor.getMaximum();
88
        }
89

    
90
        //ProgressMonitor recibe el step, no lo devuelve
91
        public int getCurrentStep() {
92
                return -1;
93
        }
94

    
95
        public void setIndeterminated(boolean indeterminated) {
96
        }
97

    
98
        public boolean isIndeterminated() {
99
                return false;
100
        }
101

    
102
        public void setBarStringDrawed(boolean stringDrawed) {
103
        }
104

    
105
        public void setBarString(String barString) {
106
        }
107

    
108
        public void setMainTitleLabel(String text) {
109
        }
110

    
111
        public void setNote(String note) {
112
                progressMonitor.setNote(note);
113
        }
114

    
115
        public void cancel() {
116
        }
117

    
118
        public boolean isCanceled() {
119
                return progressMonitor.isCanceled();
120
        }
121

    
122
        public void taskInBackground() {
123
                // TODO Auto-generated method stub
124

    
125
        }
126

    
127

    
128

    
129
        public void close() {
130
                progressMonitor.close();
131
                
132
        }
133

    
134

    
135
        public void open() {
136
                progressMonitor.setMillisToPopup(0);
137
        }
138

    
139
}
140