Revision 1776 branches/CqCMSDvp/libraries/libCq CMS for java.old/src/org/cresques/ui/raster/FilterRasterDialogPanel.java
FilterRasterDialogPanel.java | ||
---|---|---|
7 | 7 |
import java.awt.event.ActionListener; |
8 | 8 |
import java.awt.event.FocusEvent; |
9 | 9 |
import java.awt.event.FocusListener; |
10 |
import java.awt.event.KeyEvent; |
|
11 |
import java.awt.event.KeyListener; |
|
12 |
import java.awt.event.MouseEvent; |
|
13 |
import java.awt.event.MouseListener; |
|
10 | 14 |
import java.io.IOException; |
11 | 15 |
|
12 | 16 |
import javax.swing.event.ChangeEvent; |
... | ... | |
20 | 24 |
* Panel que contiene todos los paneles de los tabs del cuadro de dialogo |
21 | 25 |
* de bandas y transparencias |
22 | 26 |
*/ |
23 |
public class FilterRasterDialogPanel extends DefaultTabPanel implements ActionListener, ChangeListener, FocusListener{
|
|
27 |
public class FilterRasterDialogPanel extends DefaultTabPanel implements ActionListener, ChangeListener, MouseListener, FocusListener, KeyListener{
|
|
24 | 28 |
|
25 | 29 |
//Tama?o de panel interior. El tab de dentro es proporcional |
26 | 30 |
protected int sizePanelX = 350; |
27 | 31 |
protected int sizePanelY = 210; |
28 | 32 |
private RasterTransparencyPanel pTrans = null; |
29 | 33 |
private BandSetupPanel pSetup = null; |
30 |
private int[][] rangeTransparency; |
|
34 |
private int[][] rangeRed = null; |
|
35 |
private int[][] rangeGreen = null; |
|
36 |
private int[][] rangeBlue = null; |
|
31 | 37 |
|
38 |
|
|
32 | 39 |
public FilterRasterDialogPanel() { |
33 | 40 |
|
34 | 41 |
super(); |
... | ... | |
59 | 66 |
pTrans.getOpacitySlider().addChangeListener(this); |
60 | 67 |
pTrans.getOpacityText().addActionListener(this); |
61 | 68 |
pTrans.getOpacityText().addFocusListener(this); |
69 |
pTrans.getTRojo().addFocusListener(this); |
|
70 |
pTrans.getTVerde().addFocusListener(this); |
|
71 |
pTrans.getTAzul().addFocusListener(this); |
|
72 |
pTrans.getTRojo().addMouseListener(this); |
|
73 |
pTrans.getTVerde().addMouseListener(this); |
|
74 |
pTrans.getTAzul().addMouseListener(this); |
|
62 | 75 |
|
63 | 76 |
//Ocultamos el bot?n de aplicar |
64 | 77 |
|
... | ... | |
126 | 139 |
|
127 | 140 |
if( e.getSource().equals(pTrans.getTRojo())){ |
128 | 141 |
try{ |
129 |
getTransparencyValues(pTrans.getTRojo().getText()); |
|
142 |
rangeRed = getTransparencyValues(pTrans.getTRojo().getText());
|
|
130 | 143 |
}catch(IOException exc){ |
131 | 144 |
pTrans.getTRojo().setText(""); |
132 | 145 |
} |
... | ... | |
136 | 149 |
|
137 | 150 |
if( e.getSource().equals(pTrans.getTVerde())){ |
138 | 151 |
try{ |
139 |
getTransparencyValues(pTrans.getTVerde().getText()); |
|
152 |
rangeGreen = getTransparencyValues(pTrans.getTVerde().getText());
|
|
140 | 153 |
}catch(IOException exc){ |
141 | 154 |
pTrans.getTVerde().setText(""); |
142 | 155 |
} |
... | ... | |
146 | 159 |
|
147 | 160 |
if( e.getSource().equals(pTrans.getTAzul())){ |
148 | 161 |
try{ |
149 |
getTransparencyValues(pTrans.getTAzul().getText()); |
|
162 |
rangeBlue = getTransparencyValues(pTrans.getTAzul().getText());
|
|
150 | 163 |
}catch(IOException exc){ |
151 | 164 |
pTrans.getTAzul().setText(""); |
152 | 165 |
} |
... | ... | |
160 | 173 |
* texto introducida por el usuario. |
161 | 174 |
* @param values |
162 | 175 |
*/ |
163 |
private void getTransparencyValues(String values)throws IOException{
|
|
176 |
private int[][] getTransparencyValues(String values)throws IOException{
|
|
164 | 177 |
|
178 |
int[][] rangeTransparency = null; |
|
179 |
|
|
165 | 180 |
for(int i=0;i<values.length();i++){ |
166 | 181 |
char c = values.charAt(i); |
167 | 182 |
|
... | ... | |
234 | 249 |
throw new IOException(); |
235 | 250 |
} |
236 | 251 |
} |
237 |
|
|
238 |
for(int i=0;i<rangeTransparency.length;i++) |
|
239 |
System.out.println("("+rangeTransparency[i][0]+":"+rangeTransparency[i][1]+")"); |
|
252 |
return rangeTransparency; |
|
253 |
//for(int i=0;i<rangeTransparency.length;i++)
|
|
254 |
// System.out.println("("+rangeTransparency[i][0]+":"+rangeTransparency[i][1]+")");
|
|
240 | 255 |
} |
256 |
|
|
257 |
return null; |
|
241 | 258 |
} |
242 | 259 |
|
260 |
/** |
|
261 |
* Devuelve el rango de valores para poner transparencia en el Rojo |
|
262 |
* @return |
|
263 |
*/ |
|
264 |
public int[][] getRangeRed(){ |
|
265 |
return rangeRed; |
|
266 |
} |
|
243 | 267 |
|
268 |
/** |
|
269 |
* Devuelve el rango de valores para poner transparencia en el Verde |
|
270 |
* @return |
|
271 |
*/ |
|
272 |
public int[][] getRangeGreen(){ |
|
273 |
return rangeGreen; |
|
274 |
} |
|
244 | 275 |
|
276 |
/** |
|
277 |
* Devuelve el rango de valores para poner transparencia en el Azul |
|
278 |
* @return |
|
279 |
*/ |
|
280 |
public int[][] getRangeBlue(){ |
|
281 |
return rangeBlue; |
|
282 |
} |
|
283 |
|
|
245 | 284 |
/** |
246 | 285 |
* Controla que si el formato introducido en el textfield |
247 | 286 |
* de opacidad es numerico se actualiza la posici?n del |
... | ... | |
261 | 300 |
} |
262 | 301 |
} |
263 | 302 |
|
303 |
/** |
|
304 |
* |
|
305 |
*/ |
|
306 |
public void checkTransparencyValues(){ |
|
307 |
|
|
308 |
if(!pTrans.getTRojo().getText().equals("")){ |
|
309 |
try{ |
|
310 |
rangeRed = getTransparencyValues(pTrans.getTRojo().getText()); |
|
311 |
}catch(IOException exc){ |
|
312 |
pTrans.getTRojo().setText(""); |
|
313 |
} |
|
314 |
} |
|
315 |
if(!pTrans.getTVerde().getText().equals("")){ |
|
316 |
try{ |
|
317 |
rangeGreen = getTransparencyValues(pTrans.getTVerde().getText()); |
|
318 |
}catch(IOException exc){ |
|
319 |
pTrans.getTVerde().setText(""); |
|
320 |
} |
|
321 |
} |
|
322 |
if(!pTrans.getTAzul().getText().equals("")){ |
|
323 |
try{ |
|
324 |
rangeBlue = getTransparencyValues(pTrans.getTAzul().getText()); |
|
325 |
}catch(IOException exc){ |
|
326 |
pTrans.getTAzul().setText(""); |
|
327 |
} |
|
328 |
} |
|
329 |
} |
|
330 |
|
|
264 | 331 |
/* |
265 | 332 |
* |
266 | 333 |
*/ |
... | ... | |
275 | 342 |
|
276 | 343 |
public void focusLost(FocusEvent e) { |
277 | 344 |
checkOpacity(); |
345 |
checkTransparencyValues(); |
|
278 | 346 |
} |
279 | 347 |
|
280 |
/*public void mouseExited(MouseEvent e){}
|
|
348 |
public void mouseExited(MouseEvent e){} |
|
281 | 349 |
public void mouseReleased(MouseEvent e){} |
282 | 350 |
public void mouseEntered(MouseEvent e){} |
283 | 351 |
|
284 | 352 |
public void mouseClicked(MouseEvent e){} |
285 | 353 |
|
286 |
public void mousePressed(MouseEvent e){} |
|
354 |
public void mousePressed(MouseEvent e){checkTransparencyValues();}
|
|
287 | 355 |
|
288 | 356 |
public void keyTyped(KeyEvent e){ |
289 | 357 |
} |
290 | 358 |
public void keyPressed(KeyEvent e){ |
291 | 359 |
} |
292 | 360 |
public void keyReleased(KeyEvent e){} |
293 |
*/ |
|
361 |
|
|
294 | 362 |
} |
295 | 363 |
|
296 | 364 |
|
Also available in: Unified diff