Revision 4377 trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/raster/RasterTransparencyPanel.java
RasterTransparencyPanel.java | ||
---|---|---|
55 | 55 |
private String[] nameBands = { "Rojo", "Verde", "Azul" }; |
56 | 56 |
private JPanel jPanel = null; |
57 | 57 |
private JPanel jPanel1 = null; |
58 |
private JPanel jPanel2 = null; |
|
59 |
private JPanel jPanel3 = null; |
|
60 | 58 |
private JCheckBox cbTransparencia = null; |
61 | 59 |
|
62 | 60 |
/** |
63 | 61 |
* Variable p?blica para la traducci?n |
64 | 62 |
*/ |
65 |
public JLabel lRedValue = null; |
|
66 |
private JTextFieldExt tRojo = null; |
|
67 |
|
|
68 |
/** |
|
69 |
* Variable p?blica para la traducci?n |
|
70 |
*/ |
|
71 |
public JLabel lGreenValue = null; |
|
72 |
|
|
73 |
/** |
|
74 |
* Variable p?blica para la traducci?n |
|
75 |
*/ |
|
76 |
public JLabel lBlueValue = null; |
|
77 |
|
|
78 |
/** |
|
79 |
* Variable p?blica para la traducci?n |
|
80 |
*/ |
|
81 | 63 |
public JPanel pGeneralTrans = null; |
82 | 64 |
|
83 |
/** |
|
84 |
* Variable p?blica para la traducci?n |
|
85 |
*/ |
|
86 |
public JLabel lRange = null; |
|
87 |
|
|
88 |
/** |
|
89 |
* Variable p?blica para la traducci?n |
|
90 |
*/ |
|
91 |
public JLabel lPixelValue = null; |
|
92 |
private JTextFieldExt tVerde = null; |
|
93 |
private JTextFieldExt tAzul = null; |
|
94 | 65 |
private JCheckBox cbOpacidad = null; |
95 | 66 |
private JSlider slOpacidad = null; |
96 | 67 |
private JTextField tOpacidad = null; |
97 |
private JPanel jPanel5 = null; |
|
98 |
private JPanel jPanel6 = null; |
|
99 | 68 |
|
69 |
private TransparencyByPixelPanel pTranspByPixel = null; |
|
70 |
|
|
100 | 71 |
/** |
101 | 72 |
* Constructor. Asigna la variable panel que contiene este |
102 | 73 |
* @param parent FilterRasterDialogPanel |
... | ... | |
153 | 124 |
} |
154 | 125 |
|
155 | 126 |
/** |
156 |
* Esta funci?n no est? en uso. |
|
157 |
* Oculta los controles de transparencia por bandas en caso de que haya menos de 3 bandas. |
|
158 |
* |
|
159 |
*/ |
|
160 |
public void updateTextBox() { |
|
161 |
if (parent.nbands == 1) { |
|
162 |
this.getTRojo().setVisible(true); |
|
163 |
this.getTVerde().setVisible(false); |
|
164 |
this.getTAzul().setVisible(false); |
|
165 |
lRedValue.setVisible(true); |
|
166 |
lGreenValue.setVisible(false); |
|
167 |
lBlueValue.setVisible(false); |
|
168 |
} |
|
169 |
|
|
170 |
if (parent.nbands == 2) { |
|
171 |
this.getTRojo().setVisible(true); |
|
172 |
this.getTVerde().setVisible(true); |
|
173 |
this.getTAzul().setVisible(false); |
|
174 |
lRedValue.setVisible(true); |
|
175 |
lGreenValue.setVisible(true); |
|
176 |
lBlueValue.setVisible(false); |
|
177 |
} |
|
178 |
|
|
179 |
if (parent.nbands >= 3) { |
|
180 |
this.getTRojo().setVisible(true); |
|
181 |
this.getTVerde().setVisible(true); |
|
182 |
this.getTAzul().setVisible(true); |
|
183 |
lRedValue.setVisible(true); |
|
184 |
lGreenValue.setVisible(true); |
|
185 |
lBlueValue.setVisible(true); |
|
186 |
} |
|
187 |
} |
|
188 |
|
|
189 |
/** |
|
190 | 127 |
* This method initializes jPanel |
191 | 128 |
* |
192 | 129 |
* @return javax.swing.JPanel |
193 | 130 |
*/ |
194 | 131 |
private JPanel getJPanel() { |
195 | 132 |
if (jPanel == null) { |
196 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
|
|
197 |
GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
|
|
198 |
GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
|
|
133 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
|
134 |
gridBagConstraints.gridx = 0;
|
|
135 |
gridBagConstraints.gridy = 1;
|
|
199 | 136 |
GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); |
200 |
GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); |
|
201 | 137 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
202 | 138 |
jPanel = new JPanel(); |
203 | 139 |
jPanel.setLayout(new GridBagLayout()); |
204 | 140 |
gridBagConstraints5.fill = java.awt.GridBagConstraints.NONE; |
141 |
gridBagConstraints5.gridy = 0; |
|
142 |
gridBagConstraints5.gridx = 0; |
|
205 | 143 |
gridBagConstraints5.ipady = 0; |
206 | 144 |
gridBagConstraints5.gridheight = 1; |
207 | 145 |
gridBagConstraints5.gridwidth = 0; |
208 | 146 |
gridBagConstraints5.anchor = java.awt.GridBagConstraints.WEST; |
209 |
gridBagConstraints5.insets = new java.awt.Insets(0, 0, 0, 0); |
|
210 |
gridBagConstraints6.gridwidth = 0; |
|
211 |
gridBagConstraints6.anchor = java.awt.GridBagConstraints.WEST; |
|
147 |
gridBagConstraints5.insets = new java.awt.Insets(0,0,5,0); |
|
212 | 148 |
gridBagConstraints7.gridwidth = 1; |
213 |
gridBagConstraints7.insets = new java.awt.Insets(20, 0, 0, 0);
|
|
214 |
gridBagConstraints8.gridwidth = 0;
|
|
215 |
gridBagConstraints8.anchor = java.awt.GridBagConstraints.WEST;
|
|
149 |
gridBagConstraints7.gridy = 2;
|
|
150 |
gridBagConstraints7.gridx = 0;
|
|
151 |
gridBagConstraints7.insets = new java.awt.Insets(5,0,0,0);
|
|
216 | 152 |
jPanel.setPreferredSize(new java.awt.Dimension(333, 113)); |
217 |
gridBagConstraints9.gridx = 0; |
|
218 |
gridBagConstraints9.gridy = 1; |
|
219 |
gridBagConstraints9.insets = new java.awt.Insets(0, 180, 0, 0); |
|
220 |
gridBagConstraints1.gridx = 0; |
|
221 |
gridBagConstraints1.gridy = 2; |
|
222 |
gridBagConstraints1.insets = new java.awt.Insets(0, 180, 0, 0); |
|
223 | 153 |
jPanel.add(getJPanel1(), gridBagConstraints5); |
224 |
jPanel.add(getJPanel2(), gridBagConstraints6); |
|
225 |
jPanel.add(getJPanel3(), gridBagConstraints8); |
|
154 |
jPanel.add(getPTranspByPixel(), gridBagConstraints); |
|
226 | 155 |
jPanel.add(getJPanel4(), gridBagConstraints7); |
227 |
jPanel.add(getJPanel5(), gridBagConstraints9); |
|
228 |
jPanel.add(getJPanel6(), gridBagConstraints1); |
|
229 | 156 |
} |
230 | 157 |
|
231 | 158 |
return jPanel; |
... | ... | |
238 | 165 |
*/ |
239 | 166 |
private JPanel getJPanel1() { |
240 | 167 |
if (jPanel1 == null) { |
241 |
lRedValue = new JLabel(); |
|
242 | 168 |
jPanel1 = new JPanel(); |
243 | 169 |
jPanel1.setLayout(new BorderLayout()); |
244 |
lRedValue.setText("Valor Rojo: ");
|
|
245 |
jPanel1.setPreferredSize(new java.awt.Dimension(170, 42));
|
|
170 |
jPanel1.setPreferredSize(new java.awt.Dimension(415,25));
|
|
171 |
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
|
|
246 | 172 |
jPanel1.add(getTransparencyCheck(), java.awt.BorderLayout.NORTH); |
247 |
jPanel1.add(lRedValue, java.awt.BorderLayout.WEST); |
|
248 |
jPanel1.add(getTRojo(), java.awt.BorderLayout.EAST); |
|
249 | 173 |
} |
250 | 174 |
|
251 | 175 |
return jPanel1; |
252 | 176 |
} |
253 | 177 |
|
254 | 178 |
/** |
255 |
* This method initializes jPanel2 |
|
256 |
* |
|
257 |
* @return javax.swing.JPanel |
|
258 |
*/ |
|
259 |
private JPanel getJPanel2() { |
|
260 |
if (jPanel2 == null) { |
|
261 |
lGreenValue = new JLabel(); |
|
262 |
jPanel2 = new JPanel(); |
|
263 |
jPanel2.setLayout(new BorderLayout()); |
|
264 |
lGreenValue.setText("Valor Verde: "); |
|
265 |
jPanel2.setPreferredSize(new java.awt.Dimension(170, 19)); |
|
266 |
jPanel2.add(lGreenValue, java.awt.BorderLayout.WEST); |
|
267 |
jPanel2.add(getTVerde(), java.awt.BorderLayout.EAST); |
|
268 |
} |
|
269 |
|
|
270 |
return jPanel2; |
|
271 |
} |
|
272 |
|
|
273 |
/** |
|
274 |
* This method initializes jPanel3 |
|
275 |
* |
|
276 |
* @return javax.swing.JPanel |
|
277 |
*/ |
|
278 |
private JPanel getJPanel3() { |
|
279 |
if (jPanel3 == null) { |
|
280 |
lBlueValue = new JLabel(); |
|
281 |
jPanel3 = new JPanel(); |
|
282 |
jPanel3.setLayout(new BorderLayout()); |
|
283 |
lBlueValue.setText("Valor Azul: "); |
|
284 |
jPanel3.setPreferredSize(new java.awt.Dimension(170, 19)); |
|
285 |
jPanel3.add(lBlueValue, java.awt.BorderLayout.WEST); |
|
286 |
jPanel3.add(getTAzul(), java.awt.BorderLayout.EAST); |
|
287 |
} |
|
288 |
|
|
289 |
return jPanel3; |
|
290 |
} |
|
291 |
|
|
292 |
/** |
|
293 | 179 |
* This method initializes jCheckBox |
294 | 180 |
* |
295 | 181 |
* @return javax.swing.JCheckBox |
... | ... | |
297 | 183 |
public JCheckBox getTransparencyCheck() { |
298 | 184 |
if (cbTransparencia == null) { |
299 | 185 |
cbTransparencia = new JCheckBox(); |
300 |
cbTransparencia.setText("Transparencia"); |
|
186 |
cbTransparencia.setText("Transparencia por pixel");
|
|
301 | 187 |
} |
302 | 188 |
|
303 | 189 |
return cbTransparencia; |
304 | 190 |
} |
305 | 191 |
|
306 | 192 |
/** |
307 |
* This method initializes jTextField |
|
308 |
* |
|
309 |
* @return javax.swing.JTextField |
|
310 |
*/ |
|
311 |
public JTextFieldExt getTRojo() { |
|
312 |
if (tRojo == null) { |
|
313 |
tRojo = new JTextFieldExt(this.getBackground()); |
|
314 |
tRojo.setPreferredSize(new java.awt.Dimension(80, 19)); |
|
315 |
} |
|
316 |
|
|
317 |
return tRojo; |
|
318 |
} |
|
319 |
|
|
320 |
/** |
|
321 |
* This method initializes jTextField1 |
|
322 |
* |
|
323 |
* @return javax.swing.JTextField |
|
324 |
*/ |
|
325 |
public JTextFieldExt getTVerde() { |
|
326 |
if (tVerde == null) { |
|
327 |
tVerde = new JTextFieldExt(this.getBackground()); |
|
328 |
tVerde.setPreferredSize(new java.awt.Dimension(80, 19)); |
|
329 |
} |
|
330 |
|
|
331 |
return tVerde; |
|
332 |
} |
|
333 |
|
|
334 |
/** |
|
335 |
* This method initializes jTextField2 |
|
336 |
* |
|
337 |
* @return javax.swing.JTextField |
|
338 |
*/ |
|
339 |
public JTextFieldExt getTAzul() { |
|
340 |
if (tAzul == null) { |
|
341 |
tAzul = new JTextFieldExt(this.getBackground()); |
|
342 |
tAzul.setPreferredSize(new java.awt.Dimension(80, 19)); |
|
343 |
} |
|
344 |
|
|
345 |
return tAzul; |
|
346 |
} |
|
347 |
|
|
348 |
/** |
|
349 | 193 |
* This method initializes jPanel4 |
350 | 194 |
* |
351 | 195 |
* @return javax.swing.JPanel |
... | ... | |
353 | 197 |
private JPanel getJPanel4() { |
354 | 198 |
if (pGeneralTrans == null) { |
355 | 199 |
pGeneralTrans = new JPanel(); |
356 |
pGeneralTrans.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray, |
|
357 |
1)); |
|
200 |
pGeneralTrans.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray, 1)); |
|
358 | 201 |
pGeneralTrans.setPreferredSize(new java.awt.Dimension(415, 35)); |
359 | 202 |
pGeneralTrans.add(getOpacityCheck(), null); |
360 | 203 |
pGeneralTrans.add(getOpacitySlider(), null); |
... | ... | |
407 | 250 |
} |
408 | 251 |
|
409 | 252 |
/** |
410 |
* This method initializes jPanel5 |
|
411 |
* |
|
412 |
* @return javax.swing.JPanel |
|
413 |
*/ |
|
414 |
private JPanel getJPanel5() { |
|
415 |
if (jPanel5 == null) { |
|
416 |
lRange = new JLabel(); |
|
417 |
jPanel5 = new JPanel(); |
|
418 |
lRange.setText("Usa un rango: 1,3,5:8"); |
|
419 |
jPanel5.setPreferredSize(new java.awt.Dimension(161, 21)); |
|
420 |
jPanel5.add(lRange, null); |
|
421 |
} |
|
422 |
|
|
423 |
return jPanel5; |
|
424 |
} |
|
425 |
|
|
426 |
/** |
|
427 | 253 |
* Activa/Desactiva los controles de opacidad |
428 | 254 |
* @param active |
429 | 255 |
*/ |
... | ... | |
439 | 265 |
*/ |
440 | 266 |
public void setActiveTransparencyControl(boolean active) { |
441 | 267 |
this.getTransparencyCheck().setSelected(active); |
442 |
this.getTRojo().setEnabled(active); |
|
268 |
if ((active && (parent.nbands == 1))) { |
|
269 |
|
|
270 |
} |
|
443 | 271 |
|
444 |
if ((active && (parent.nbands >= 2)) || !active) { |
|
445 |
this.getTVerde().setEnabled(active); |
|
446 |
} else { |
|
447 |
this.getTVerde().setEnabled(false); |
|
272 |
if ((active && (parent.nbands == 2))) { |
|
273 |
|
|
448 | 274 |
} |
449 | 275 |
|
450 |
if ((active && (parent.nbands >= 3)) || !active) { |
|
451 |
this.getTAzul().setEnabled(active); |
|
452 |
} else { |
|
453 |
this.getTAzul().setEnabled(false); |
|
276 |
if ((active && (parent.nbands == 3))) { |
|
277 |
|
|
454 | 278 |
} |
455 | 279 |
} |
456 | 280 |
|
... | ... | |
471 | 295 |
} |
472 | 296 |
} |
473 | 297 |
|
474 |
/** |
|
475 |
* This method initializes jPanel6 |
|
476 |
* |
|
477 |
* @return javax.swing.JPanel |
|
478 |
*/ |
|
479 |
private JPanel getJPanel6() { |
|
480 |
if (jPanel6 == null) { |
|
481 |
lPixelValue = new JLabel(); |
|
482 |
jPanel6 = new JPanel(); |
|
483 |
jPanel6.setPreferredSize(new java.awt.Dimension(161, 20)); |
|
484 |
lPixelValue.setText("Valor de pixel: 0 a 255"); |
|
485 |
jPanel6.add(lPixelValue, null); |
|
486 |
} |
|
487 |
|
|
488 |
return jPanel6; |
|
489 |
} |
|
490 |
|
|
491 | 298 |
public class JTextFieldExt extends JTextField { |
492 | 299 |
final private static long serialVersionUID = -3370601314380922368L; |
493 | 300 |
private Color color = null; |
... | ... | |
514 | 321 |
} |
515 | 322 |
} |
516 | 323 |
} |
324 |
|
|
325 |
/** |
|
326 |
* This method initializes jPanel2 |
|
327 |
* |
|
328 |
* @return javax.swing.JPanel |
|
329 |
*/ |
|
330 |
public TransparencyByPixelPanel getPTranspByPixel() { |
|
331 |
if (pTranspByPixel == null) { |
|
332 |
pTranspByPixel = new TransparencyByPixelPanel(); |
|
333 |
pTranspByPixel.setPreferredSize(new java.awt.Dimension(415,128)); |
|
334 |
pTranspByPixel.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1)); |
|
335 |
pTranspByPixel.setControlEnabled(false); |
|
336 |
} |
|
337 |
return pTranspByPixel; |
|
338 |
} |
|
517 | 339 |
} // @jve:decl-index=0:visual-constraint="36,15" |
Also available in: Unified diff