Revision 2106

View differences:

org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/pom.xml
20 20
            <artifactId>org.gvsig.raster.lib.impl</artifactId>
21 21
            <scope>compile</scope>
22 22
        </dependency>
23
        <dependency>
24
			<groupId>org.gvsig</groupId>
25
			<artifactId>org.gvsig.raster.swing.api</artifactId>
26
            <scope>compile</scope>
27
		</dependency>
28
        <dependency>
29
            <groupId>org.gvsig</groupId>
30
            <artifactId>org.gvsig.raster.swing.impl</artifactId>
31
            <scope>runtime</scope>
32
        </dependency>
23 33
     	 <dependency>
24 34
          <groupId>org.gvsig</groupId>
25 35
          <artifactId>org.gvsig.metadata.lib.basic.impl</artifactId>
......
47 57
        </dependency>
48 58
        <dependency>
49 59
            <groupId>org.gvsig</groupId>
50
            <artifactId>org.gvsig.ui</artifactId>
51
            <scope>compile</scope>
52
        </dependency>
53
        <dependency>
54
            <groupId>org.gvsig</groupId>
55 60
            <artifactId>org.gvsig.projection.api</artifactId>
56 61
            <scope>compile</scope>
57 62
        </dependency>
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/process/ProcessParamsManagement.java
27 27
import java.util.List;
28 28

  
29 29
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
30
import org.gvsig.gui.beans.incrementabletask.IIncrementable;
31
import org.gvsig.gui.beans.incrementabletask.IncrementableListener;
30
import org.gvsig.raster.algorithm.gui.IIncrementable;
31
import org.gvsig.raster.algorithm.gui.IncrementableListener;
32 32
import org.gvsig.tools.ToolsLocator;
33 33
import org.gvsig.tools.dispose.Disposable;
34 34
import org.gvsig.tools.extensionpoint.ExtensionPoint;
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/process/ProcessUtils.java
306 306
	 * @param bandCount
307 307
	 * @return
308 308
	 */
309
	public Buffer createOutputBuffer(Rectangle2D sourcePxBBox, int bandCount) {
309
	public Buffer createOutputBuffer(int w, int h, int bandCount) {
310
		return createOutputBuffer(w, h, bandCount, Buffer.TYPE_DOUBLE);
311
	}
312
	
313
	public Buffer createOutputBuffer(int w, int h, int bandCount, int datatype) {
310 314
		RasterManager rManager = RasterLocator.getManager();
311 315
		BufferParam bParams = rManager.getBufferFactory().createBufferParams(
312
				(int)sourcePxBBox.getWidth(), 
313
				(int)sourcePxBBox.getHeight(), 
316
				w, 
317
				h, 
314 318
				bandCount, 
315
				Buffer.TYPE_DOUBLE, 
319
				datatype, 
316 320
				true);
317 321
		Buffer resultBuffer = null;
318 322
		try {
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/process/DataProcess.java
30 30
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
31 31
import org.gvsig.fmap.dal.coverage.process.CancelEvent;
32 32
import org.gvsig.fmap.dal.coverage.process.TaskEventManager;
33
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
34
import org.gvsig.gui.beans.incrementabletask.IIncrementable;
35
import org.gvsig.gui.beans.incrementabletask.IncrementableEvent;
36
import org.gvsig.gui.beans.incrementabletask.IncrementableListener;
37
import org.gvsig.gui.beans.incrementabletask.IncrementableTask;
33
import org.gvsig.raster.algorithm.gui.IIncrementable;
34
import org.gvsig.raster.algorithm.gui.IncrementableEvent;
35
import org.gvsig.raster.algorithm.gui.IncrementableListener;
36
import org.gvsig.raster.algorithm.gui.IncrementableTask;
37
import org.gvsig.raster.swing.impl.basepanel.ButtonsPanel;
38 38
import org.gvsig.tools.dispose.Disposable;
39 39
import org.slf4j.Logger;
40 40
import org.slf4j.LoggerFactory;
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/gui/IIncrementable.java
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
package org.gvsig.raster.algorithm.gui;
25

  
26

  
27
/* gvSIG. Geographic Information System of the Valencian Government
28
 *
29
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
30
 * of the Valencian Government (CIT)
31
 * 
32
 * This program is free software; you can redistribute it and/or
33
 * modify it under the terms of the GNU General Public License
34
 * as published by the Free Software Foundation; either version 2
35
 * of the License, or (at your option) any later version.
36
 * 
37
 * This program is distributed in the hope that it will be useful,
38
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
39
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
40
 * GNU General Public License for more details.
41
 *  
42
 * You should have received a copy of the GNU General Public License
43
 * along with this program; if not, write to the Free Software
44
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
45
 * MA  02110-1301, USA.
46
 * 
47
 */
48

  
49
/**
50
 * 
51
 *
52
 * @version 20/08/2008
53
 * 
54
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
55
 */
56
public interface IIncrementable {
57
	/**
58
	 * Devuelve el titulo de la ventana IncrementableTask
59
	 * @return String
60
	 */
61
	public String getTitle();
62

  
63
	/**
64
	 * Devuelve el contenido del log de la ventana IncrementableTask
65
	 * @return String
66
	 */
67
	public String getLog();
68

  
69
	/**
70
	 * Devuelve la etiqueta de la ventana IncrementableTask
71
	 * @return String
72
	 */
73
	public String getLabel();
74
	
75
	/**
76
	 * Devuelve el porcentaje de 0 a 100 de la ventana IncrementableTask
77
	 * @return int
78
	 */
79
	public int getPercent();
80

  
81
	/**
82
	 * <p>Determines if this process can be canceled.</p>
83
	 * 
84
	 * @return <code>true</code> if this process can be canceled, otherwise <code>false</code>
85
	 */
86
	public boolean isCancelable();
87

  
88
	/**
89
	 * <p>Determines if this process can be paused.</p>
90
	 * 
91
	 * @return <code>true</code> if this process can be paused, otherwise <code>false</code>
92
	 */
93
	public boolean isPausable();
94
}
0 95

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/gui/LogControl.java
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
package org.gvsig.raster.algorithm.gui;
25

  
26
/* gvSIG. Geographic Information System of the Valencian Government
27
 *
28
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
29
 * of the Valencian Government (CIT)
30
 * 
31
 * This program is free software; you can redistribute it and/or
32
 * modify it under the terms of the GNU General Public License
33
 * as published by the Free Software Foundation; either version 2
34
 * of the License, or (at your option) any later version.
35
 * 
36
 * This program is distributed in the hope that it will be useful,
37
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
39
 * GNU General Public License for more details.
40
 *  
41
 * You should have received a copy of the GNU General Public License
42
 * along with this program; if not, write to the Free Software
43
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
44
 * MA  02110-1301, USA.
45
 * 
46
 */
47

  
48
/**
49
 * <code>LogControl</code>. Objeto para un control b?sico de un log. Para a?adir
50
 * y reemplazar la ?ltima l?nea a?adida.
51
 *
52
 * @version 27/03/2007
53
 * @author BorSanZa - Borja Sanchez Zamorano (borja.sanchez@iver.es)
54
 */
55
public class LogControl {
56
	String text = "";
57

  
58
	/**
59
	 * A?ade una l?nea al log.
60
	 * @param line
61
	 */
62
	public void addLine(String line) {
63
		if (text.length() > 0)
64
			text += "\n";
65
		text += line;
66
	}
67

  
68
	/**
69
	 * Reemplaza la ?ltima l?nea a?adida al log.
70
	 * @param line
71
	 */
72
	public void replaceLastLine(String line) {
73
		int index = text.lastIndexOf("\n");
74
		if (index < 0)
75
			index = 0;
76
		text = text.substring(0, index);
77
		addLine(line);
78
	}
79

  
80
	/**
81
	 * Establece el texto completo del log.
82
	 * @param value
83
	 */
84
	public void setText(String value) {
85
		text = value;
86
	}
87

  
88
	/**
89
	 * Devuelve el contenido del log.
90
	 * @return String
91
	 */
92
	public String getText() {
93
		return text;
94
	}
95
}
0 96

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/gui/ProgressPanel.java
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
package org.gvsig.raster.algorithm.gui;
25

  
26
import java.awt.Dialog;
27
import java.awt.Dimension;
28
import java.awt.Frame;
29
import java.awt.GraphicsConfiguration;
30
import java.awt.HeadlessException;
31
import java.awt.Toolkit;
32

  
33
import javax.swing.JDialog;
34
import javax.swing.JLabel;
35
import javax.swing.JPanel;
36
import javax.swing.JProgressBar;
37
import javax.swing.JScrollPane;
38
import javax.swing.JTextPane;
39

  
40
import org.gvsig.i18n.Messages;
41
import org.gvsig.raster.swing.RasterSwingLocator;
42
import org.gvsig.raster.swing.basepanel.ButtonsPanelEvent;
43
import org.gvsig.raster.swing.basepanel.ButtonsPanelListener;
44
import org.gvsig.raster.swing.basepanel.IButtonsPanel;
45
import org.gvsig.raster.swing.impl.basepanel.ButtonsPanel;
46

  
47

  
48
/**
49
 * <code>ProgressPanel</code>. Muestra una ventana de di?logo para representar
50
 * una barra de progreso con su ventana de registro.
51
 *
52
 * @version 15/07/2008
53
 *
54
 * @author BorSanZa - Borja Sanchez Zamorano (borja.sanchez@iver.es)
55
 */
56
public class ProgressPanel extends JDialog {
57
	private static final long serialVersionUID = 4321011219898234352L;
58

  
59
	private JPanel              jPanel              = null;
60
	private JLabel              jLabel              = null;
61
	private JLabel              jLabel1             = null;
62
	private JPanel              jPanel1             = null;
63
	private JPanel              njp                 = null;
64
	private IButtonsPanel       defaultButtonsPanel = null;
65
	private JProgressBar        jProgressBar        = null;
66
	private JScrollPane         jScrollPane         = null;
67
	private JTextPane           jTextPane           = null;
68
	private LogControl          text                = new LogControl();
69
	private long                startTime           = System.currentTimeMillis();
70
	private boolean             showPause           = true;
71

  
72
	/**
73
	 * Constructor
74
	 */
75
	public ProgressPanel() {
76
		super();
77
		initialize();
78
	}
79

  
80
	public ProgressPanel(boolean showPause) {
81
		super();
82
		this.showPause = showPause;
83
		initialize();
84
	}
85
	
86
	/**
87
	 * @see JDialog#JDialog(Dialog, boolean)
88
	 */
89
	public ProgressPanel(Dialog owner, boolean modal) throws HeadlessException {
90
		super(owner, modal);
91
		initialize();
92
	}
93

  
94
	/**
95
	 * @see JDialog#JDialog(Dialog, String, boolean, GraphicsConfiguration)
96
	 */
97
	public ProgressPanel(Dialog owner, String title, boolean modal,	GraphicsConfiguration gc) throws HeadlessException {
98
		super(owner, title, modal, gc);
99
		initialize();
100
	}
101

  
102
	/**
103
	 * @see JDialog#JDialog(Dialog, String, boolean)
104
	 */
105
	public ProgressPanel(Dialog owner, String title, boolean modal)
106
			throws HeadlessException {
107
		super(owner, title, modal);
108
		initialize();
109
	}
110

  
111
	/**
112
	 * @see JDialog#JDialog(Dialog, String)
113
	 */
114
	public ProgressPanel(Dialog owner, String title) throws HeadlessException {
115
		super(owner, title);
116
		initialize();
117
	}
118

  
119
	/**
120
	 * @see JDialog#JDialog(Dialog)
121
	 */
122
	public ProgressPanel(Dialog owner) throws HeadlessException {
123
		super(owner);
124
		initialize();
125
	}
126

  
127
	/**
128
	 * @see JDialog#JDialog(Frame, boolean)
129
	 */
130
	public ProgressPanel(Frame owner, boolean modal) throws HeadlessException {
131
		super(owner, modal);
132
		initialize();
133
	}
134

  
135
	/**
136
	 * @see JDialog#JDialog(Frame, String, boolean, GraphicsConfiguration)
137
	 */
138
	public ProgressPanel(Frame owner, String title, boolean modal, GraphicsConfiguration gc) {
139
		super(owner, title, modal, gc);
140
		initialize();
141
	}
142

  
143
	/**
144
	 * @see JDialog#JDialog(Frame, String, boolean)
145
	 */
146
	public ProgressPanel(Frame owner, String title, boolean modal)
147
			throws HeadlessException {
148
		super(owner, title, modal);
149
		initialize();
150
	}
151

  
152
	/**
153
	 * @see JDialog#JDialog(Frame, String)
154
	 */
155
	public ProgressPanel(Frame owner, String title) throws HeadlessException {
156
		super(owner, title);
157
		initialize();
158
	}
159

  
160
	/**
161
	 * @see JDialog#JDialog(Frame)
162
	 */
163
	public ProgressPanel(Frame owner) throws HeadlessException {
164
		super(owner);
165
		initialize();
166
	}	
167
	
168
	/**
169
	 * This method initializes this
170
	 */
171
	private void initialize() {
172
		njp = new JPanel();
173
		njp.setLayout(new java.awt.BorderLayout(5, 5));
174
		njp.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 15, 5, 15));
175
		this.setContentPane(njp);
176
		this.setResizable(false);
177
		njp.add(getJPanel(), java.awt.BorderLayout.NORTH);
178
		njp.add(getJPanel1(), java.awt.BorderLayout.CENTER);
179
		njp.add(getButtonsPanel().getComponent(), java.awt.BorderLayout.SOUTH);
180
		showLog(false);
181
		setPercent(0);
182
		Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
183
		this.setLocation(
184
				(int) (d.getWidth() - this.getWidth()) >> 1,
185
				(int) (d.getHeight() - this.getHeight()) >> 1);
186
		this.setVisible(true);
187
	}
188

  
189
	/**
190
	 * This method initializes jPanel
191
	 *
192
	 * @return javax.swing.JPanel
193
	 */
194
	private JPanel getJPanel() {
195
		if (jPanel == null) {
196
			jLabel1 = new JLabel();
197
			jLabel = new JLabel();
198
			jLabel.setText(Messages.getText("espere") + "...");
199
			jPanel = new JPanel();
200
			jPanel.setLayout(new java.awt.BorderLayout(5, 5));
201
			jPanel.add(jLabel, java.awt.BorderLayout.WEST);
202
			jPanel.add(jLabel1, java.awt.BorderLayout.EAST);
203
		}
204
		return jPanel;
205
	}
206

  
207
	/**
208
	 * This method initializes jPanel1
209
	 *
210
	 * @return javax.swing.JPanel
211
	 */
212
	private JPanel getJPanel1() {
213
		if (jPanel1 == null) {
214
			jPanel1 = new JPanel();
215
			jPanel1.setLayout(new java.awt.BorderLayout(5, 5));
216
			jPanel1.add(getJProgressBar(), java.awt.BorderLayout.NORTH);
217
			jPanel1.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
218
		}
219
		return jPanel1;
220
	}
221

  
222
	public void addButtonPressedListener(ButtonsPanelListener listener) {
223
		getDefaultButtonsPanel().addButtonPressedListener(listener);
224
	}
225

  
226
	public void removeButtonPressedListener(ButtonsPanelListener listener) {
227
		getDefaultButtonsPanel().removeButtonPressedListener(listener);
228
	}
229

  
230
	public void showLog(boolean visible) {
231
		getButtonsPanel().getButton(ButtonsPanel.BUTTON_SEEDETAILS).setVisible(!visible);
232
		getButtonsPanel().getButton(ButtonsPanel.BUTTON_HIDEDETAILS).setVisible(visible);
233
		jScrollPane.setVisible(visible);
234

  
235
		this.setIgnoreRepaint(true);
236

  
237
		if (visible)
238
			this.setSize(this.getWidth(), 300);
239
		else
240
			this.pack();
241

  
242
		this.setIgnoreRepaint(false);
243
		if (this.isVisible())
244
			this.setVisible(true);
245
	}
246

  
247
	public void showPause(boolean visible) {
248
		if (showPause) {
249
			getButtonsPanel().getButton(ButtonsPanel.BUTTON_RESTART).setVisible(!visible);
250
			getButtonsPanel().getButton(ButtonsPanel.BUTTON_PAUSE).setVisible(visible);
251
		} else {
252
			getButtonsPanel().getButton(ButtonsPanel.BUTTON_RESTART).setVisible(false);
253
			getButtonsPanel().getButton(ButtonsPanel.BUTTON_PAUSE).setVisible(false);
254
		}
255
	}
256

  
257
	/**
258
	 * @see DefaultButtonsPanel#getButtonsPanel()
259
	 */
260
	public IButtonsPanel getButtonsPanel() {
261
		return getDefaultButtonsPanel();
262
	}
263
	
264
	/**
265
	 * This method initializes DefaultButtonsPanel
266
	 *
267
	 * @return DefaultButtonsPanel
268
	 */
269
	public IButtonsPanel getDefaultButtonsPanel() {
270
		if (defaultButtonsPanel == null) {
271
			defaultButtonsPanel = RasterSwingLocator.getSwingManager().createButtonsPanel(ButtonsPanel.BUTTONS_NONE, getJPanel1());
272
			getButtonsPanel().addSeeDetails();
273
			getButtonsPanel().addHideDetails();
274
			getButtonsPanel().addPause();
275
			getButtonsPanel().addRestart();
276
			showPause(true);
277
			getButtonsPanel().addCancel();
278
			//getButtonsPanel().setLayout(new java.awt.FlowLayout(FlowLayout.CENTER));
279
			getButtonsPanel().addButtonPressedListener(new ButtonsPanelListener() {
280
				public void actionButtonPressed(ButtonsPanelEvent e) {
281
					switch (e.getButton()) {
282
						case ButtonsPanel.BUTTON_SEEDETAILS:
283
							showLog(true);
284
							break;
285
						case ButtonsPanel.BUTTON_HIDEDETAILS:
286
							showLog(false);
287
							break;
288
						case ButtonsPanel.BUTTON_PAUSE:
289
							showPause(false);
290
							break;
291
						case ButtonsPanel.BUTTON_RESTART:
292
							showPause(true);
293
							break;
294
					}
295
				}
296
			});
297
		}
298
		return defaultButtonsPanel;
299
	}
300

  
301
	/**
302
	 * This method initializes jProgressBar
303
	 *
304
	 * @return javax.swing.JProgressBar
305
	 */
306
	private JProgressBar getJProgressBar() {
307
		if (jProgressBar == null) {
308
			jProgressBar = new JProgressBar();
309
			jProgressBar.setValue(50);
310
			jProgressBar.setPreferredSize(new Dimension(450, 18));
311
		}
312
		return jProgressBar;
313
	}
314

  
315
	/**
316
	 * This method initializes jScrollPane
317
	 *
318
	 * @return javax.swing.JScrollPane
319
	 */
320
	private JScrollPane getJScrollPane() {
321
		if (jScrollPane == null) {
322
			jScrollPane = new JScrollPane();
323
			jScrollPane.setViewportView(getJTextPane());
324
			jScrollPane.setVisible(false);
325
		}
326
		return jScrollPane;
327
	}
328

  
329
	/**
330
	 * This method initializes jTextPane
331
	 *
332
	 * @return javax.swing.JTextPane
333
	 */
334
	private JTextPane getJTextPane() {
335
		if (jTextPane == null) {
336
			jTextPane = new JTextPane();
337
			jTextPane.setEditable(false);
338
		}
339
		return jTextPane;
340
	}
341

  
342
	private void updateLog() {
343
		jTextPane.setText(text.getText());
344
		jTextPane.setCaretPosition(jTextPane.getText().length());
345
	}
346

  
347
	public void addLineLog(String line) {
348
		text.addLine(line);
349
		updateLog();
350
	}
351

  
352
	public void replaceLastLineLog(String line) {
353
		text.replaceLastLine(line);
354
		updateLog();
355
	}
356

  
357
	public void setLog(String value) {
358
		long time = (System.currentTimeMillis() - startTime) / 1000;
359
		text.setText(value + "\n" + Messages.getText("tiempo_transcurrido") + ": " + time + "s");
360
		updateLog();
361
	}
362

  
363
	public int getPercent() {
364
		return jProgressBar.getValue();
365
	}
366

  
367
	public void setPercent(int value) {
368
		if ((value == 0) && (!jProgressBar.isIndeterminate())) {
369
			jProgressBar.setIndeterminate(true);
370
			jLabel1.setVisible(false);
371
		}
372
		if ((value != 0) && (jProgressBar.isIndeterminate())) {
373
			jProgressBar.setIndeterminate(false);
374
			jLabel1.setVisible(true);
375
		}
376
		jProgressBar.setValue(value);
377
		jLabel1.setText(value + "%");
378
	}
379

  
380
	public void setLabel(String value) {
381
		jLabel.setText(value);
382
	}
383

  
384
	/**
385
	 * <p>Sets whether this panel will show a normal progress bar
386
	 * or an indeterminate one.</p>
387
	 *
388
	 * @see JProgressBar.setIndeterminate(boolean)
389
	 * @param indeterminate
390
	 */
391
	public void setIndeterminate(boolean indeterminate) {
392
		getJProgressBar().setIndeterminate(indeterminate);
393
	}
394

  
395
	/**
396
	 * <p>Gets whether this panel will show a normal progress bar
397
	 * or an indeterminate one.</p>
398
	 *
399
	 * @see JProgressBar.setIndeterminate(boolean)
400
	 * @param indeterminate
401
	 */
402
	public boolean getIndeterminate() {
403
		return getJProgressBar().isIndeterminate();
404
	}
405
}
0 406

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/gui/Cancel.java
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
package org.gvsig.raster.algorithm.gui;
25

  
26
public class Cancel implements Cancellable {
27
	private boolean cancel = false;
28

  
29
	/**
30
	 * Crea un nuevo CancelDraw.
31
	 */
32
	public Cancel() {
33
	}
34

  
35
	/**
36
	 * Insertar si se debe cancelar el dibujado.
37
	 * 
38
	 * @param b
39
	 *            true si se debe cancelar el dibujado.
40
	 */
41
	public void setCanceled(boolean b) {
42
		cancel = b;
43
	}
44

  
45
	/**
46
	 * @see com.iver.utiles.swing.threads.Cancellable#isCanceled()
47
	 */
48
	public boolean isCanceled() {
49
		return cancel;
50
	}
51

  
52
}
0 53

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/gui/Cancellable.java
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
package org.gvsig.raster.algorithm.gui;
25

  
26

  
27
/**
28
 * <p><code>Cancellable</code> interface is designed for adding support to notify that a task must be cancelled.</p>
29
 * 
30
 * <p>This is useful if a process is hung up, blocking, or simply if user wants cancel it, for instance, a
31
 *  drawing process of a heavy layer.</p>
32
 * 
33
 * <p>The classes which implement this interface are force to share the canceling information, in order to be
34
 *  notified about the current status of it. This implies a synchronous canceling process, that could be implemented by
35
 *  another object.</p>
36
 */
37
public interface Cancellable {
38
	/**
39
	 * <p>Determines if the related task must be canceled.</p>
40
	 * 
41
	 * @return <code>true</code> if task must been canceled; otherwise <code>false</code>
42
	 * 
43
	 * @see #setCanceled(boolean)
44
	 */
45
	boolean isCanceled();
46

  
47
	/**
48
	 * <p>Sets if the related task must be canceled.</p>
49
	 * 
50
	 * @param canceled <code>true</code> if the task must be canceled; otherwise <code>false</code>
51
	 * 
52
	 * @see #isCanceled()
53
	 */
54
	void setCanceled(boolean canceled);
55
}
0 56

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/gui/IncrementableEvent.java
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
package org.gvsig.raster.algorithm.gui;
25

  
26
/* gvSIG. Geographic Information System of the Valencian Government
27
 *
28
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
29
 * of the Valencian Government (CIT)
30
 * 
31
 * This program is free software; you can redistribute it and/or
32
 * modify it under the terms of the GNU General Public License
33
 * as published by the Free Software Foundation; either version 2
34
 * of the License, or (at your option) any later version.
35
 * 
36
 * This program is distributed in the hope that it will be useful,
37
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
39
 * GNU General Public License for more details.
40
 *  
41
 * You should have received a copy of the GNU General Public License
42
 * along with this program; if not, write to the Free Software
43
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
44
 * MA  02110-1301, USA.
45
 * 
46
 */
47

  
48
import java.util.EventObject;
49
/**
50
 * Se utiliza para poder definir que acci?n esta ocurriendo en un momento dado
51
 * en la ventana IncrementableTask
52
 *
53
 * @version 23/04/2007
54
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
55
 */
56
public class IncrementableEvent extends EventObject {
57
	private static final long serialVersionUID = 75795297813891036L;
58

  
59
	/**
60
	 * Definir si la acci?n que esta ocurriendo es la de resumir.
61
	 */
62
	public static final int RESUMED = 1;
63

  
64
	/**
65
	 * Definir si la acci?n que esta ocurriendo es la de suspender
66
	 */
67
	public static final int SUSPENDED = 2;
68

  
69
	/**
70
	 * Definir si la acci?n que esta ocurriendo es la de cancelar.
71
	 */
72
	public static final int CANCELED = 3;
73

  
74
	/**
75
	 * Constructor de IncrementableEvent
76
	 * @param source
77
	 */
78
	public IncrementableEvent(Object source) {
79
		super(source);
80
	}
81
}
0 82

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/gui/IncrementableTask.java
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
package org.gvsig.raster.algorithm.gui;
25

  
26
/* gvSIG. Geographic Information System of the Valencian Government
27
 *
28
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
29
 * of the Valencian Government (CIT)
30
 * 
31
 * This program is free software; you can redistribute it and/or
32
 * modify it under the terms of the GNU General Public License
33
 * as published by the Free Software Foundation; either version 2
34
 * of the License, or (at your option) any later version.
35
 * 
36
 * This program is distributed in the hope that it will be useful,
37
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
39
 * GNU General Public License for more details.
40
 *  
41
 * You should have received a copy of the GNU General Public License
42
 * along with this program; if not, write to the Free Software
43
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
44
 * MA  02110-1301, USA.
45
 * 
46
 */
47

  
48
import java.awt.event.WindowAdapter;
49
import java.awt.event.WindowEvent;
50
import java.util.ArrayList;
51
import java.util.Iterator;
52

  
53
import javax.swing.JDialog;
54
import javax.swing.JOptionPane;
55

  
56
import org.gvsig.i18n.Messages;
57
import org.gvsig.raster.swing.basepanel.ButtonsPanelEvent;
58
import org.gvsig.raster.swing.basepanel.ButtonsPanelListener;
59
import org.gvsig.raster.swing.basepanel.IButtonsPanel;
60
import org.gvsig.raster.swing.impl.basepanel.ButtonsPanel;
61
import org.slf4j.Logger;
62
import org.slf4j.LoggerFactory;
63

  
64
/**
65
 * <code>IncrementableTask</code>. Es un dialogo que contiene un ProgressPanel.
66
 * Se ejecuta bajo un Thread y va consultando a un objeto de tipo IIncrementable
67
 * para modificar sus valores.
68
 *
69
 * @version 20/08/2008
70
 *
71
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
72
 */
73
public class IncrementableTask implements Runnable, ButtonsPanelListener {
74

  
75
    private static final Logger LOG = LoggerFactory
76
        .getLogger(IncrementableTask.class);
77

  
78
	IIncrementable                            iIncrementable         = null;
79
	private volatile ProgressPanel            progressPanel          = null;
80
	private volatile Thread                   blinker                = null;
81
	private boolean                           threadSuspended        = false;
82
	private boolean                           ended                  = false;
83
	private boolean                           askOnCancel            = true;
84
	private ArrayList<IncrementableListener>  actionCommandListeners = new ArrayList<IncrementableListener>();
85
	private boolean                           bDoCallListeners       = true;
86
	
87
	/**
88
	 * Constructor del IncrementableTask.
89
	 * @param incrementable
90
	 */
91
	public IncrementableTask(IIncrementable incrementable, ProgressPanel dialog) {
92
		iIncrementable = incrementable;
93
		progressPanel = dialog;
94
		configureProgressPanel();
95
	}
96
	
97
	/**
98
	 * Constructor del IncrementableTask.
99
	 * @param incrementable
100
	 */
101
	public IncrementableTask(IIncrementable incrementable) {
102
		iIncrementable = incrementable;
103
		configureProgressPanel();
104
	}
105

  
106
	/**
107
	 * Inicio del thread para que la ventana vaya consultando por si sola al
108
	 * iIncrementable
109
	 */
110
	public void start() {
111
		blinker = new Thread(this);
112
		blinker.start();
113
	}
114

  
115
	/**
116
	 * Detiene el proceso de consulta de la ventana.
117
	 */
118
	public void stop() {
119
		ended = true;
120
	}
121
	
122
	/**
123
	 * Este thread va leyendo el porcentaje hasta que se completa el histograma.
124
	 */
125
	public synchronized void run() {
126
//		while (!ended && (iIncrementable.getPercent() <= 100)) {
127
		while (! ended) {
128
			try {
129
				getProgressPanel().setLabel(iIncrementable.getLabel());
130
				getProgressPanel().setPercent(iIncrementable.getPercent());
131
				getProgressPanel().setTitle(iIncrementable.getTitle());
132
				getProgressPanel().setLog(iIncrementable.getLog());
133
				Thread.sleep(100);
134
				synchronized (this) {
135
					while (threadSuspended && !ended)
136
						wait(500);
137
				}
138
			} catch (InterruptedException e) {
139
			}
140
		}
141
		
142
		// Forces to refresh the log with the last changes
143
		getProgressPanel().setLog(iIncrementable.getLog());
144
	}
145

  
146
	/**
147
	 * Termina el proceso de lectura de porcentajes y logs de la ventana y
148
	 * cierra esta.
149
	 */
150
	public void processFinalize() {
151
		stop();
152
		while (isAlive());
153
		hide();
154
	}
155

  
156
	/**
157
	 * Ocultar la ventana y parar el proceso
158
	 */
159
	private void hide() {
160
		hideWindow();
161
		progressPanel = null;
162
		blinker = null;
163
	}
164
	
165
	/**
166
	 * Ocultar la ventana
167
	 */
168
	public void hideWindow() {
169
//		getProgressPanel().dispose();
170
		getProgressPanel().setVisible(false);
171
	}
172

  
173
	/**
174
	 * Devuelve un booleano indicando si esta activa la ventana.
175
	 * @return boolean
176
	 */
177
	public boolean isAlive() {
178
		if (blinker == null)
179
			return false;
180
		return blinker.isAlive();
181
	}
182

  
183
	/**
184
	 * Muestra la ventana de incremento con el porcentaje de la construcci?n del
185
	 * histograma.
186
	 */
187
	public void showWindow() {
188
		getProgressPanel().setTitle(iIncrementable.getTitle());
189
		getProgressPanel().showLog(false);
190
		getProgressPanel().setVisible(true);
191
	}
192

  
193
	/**
194
	 * Devuelve el componente ProgressPanel de la ventana incrementable.
195
	 * @return ProgressPanel
196
	 */
197
	public ProgressPanel getProgressPanel() {
198
		if (progressPanel == null) {
199
			progressPanel = new ProgressPanel(false);
200
		}
201
		return progressPanel;
202
	}
203
	
204
	protected void configureProgressPanel() {
205
		getProgressPanel().setAlwaysOnTop(true);
206
		getProgressPanel().addButtonPressedListener(this);
207
		
208
		// Must ask if user wants to cancel the process, avoid closing the dialog
209
		getProgressPanel().setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE );
210
		getProgressPanel().addWindowListener(new WindowAdapter() {
211
			public void windowClosing(WindowEvent e) {
212
				// Simulates an event like the produced pressing the cancel button of the associated progress panel
213
				actionButtonPressed(new ButtonsPanelEvent(getProgressPanel(), ButtonsPanel.BUTTON_CANCEL));				
214
			}
215
		});
216
	}
217

  
218
	private void callActionCommandListeners(int actions) {
219
		if (!bDoCallListeners)
220
			return;
221
		Iterator<IncrementableListener> acIterator = actionCommandListeners.iterator();
222
		while (acIterator.hasNext()) {
223
			IncrementableListener listener = (IncrementableListener) acIterator.next();
224
			switch (actions) {
225
				case IncrementableEvent.RESUMED:
226
					listener.actionResumed(new IncrementableEvent(this));
227
					break;
228
				case IncrementableEvent.SUSPENDED:
229
					listener.actionSuspended(new IncrementableEvent(this));
230
					break;
231
				case IncrementableEvent.CANCELED:
232
					listener.actionCanceled(new IncrementableEvent(this));
233
					break;
234
			}
235
		}
236
	}
237

  
238
	/**
239
	 * A?adir el manejador de eventos para atender las peticiones de start,
240
	 * stop...
241
	 *
242
	 * @param listener
243
	 */
244
	public void addIncrementableListener(IncrementableListener listener) {
245
		if (!actionCommandListeners.contains(listener))
246
			actionCommandListeners.add(listener);
247
	}
248

  
249
	/**
250
	 * Borrar un manejador de eventos.
251
	 * @param listener
252
	 */
253
	public void removeIncrementableListener(IncrementableListener listener) {
254
		actionCommandListeners.remove(listener);
255
	}
256

  
257
	/**
258
	 * Definir si queremos que confirme al usuario si realmente desea cancelar el
259
	 * proceso
260
	 *
261
	 * @param value
262
	 */
263
	public void setAskCancel(boolean value) {
264
		askOnCancel = value;
265
	}
266

  
267
	/**
268
	 * Metodo para gestionar todos los eventos del objeto.
269
	 */
270
	public void actionButtonPressed(ButtonsPanelEvent e) {
271
		switch (e.getButton()) {
272
			case ButtonsPanel.BUTTON_CANCEL:
273
				boolean cancelled = true;
274
				if (askOnCancel) {
275
					if (! iIncrementable.isCancelable()) {
276
						JOptionPane.showMessageDialog(null, Messages.getText("The_process_cant_be_cancelled"), Messages.getText("Information"), JOptionPane.INFORMATION_MESSAGE);
277
						return;
278
					}
279

  
280
					/* Pauses the process */
281
					if (iIncrementable.isPausable()) {
282
						try {
283
							callActionCommandListeners(IncrementableEvent.SUSPENDED);
284
						}
285
						catch (Exception iex) {
286
                        LOG.error("", iex);
287
							JOptionPane.showMessageDialog(null, Messages.getText("Failed_pausing_the_process"), Messages.getText("Error"), JOptionPane.ERROR_MESSAGE);
288
						}
289
					}
290
	
291
					/* Asks user to cancel or not the process */
292
					cancelled = false;
293
					String string1 = Messages.getText("Yes");
294
					String string2 = Messages.getText("No");
295
					Object[] options = { string1, string2 };
296
					int answer = JOptionPane.showOptionDialog(getProgressPanel(), Messages
297
							.getText("msg_cancel_incrementable"), Messages
298
							.getText("title_cancel_incrementable"),
299
							JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
300
							options, string1);
301
					if (answer == JOptionPane.YES_OPTION) {
302
						cancelled = true;
303

  
304
						/* Continues the process */
305
						try {
306
							if (iIncrementable.isPausable())
307
								callActionCommandListeners(IncrementableEvent.RESUMED);
308
						} catch (Exception e2) {
309
                        LOG.error("", e2);
310
							Messages.getText("Failed_resuming_the_process");
311
						}
312
					}
313
					else {
314
						/* Continues the process */
315
						try {
316
							if (iIncrementable.isPausable())
317
								callActionCommandListeners(IncrementableEvent.RESUMED);
318
						} catch (Exception e2) {
319
                        LOG.error("", e2);
320
							Messages.getText("Failed_resuming_the_process");
321
						}
322
					}
323
				}
324
				if (cancelled) {
325
//					ended = true;
326
					// Will wait the process to finish and notify this to stop
327
					callActionCommandListeners(IncrementableEvent.CANCELED);
328
				}
329
				break;
330
			case ButtonsPanel.BUTTON_PAUSE:
331
				threadSuspended = true;
332

  
333
				/* Pauses the associated process */
334
				try {
335
					if (! iIncrementable.isPausable()) {
336
						JOptionPane.showMessageDialog(null, Messages.getText("The_process_cant_be_paused"), Messages.getText("Information"), JOptionPane.INFORMATION_MESSAGE);
337
					}
338
					else {
339
						callActionCommandListeners(IncrementableEvent.SUSPENDED);
340
					}
341
				}
342
				catch (Exception iex) {
343
                LOG.error("", iex);
344
					JOptionPane.showMessageDialog(null, Messages.getText("Failed_pausing_the_process"), Messages.getText("Error"), JOptionPane.ERROR_MESSAGE);
345
				}
346

  
347
				break;
348
			case ButtonsPanel.BUTTON_RESTART:
349
				threadSuspended = false;
350

  
351
				/* Resumes the associated process */
352
				callActionCommandListeners(IncrementableEvent.RESUMED);
353
				break;
354
		}
355
	}
356

  
357
	/**
358
	 * @see ProgressPanel#getButtonsPanel()
359
	 */
360
	public IButtonsPanel getButtonsPanel() {
361
		return getProgressPanel().getButtonsPanel();
362
	}
363
}
0 364

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/gui/IncrementableListener.java
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
package org.gvsig.raster.algorithm.gui;
25

  
26
/* gvSIG. Geographic Information System of the Valencian Government
27
 *
28
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
29
 * of the Valencian Government (CIT)
30
 * 
31
 * This program is free software; you can redistribute it and/or
32
 * modify it under the terms of the GNU General Public License
33
 * as published by the Free Software Foundation; either version 2
34
 * of the License, or (at your option) any later version.
35
 * 
36
 * This program is distributed in the hope that it will be useful,
37
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
39
 * GNU General Public License for more details.
40
 *  
41
 * You should have received a copy of the GNU General Public License
42
 * along with this program; if not, write to the Free Software
43
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
44
 * MA  02110-1301, USA.
45
 * 
46
 */
47

  
48
import java.util.EventListener;
49

  
50
/**
51
 * Interfaz para la ventana IncrementableTask, aqui se define los
52
 * comportamientos de los botones de la ventana.
53
 *
54
 * @version 23/04/2007
55
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
56
 */
57
public interface IncrementableListener extends EventListener {
58
	/**
59
	 * Invocado cuando se aprieta el boton Resumir de la ventana
60
	 * @param e
61
	 */
62
	public void actionResumed(IncrementableEvent e);
63

  
64
	/**
65
	 * Invocado cuando se aprieta el boton Suspender de la ventana
66
	 * @param e
67
	 */
68
	public void actionSuspended(IncrementableEvent e);
69

  
70
	/**
71
	 * Invocado cuando se aprieta el boton Cancelar de la ventana
72
	 * @param e
73
	 */
74
	public void actionCanceled(IncrementableEvent e);
75
}
0 76

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/RasterBaseAlgorithmLibrary.java
56 56
	 * @param process
57 57
	 * @return
58 58
	 */
59
	@SuppressWarnings("unchecked")
59 60
	public static String getProcessName(Class<?> process) {
60 61
		ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager();
61 62
		ExtensionPoint point = extensionPoints.add(REGISTER_PROCESS_LABEL);
......
121 122
    @Override
122 123
    protected void doPostInitialize() throws LibraryException {
123 124
        Messages.addResourceFamily(
124
            "org.gvsig.raster.tools.algorithm.base", 
125
            "org.gvsig.raster.algorithm.i18n.text", 
125 126
            RasterBaseAlgorithmLibrary.class.getClassLoader(), 
126 127
            RasterBaseAlgorithmLibrary.class.getClass().getName());
127 128
        //registerGeoProcess(new RasterReprojectAlgorithmLibrary());
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/resources/org/gvsig/raster/algorithm/i18n/text.properties
1
The_process_cant_be_cancelled=No se puede cancelar el proceso
2
Failed_pausing_the_process=No se puede pausar el proceso
3
msg_cancel_incrementable=?Est? seguro de que desea cancelar este proceso?
4
title_cancel_incrementable=Confirmaci?n
5
Failed_resuming_the_process=Fall\u00f3 reanudando el proceso.
6
The_process_cant_be_paused=No se puede pausar el proceso
7
espere=Espere
8
tiempo_transcurrido=Tiempo transcurrido
9
error_processing=Error en el procesado
0 10

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/resources/org/gvsig/raster/algorithm/i18n/text_en.properties
1
The_process_cant_be_cancelled=Operation cannot be cancelled.
2
Failed_pausing_the_process=Failed to pause processing.
3
msg_cancel_incrementable=Cancel the computation?
4
title_cancel_incrementable=Confirmation
5
Failed_resuming_the_process=Failed to resume processing.
6
The_process_cant_be_paused=Operation cannot be paused.
7
espere=Wait
8
tiempo_transcurrido=Elapsed time
9
error_processing=Error in the process
0 10

  
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/basepanel/IButtonsPanel.java
24 24
package org.gvsig.raster.swing.basepanel;
25 25

  
26 26
import javax.swing.JButton;
27
import javax.swing.JComponent;
27 28

  
28 29
public interface IButtonsPanel {
29 30
	public static final int BUTTON_ACCEPT             = 1;
......
173 174
	 * @return <code>true</code> if there was a button of that kind in this group, otherwise <code>false</code>
174 175
	 */
175 176
	public boolean setEnabled(int id, boolean b);
177
	
178
	public JComponent getComponent();
176 179
}
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/RasterSwingLibrary.java
26 26

  
27 27
import javax.swing.JOptionPane;
28 28

  
29
import org.gvsig.andami.PluginServices;
30 29
import org.gvsig.i18n.Messages;
31 30
import org.gvsig.tools.library.AbstractLibrary;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff