svn-gvsig-desktop / branches / v10 / extensions / extNormalization / src / org / gvsig / normalization / gui / NormalizationTask.java @ 28183
History | View | Annotate | Download (2.67 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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 2
|
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 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2008 Prodevelop S.L. main development
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.normalization.gui; |
29 |
|
30 |
import org.apache.log4j.Logger; |
31 |
import org.gvsig.normalization.operations.Normalization; |
32 |
|
33 |
import com.iver.andami.PluginServices; |
34 |
import com.iver.utiles.swing.threads.AbstractMonitorableTask; |
35 |
|
36 |
/**
|
37 |
* Normalization task
|
38 |
*
|
39 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
|
40 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
|
41 |
*/
|
42 |
public class NormalizationTask extends AbstractMonitorableTask { |
43 |
|
44 |
private Logger logger = PluginServices.getLogger(); |
45 |
private Normalization normalization;
|
46 |
private long finalStep; |
47 |
|
48 |
/**
|
49 |
* @param na
|
50 |
* @param normPanelModel
|
51 |
* panel model
|
52 |
*
|
53 |
*/
|
54 |
public NormalizationTask(Normalization na, INormPanelModel normPanelModel) {
|
55 |
|
56 |
this.normalization = na;
|
57 |
|
58 |
// configure task
|
59 |
setInitialStep(0);
|
60 |
setStatusMessage(PluginServices.getText(this, "Normalizating")); |
61 |
setDeterminatedProcess(true);
|
62 |
finalStep = normalization.getEstimatedRowCount(); |
63 |
setFinalStep((int) finalStep);
|
64 |
} |
65 |
|
66 |
/*
|
67 |
* (non-Javadoc)
|
68 |
*
|
69 |
* @see com.iver.utiles.swing.threads.ITask#run()
|
70 |
*/
|
71 |
public void run() throws Exception { |
72 |
String log = PluginServices.getText(this, "chains_normalizated"); |
73 |
int firstRow = normalization.getPattern().getNofirstrows() == 0 ? 1 |
74 |
: normalization.getPattern().getNofirstrows() + 1;
|
75 |
for (int i = firstRow; i < finalStep + 1; i++) { |
76 |
if (!isCanceled()) {
|
77 |
setCurrentStep(i); |
78 |
setNote(i + " " + log);
|
79 |
logger.debug("Position: " + (i - 1)); |
80 |
normalization.fillRow(i - 1);
|
81 |
} else {
|
82 |
return;
|
83 |
} |
84 |
} |
85 |
normalization.postProcess(); |
86 |
normalization.removeAllListeners(); |
87 |
} |
88 |
} |