Revision 2669 branches/CqCMSDvp/libraries/libCq CMS for java.old/src/org/cresques/ui/raster/SaveSetupPanel.java
SaveSetupPanel.java | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 | 3 |
* |
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
8 | 8 |
* as published by the Free Software Foundation; either version 2 |
... | ... | |
18 | 18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
19 | 19 |
* |
20 | 20 |
* For more information, contact: |
21 |
*
|
|
21 |
* |
|
22 | 22 |
* cresques@gmail.com |
23 | 23 |
*/ |
24 | 24 |
package org.cresques.ui.raster; |
25 | 25 |
|
26 |
|
|
27 | 26 |
import java.awt.Dimension; |
28 | 27 |
import java.awt.event.ActionEvent; |
29 | 28 |
import java.awt.event.ActionListener; |
... | ... | |
33 | 32 |
import java.awt.event.KeyListener; |
34 | 33 |
import java.awt.event.MouseEvent; |
35 | 34 |
import java.awt.event.MouseListener; |
35 |
|
|
36 | 36 |
import java.io.File; |
37 | 37 |
|
38 | 38 |
import javax.swing.JFileChooser; |
39 | 39 |
import javax.swing.JPanel; |
40 | 40 |
import javax.swing.filechooser.FileFilter; |
41 | 41 |
|
42 |
|
|
42 | 43 |
/** |
43 | 44 |
* Panel encargado de manejar los eventos del los controles de Salvar a Raste |
44 | 45 |
* @author Nacho Brodin <brodin_ign@gva.es> |
45 | 46 |
*/ |
46 |
public class SaveSetupPanel extends JPanel implements ActionListener, MouseListener, FocusListener, KeyListener{ |
|
47 |
final private static long serialVersionUID = -3370601314380922368L; |
|
48 |
private DataInputSaveRaster saveRaster = null; |
|
49 |
private SaveRasterDialogPanel dialogPanel = null; |
|
50 |
private String fName = null; |
|
47 |
public class SaveSetupPanel extends JPanel implements ActionListener, |
|
48 |
MouseListener, |
|
49 |
FocusListener, |
|
50 |
KeyListener { |
|
51 |
final private static long serialVersionUID = -3370601314380922368L; |
|
52 |
private DataInputSaveRaster saveRaster = null; |
|
53 |
private SaveRasterDialogPanel dialogPanel = null; |
|
54 |
private String fName = null; |
|
51 | 55 |
|
52 |
/** |
|
53 |
* This method initializes |
|
54 |
* |
|
55 |
*/ |
|
56 |
public SaveSetupPanel() { |
|
57 |
super(); |
|
58 |
initialize(); |
|
59 |
} |
|
60 |
/** |
|
61 |
* This method initializes this |
|
62 |
* |
|
63 |
* @return void |
|
64 |
*/ |
|
65 |
void initialize() { |
|
66 |
this.setPreferredSize(new Dimension(350,210)); //AnchoxAlto panel interior |
|
56 |
/** |
|
57 |
* This method initializes |
|
58 |
* |
|
59 |
*/ |
|
60 |
public SaveSetupPanel() { |
|
61 |
super(); |
|
62 |
initialize(); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* This method initializes this |
|
67 |
* |
|
68 |
* @return void |
|
69 |
*/ |
|
70 |
void initialize() { |
|
71 |
this.setPreferredSize(new Dimension(350, 210)); //AnchoxAlto panel interior |
|
67 | 72 |
this.setBounds(0, 0, 300, 250); |
68 | 73 |
this.setLayout(null); |
69 | 74 |
this.add(getSaveParameters(), null); |
70 |
|
|
75 |
|
|
71 | 76 |
//A?adimos gesti?n de eventos |
72 |
|
|
73 | 77 |
saveRaster.getJComboBox().addActionListener(this); |
74 | 78 |
saveRaster.getTescala().addActionListener(this); |
75 | 79 |
saveRaster.getTescala().addMouseListener(this); |
... | ... | |
90 | 94 |
saveRaster.getBPropiedades().addActionListener(this); |
91 | 95 |
saveRaster.getTescala().addKeyListener(this); |
92 | 96 |
saveRaster.getJComboBox().addKeyListener(this); |
93 |
}
|
|
97 |
}
|
|
94 | 98 |
|
95 |
/** |
|
96 |
* Asigna un valor al panel padre |
|
97 |
* @param dialogPanel |
|
98 |
*/ |
|
99 |
|
|
100 |
public void setDialogPanel(SaveRasterDialogPanel dialogPanel){ |
|
101 |
this.dialogPanel = dialogPanel; |
|
102 |
} |
|
103 |
|
|
104 |
/** |
|
105 |
* Obtiene el Panel de Controles interior |
|
106 |
* @return |
|
107 |
*/ |
|
108 |
|
|
109 |
public DataInputSaveRaster getSaveParameters() { |
|
110 |
if (saveRaster == null) { |
|
111 |
saveRaster = new DataInputSaveRaster(); |
|
112 |
//saveRaster.setBounds(9, 9, 328, 75); |
|
99 |
/** |
|
100 |
* Asigna un valor al panel padre |
|
101 |
* @param dialogPanel |
|
102 |
*/ |
|
103 |
public void setDialogPanel(SaveRasterDialogPanel dialogPanel) { |
|
104 |
this.dialogPanel = dialogPanel; |
|
105 |
} |
|
113 | 106 |
|
114 |
} |
|
115 |
return saveRaster; |
|
116 |
} |
|
117 |
|
|
118 |
/** |
|
119 |
* Calculo del tama?o en pixels de la imagen a partir de las coordenadas del |
|
120 |
* mundo real, la escala y los puntos por pulgada |
|
121 |
*/ |
|
122 |
private void calcSizeImage(){ |
|
123 |
double lrX = Double.parseDouble(saveRaster.getTinf_derX().getText()); |
|
124 |
double lrY = Double.parseDouble(saveRaster.getTinf_derY().getText()); |
|
125 |
double ulX = Double.parseDouble(saveRaster.getTsup_izqX().getText()); |
|
126 |
double ulY = Double.parseDouble(saveRaster.getTsup_izqY().getText()); |
|
127 |
double wc_anchomts = 0; |
|
128 |
if(ulX>lrX)wc_anchomts = ulX-lrX; |
|
129 |
else wc_anchomts = lrX-ulX; |
|
130 |
double wc_altomts = 0; |
|
131 |
if(ulY>lrY)wc_altomts = ulY-lrY; |
|
132 |
else wc_altomts = lrY-ulY; |
|
133 |
|
|
134 |
//No aseguramos de que la escala sea un entero. Si no lo es ponemos un 0 |
|
135 |
|
|
136 |
try{ |
|
137 |
Integer.parseInt(saveRaster.getTescala().getText()); |
|
138 |
}catch(NumberFormatException e){ |
|
139 |
saveRaster.getTescala().setText("0"); |
|
140 |
} |
|
141 |
|
|
142 |
if(wc_anchomts<=0 || wc_altomts<=0 || Integer.parseInt(saveRaster.getTescala().getText())==0 ){ |
|
143 |
saveRaster.getTancho().setText("0"); |
|
144 |
saveRaster.getTalto().setText("0"); |
|
145 |
return; |
|
146 |
} |
|
147 |
|
|
148 |
//Calculo del tama?o de la imagen definitiva en pulgadas |
|
149 |
|
|
150 |
double anchopulgadas = (wc_anchomts / Double.parseDouble(saveRaster.getTescala().getText())) * 39.73007874D; |
|
151 |
double altopulgadas = (wc_altomts / Double.parseDouble (saveRaster.getTescala().getText())) * 39.73007874D; |
|
152 |
|
|
153 |
//Ancho en pixeles = ppp * sizepulgadas |
|
154 |
|
|
155 |
int anchopixels =(int) (Integer.parseInt(saveRaster.getJComboBox().getSelectedItem().toString() ) * anchopulgadas); |
|
156 |
int altopixels = (int) (Integer.parseInt(saveRaster.getJComboBox().getSelectedItem().toString() ) * altopulgadas); |
|
157 |
|
|
158 |
//int anchopixels =(int) (Toolkit.getDefaultToolkit().getScreenResolution() * anchopulgadas); |
|
159 |
//int altopixels = (int) (Toolkit.getDefaultToolkit().getScreenResolution() * altopulgadas); |
|
160 |
|
|
161 |
saveRaster.getTancho().setText(String.valueOf(anchopixels)); |
|
162 |
saveRaster.getTalto().setText(String.valueOf(altopixels)); |
|
163 |
|
|
164 |
} |
|
165 |
|
|
166 |
/** |
|
167 |
* Controla cuando se cumplen todos los requisitos en el formulario para |
|
168 |
* poder activar el bot?n de aceptar. |
|
169 |
*/ |
|
170 |
private void enableButtons(){ |
|
171 |
|
|
172 |
if( saveRaster.getTescala()== null || |
|
173 |
saveRaster.getTescala().getText().equals("") || |
|
174 |
saveRaster.getTescala().getText().equals("0") || |
|
175 |
this.fName == null || |
|
176 |
this.fName.equals("")){ |
|
177 |
if(dialogPanel!=null) |
|
178 |
dialogPanel.getAcceptButton().setEnabled(false); |
|
179 |
return; |
|
180 |
} |
|
181 |
|
|
182 |
|
|
183 |
if( saveRaster.getTancho().getText().equals("0") || |
|
184 |
saveRaster.getTalto().getText().equals("0")){ |
|
185 |
if(dialogPanel!=null) |
|
186 |
dialogPanel.getAcceptButton().setEnabled(false); |
|
187 |
return; |
|
188 |
} |
|
189 |
|
|
190 |
if(dialogPanel!=null) |
|
191 |
dialogPanel.getAcceptButton().setEnabled(true); |
|
192 |
} |
|
193 |
|
|
194 |
|
|
195 |
/** |
|
196 |
* Gestiona los eventos del cambio de escalla de la imagen y lla apertura del |
|
197 |
* dialogo de selecci?n del nombre del fichero. |
|
198 |
*/ |
|
199 |
public void actionPerformed(ActionEvent e){ |
|
200 |
|
|
201 |
if( e.getSource().equals(saveRaster.getJComboBox()) || |
|
202 |
e.getSource().equals(saveRaster.getTescala()) || |
|
203 |
e.getSource().equals(saveRaster.getTinf_derX()) || |
|
204 |
e.getSource().equals(saveRaster.getTinf_derY()) || |
|
205 |
e.getSource().equals(saveRaster.getTsup_izqX()) || |
|
206 |
e.getSource().equals(saveRaster.getTsup_izqY()) ){ |
|
207 |
this.calcSizeImage(); |
|
208 |
this.enableButtons(); |
|
209 |
} |
|
210 |
|
|
211 |
//Selector de Fichero sobre el cual se va a salvar a raster |
|
212 |
|
|
213 |
if( e.getSource().equals(saveRaster.getBseleccion())){ |
|
214 |
JFileChooser chooser = new JFileChooser("./"); |
|
215 |
chooser.setDialogTitle("Seleccionar el fichero"); |
|
216 |
String os = System.getProperties().getProperty("os.version"); |
|
217 |
if(os.startsWith("2.4")) |
|
218 |
chooser.addChoosableFileFilter(new EcwFilter(chooser)); |
|
219 |
chooser.addChoosableFileFilter(new TifFilter(chooser)); |
|
220 |
int returnVal = chooser.showOpenDialog(this); |
|
221 |
if(returnVal == JFileChooser.APPROVE_OPTION){ |
|
222 |
this.fName = chooser.getSelectedFile().toString(); |
|
223 |
|
|
224 |
FileFilter filter = chooser.getFileFilter(); |
|
225 |
if(fName!=null && !fName.equals("")){ |
|
226 |
if(this.fName.endsWith(".ecw") && os.startsWith("2.4")) |
|
227 |
saveRaster.getBPropiedades().setText("Propiedades Ecw"); |
|
228 |
else if(this.fName.endsWith(".tif")) |
|
229 |
saveRaster.getBPropiedades().setText("Propiedades GeoTiff"); |
|
230 |
else if(filter.getDescription().equals(".ecw") && os.startsWith("2.4")) |
|
231 |
saveRaster.getBPropiedades().setText("Propiedades Ecw"); |
|
232 |
else if(filter.getDescription().equals(".tif")) |
|
233 |
saveRaster.getBPropiedades().setText("Propiedades GeoTiff"); |
|
234 |
} |
|
235 |
if( !fName.endsWith(".ecw") && |
|
236 |
!fName.endsWith(".tif")) |
|
237 |
fName = new String(chooser.getSelectedFile().toString()+filter.getDescription()); |
|
238 |
|
|
239 |
enableButtons(); |
|
240 |
} |
|
241 |
} |
|
242 |
} |
|
243 |
|
|
244 |
|
|
245 |
/** |
|
246 |
* Devuelve el nombre del fichero seleccionado |
|
247 |
* @return Nombre del fichero seleccionado |
|
248 |
*/ |
|
249 |
public String getFileName(){ |
|
250 |
return fName; |
|
251 |
} |
|
252 |
|
|
253 |
|
|
254 |
/** |
|
255 |
* Unused |
|
256 |
*/ |
|
257 |
public void mouseExited(MouseEvent e){} |
|
258 |
|
|
259 |
/** |
|
260 |
* Unused. Only for compilant purposes |
|
261 |
*/ |
|
262 |
public void mouseReleased(MouseEvent e){} |
|
263 |
|
|
264 |
/** |
|
265 |
* Unused. Only for compilant purposes |
|
266 |
*/ |
|
267 |
public void mouseEntered(MouseEvent e){} |
|
268 |
|
|
269 |
public void mouseClicked(MouseEvent e){ |
|
270 |
this.calcSizeImage(); |
|
271 |
enableButtons(); |
|
272 |
} |
|
273 |
|
|
274 |
/** |
|
275 |
* Unused. Only for compilant purposes |
|
276 |
*/ |
|
277 |
public void mousePressed(MouseEvent e){} |
|
278 |
|
|
279 |
/** |
|
280 |
* Unused. Only for compilant purposes |
|
281 |
*/ |
|
282 |
public void focusGained(FocusEvent e){} |
|
283 |
|
|
284 |
/** |
|
285 |
* Recalcula el tama?o de la imagen con los datos existentes y |
|
286 |
* activa o desactiva los botones. |
|
287 |
*/ |
|
288 |
public void focusLost(FocusEvent e){ |
|
289 |
this.calcSizeImage(); |
|
290 |
enableButtons(); |
|
291 |
} |
|
292 |
|
|
293 |
/** |
|
294 |
* Activa o Desactiva los botones a trav?s de la funci?n que valida los campos |
|
295 |
*/ |
|
296 |
public void keyTyped(KeyEvent e){enableButtons();} |
|
297 |
|
|
298 |
/** |
|
299 |
* Activa o Desactiva los botones a trav?s de la funci?n que valida los campos |
|
300 |
*/ |
|
301 |
public void keyPressed(KeyEvent e){enableButtons();} |
|
302 |
|
|
303 |
/** |
|
304 |
* Activa o Desactiva los botones a trav?s de la funci?n que valida los campos |
|
305 |
*/ |
|
306 |
public void keyReleased(KeyEvent e){enableButtons();} |
|
307 |
} |
|
107 |
/** |
|
108 |
* Obtiene el Panel de Controles interior |
|
109 |
* @return |
|
110 |
*/ |
|
111 |
public DataInputSaveRaster getSaveParameters() { |
|
112 |
if (saveRaster == null) { |
|
113 |
saveRaster = new DataInputSaveRaster(); |
|
308 | 114 |
|
115 |
//saveRaster.setBounds(9, 9, 328, 75); |
|
116 |
} |
|
117 |
|
|
118 |
return saveRaster; |
|
119 |
} |
|
120 |
|
|
121 |
/** |
|
122 |
* Calculo del tama?o en pixels de la imagen a partir de las coordenadas del |
|
123 |
* mundo real, la escala y los puntos por pulgada |
|
124 |
*/ |
|
125 |
private void calcSizeImage() { |
|
126 |
double lrX = Double.parseDouble(saveRaster.getTinf_derX().getText()); |
|
127 |
double lrY = Double.parseDouble(saveRaster.getTinf_derY().getText()); |
|
128 |
double ulX = Double.parseDouble(saveRaster.getTsup_izqX().getText()); |
|
129 |
double ulY = Double.parseDouble(saveRaster.getTsup_izqY().getText()); |
|
130 |
double wc_anchomts = 0; |
|
131 |
|
|
132 |
if (ulX > lrX) { |
|
133 |
wc_anchomts = ulX - lrX; |
|
134 |
} else { |
|
135 |
wc_anchomts = lrX - ulX; |
|
136 |
} |
|
137 |
|
|
138 |
double wc_altomts = 0; |
|
139 |
|
|
140 |
if (ulY > lrY) { |
|
141 |
wc_altomts = ulY - lrY; |
|
142 |
} else { |
|
143 |
wc_altomts = lrY - ulY; |
|
144 |
} |
|
145 |
|
|
146 |
//No aseguramos de que la escala sea un entero. Si no lo es ponemos un 0 |
|
147 |
try { |
|
148 |
Integer.parseInt(saveRaster.getTescala().getText()); |
|
149 |
} catch (NumberFormatException e) { |
|
150 |
saveRaster.getTescala().setText("0"); |
|
151 |
} |
|
152 |
|
|
153 |
if ((wc_anchomts <= 0) || (wc_altomts <= 0) || |
|
154 |
(Integer.parseInt(saveRaster.getTescala().getText()) == 0)) { |
|
155 |
saveRaster.getTancho().setText("0"); |
|
156 |
saveRaster.getTalto().setText("0"); |
|
157 |
|
|
158 |
return; |
|
159 |
} |
|
160 |
|
|
161 |
//Calculo del tama?o de la imagen definitiva en pulgadas |
|
162 |
double anchopulgadas = (wc_anchomts / Double.parseDouble(saveRaster.getTescala() |
|
163 |
.getText())) * 39.73007874D; |
|
164 |
double altopulgadas = (wc_altomts / Double.parseDouble(saveRaster.getTescala() |
|
165 |
.getText())) * 39.73007874D; |
|
166 |
|
|
167 |
//Ancho en pixeles = ppp * sizepulgadas |
|
168 |
int anchopixels = (int) (Integer.parseInt(saveRaster.getJComboBox() |
|
169 |
.getSelectedItem() |
|
170 |
.toString()) * anchopulgadas); |
|
171 |
int altopixels = (int) (Integer.parseInt(saveRaster.getJComboBox() |
|
172 |
.getSelectedItem() |
|
173 |
.toString()) * altopulgadas); |
|
174 |
|
|
175 |
//int anchopixels =(int) (Toolkit.getDefaultToolkit().getScreenResolution() * anchopulgadas); |
|
176 |
//int altopixels = (int) (Toolkit.getDefaultToolkit().getScreenResolution() * altopulgadas); |
|
177 |
saveRaster.getTancho().setText(String.valueOf(anchopixels)); |
|
178 |
saveRaster.getTalto().setText(String.valueOf(altopixels)); |
|
179 |
} |
|
180 |
|
|
181 |
/** |
|
182 |
* Controla cuando se cumplen todos los requisitos en el formulario para |
|
183 |
* poder activar el bot?n de aceptar. |
|
184 |
*/ |
|
185 |
private void enableButtons() { |
|
186 |
if ((saveRaster.getTescala() == null) || |
|
187 |
saveRaster.getTescala().getText().equals("") || |
|
188 |
saveRaster.getTescala().getText().equals("0") || |
|
189 |
(this.fName == null) || this.fName.equals("")) { |
|
190 |
if (dialogPanel != null) { |
|
191 |
dialogPanel.getAcceptButton().setEnabled(false); |
|
192 |
} |
|
193 |
|
|
194 |
return; |
|
195 |
} |
|
196 |
|
|
197 |
if (saveRaster.getTancho().getText().equals("0") || |
|
198 |
saveRaster.getTalto().getText().equals("0")) { |
|
199 |
if (dialogPanel != null) { |
|
200 |
dialogPanel.getAcceptButton().setEnabled(false); |
|
201 |
} |
|
202 |
|
|
203 |
return; |
|
204 |
} |
|
205 |
|
|
206 |
if (dialogPanel != null) { |
|
207 |
dialogPanel.getAcceptButton().setEnabled(true); |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
/** |
|
212 |
* Gestiona los eventos del cambio de escalla de la imagen y lla apertura del |
|
213 |
* dialogo de selecci?n del nombre del fichero. |
|
214 |
*/ |
|
215 |
public void actionPerformed(ActionEvent e) { |
|
216 |
if (e.getSource().equals(saveRaster.getJComboBox()) || |
|
217 |
e.getSource().equals(saveRaster.getTescala()) || |
|
218 |
e.getSource().equals(saveRaster.getTinf_derX()) || |
|
219 |
e.getSource().equals(saveRaster.getTinf_derY()) || |
|
220 |
e.getSource().equals(saveRaster.getTsup_izqX()) || |
|
221 |
e.getSource().equals(saveRaster.getTsup_izqY())) { |
|
222 |
this.calcSizeImage(); |
|
223 |
this.enableButtons(); |
|
224 |
} |
|
225 |
|
|
226 |
//Selector de Fichero sobre el cual se va a salvar a raster |
|
227 |
if (e.getSource().equals(saveRaster.getBseleccion())) { |
|
228 |
JFileChooser chooser = new JFileChooser("./"); |
|
229 |
chooser.setDialogTitle("Seleccionar el fichero"); |
|
230 |
|
|
231 |
String os = System.getProperties().getProperty("os.version"); |
|
232 |
|
|
233 |
if (os.startsWith("2.4")) { |
|
234 |
chooser.addChoosableFileFilter(new EcwFilter(chooser)); |
|
235 |
} |
|
236 |
|
|
237 |
chooser.addChoosableFileFilter(new TifFilter(chooser)); |
|
238 |
|
|
239 |
int returnVal = chooser.showOpenDialog(this); |
|
240 |
|
|
241 |
if (returnVal == JFileChooser.APPROVE_OPTION) { |
|
242 |
this.fName = chooser.getSelectedFile().toString(); |
|
243 |
|
|
244 |
FileFilter filter = chooser.getFileFilter(); |
|
245 |
|
|
246 |
if ((fName != null) && !fName.equals("")) { |
|
247 |
if (this.fName.endsWith(".ecw") && os.startsWith("2.4")) { |
|
248 |
saveRaster.getBPropiedades().setText("Propiedades Ecw"); |
|
249 |
} else if (this.fName.endsWith(".tif")) { |
|
250 |
saveRaster.getBPropiedades().setText("Propiedades GeoTiff"); |
|
251 |
} else if (filter.getDescription().equals(".ecw") && |
|
252 |
os.startsWith("2.4")) { |
|
253 |
saveRaster.getBPropiedades().setText("Propiedades Ecw"); |
|
254 |
} else if (filter.getDescription().equals(".tif")) { |
|
255 |
saveRaster.getBPropiedades().setText("Propiedades GeoTiff"); |
|
256 |
} |
|
257 |
} |
|
258 |
|
|
259 |
if (!fName.endsWith(".ecw") && !fName.endsWith(".tif")) { |
|
260 |
fName = new String(chooser.getSelectedFile().toString() + |
|
261 |
filter.getDescription()); |
|
262 |
} |
|
263 |
|
|
264 |
enableButtons(); |
|
265 |
} |
|
266 |
} |
|
267 |
} |
|
268 |
|
|
269 |
/** |
|
270 |
* Devuelve el nombre del fichero seleccionado |
|
271 |
* @return Nombre del fichero seleccionado |
|
272 |
*/ |
|
273 |
public String getFileName() { |
|
274 |
return fName; |
|
275 |
} |
|
276 |
|
|
277 |
/** |
|
278 |
* Unused |
|
279 |
*/ |
|
280 |
public void mouseExited(MouseEvent e) { |
|
281 |
} |
|
282 |
|
|
283 |
/** |
|
284 |
* Unused. Only for compilant purposes |
|
285 |
*/ |
|
286 |
public void mouseReleased(MouseEvent e) { |
|
287 |
} |
|
288 |
|
|
289 |
/** |
|
290 |
* Unused. Only for compilant purposes |
|
291 |
*/ |
|
292 |
public void mouseEntered(MouseEvent e) { |
|
293 |
} |
|
294 |
|
|
295 |
public void mouseClicked(MouseEvent e) { |
|
296 |
this.calcSizeImage(); |
|
297 |
enableButtons(); |
|
298 |
} |
|
299 |
|
|
300 |
/** |
|
301 |
* Unused. Only for compilant purposes |
|
302 |
*/ |
|
303 |
public void mousePressed(MouseEvent e) { |
|
304 |
} |
|
305 |
|
|
306 |
/** |
|
307 |
* Unused. Only for compilant purposes |
|
308 |
*/ |
|
309 |
public void focusGained(FocusEvent e) { |
|
310 |
} |
|
311 |
|
|
312 |
/** |
|
313 |
* Recalcula el tama?o de la imagen con los datos existentes y |
|
314 |
* activa o desactiva los botones. |
|
315 |
*/ |
|
316 |
public void focusLost(FocusEvent e) { |
|
317 |
this.calcSizeImage(); |
|
318 |
enableButtons(); |
|
319 |
} |
|
320 |
|
|
321 |
/** |
|
322 |
* Activa o Desactiva los botones a trav?s de la funci?n que valida los campos |
|
323 |
*/ |
|
324 |
public void keyTyped(KeyEvent e) { |
|
325 |
enableButtons(); |
|
326 |
} |
|
327 |
|
|
328 |
/** |
|
329 |
* Activa o Desactiva los botones a trav?s de la funci?n que valida los campos |
|
330 |
*/ |
|
331 |
public void keyPressed(KeyEvent e) { |
|
332 |
enableButtons(); |
|
333 |
} |
|
334 |
|
|
335 |
/** |
|
336 |
* Activa o Desactiva los botones a trav?s de la funci?n que valida los campos |
|
337 |
*/ |
|
338 |
public void keyReleased(KeyEvent e) { |
|
339 |
enableButtons(); |
|
340 |
} |
|
341 |
} |
|
342 |
|
|
343 |
|
|
309 | 344 |
/** |
310 | 345 |
* @author Nacho Brodin <brodin_ign@gva.es> |
311 | 346 |
* Filtro Ecw para el selector de formatos de escritura |
312 | 347 |
*/ |
313 | 348 |
class EcwFilter extends javax.swing.filechooser.FileFilter { |
314 |
|
|
315 |
private JFileChooser chooser = null; |
|
316 |
|
|
317 |
public EcwFilter(JFileChooser ch){ |
|
318 |
this.chooser = ch; |
|
319 |
} |
|
320 |
|
|
349 |
private JFileChooser chooser = null; |
|
350 |
|
|
351 |
public EcwFilter(JFileChooser ch) { |
|
352 |
this.chooser = ch; |
|
353 |
} |
|
354 |
|
|
321 | 355 |
public boolean accept(File f) { |
356 |
return f.isDirectory() || f.getName().toLowerCase().endsWith(".ecw"); |
|
357 |
} |
|
322 | 358 |
|
323 |
return f.isDirectory() || f.getName().toLowerCase().endsWith(".ecw"); |
|
324 |
} |
|
325 |
|
|
326 | 359 |
public String getDescription() { |
327 |
return ".ecw";
|
|
360 |
return ".ecw";
|
|
328 | 361 |
} |
329 |
|
|
330 | 362 |
} |
331 | 363 |
|
364 |
|
|
332 | 365 |
/** |
333 | 366 |
* @author Nacho Brodin <brodin_ign@gva.es> |
334 | 367 |
* Filtro GTiff para el selector de formatos de escritura |
335 | 368 |
*/ |
336 | 369 |
class TifFilter extends javax.swing.filechooser.FileFilter { |
337 |
|
|
338 |
private JFileChooser chooser = null; |
|
339 |
|
|
340 |
public TifFilter(JFileChooser ch){ |
|
341 |
this.chooser = ch; |
|
342 |
} |
|
343 |
|
|
370 |
private JFileChooser chooser = null; |
|
371 |
|
|
372 |
public TifFilter(JFileChooser ch) { |
|
373 |
this.chooser = ch; |
|
374 |
} |
|
375 |
|
|
344 | 376 |
public boolean accept(File f) { |
345 |
return f.isDirectory() || f.getName().toLowerCase().endsWith(".tif");
|
|
377 |
return f.isDirectory() || f.getName().toLowerCase().endsWith(".tif");
|
|
346 | 378 |
} |
347 |
|
|
379 |
|
|
348 | 380 |
public String getDescription() { |
349 |
return ".tif";
|
|
381 |
return ".tif";
|
|
350 | 382 |
} |
351 |
|
|
352 | 383 |
} |
Also available in: Unified diff