Statistics
| Revision:

svn-gvsig-desktop / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / ui / raster / DataInputSaveRaster.java @ 2705

History | View | Annotate | Download (15.2 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.ui.raster;
25

    
26
import java.awt.BorderLayout;
27
import java.awt.FlowLayout;
28

    
29
import javax.swing.DefaultComboBoxModel;
30
import javax.swing.JButton;
31
import javax.swing.JComboBox;
32
import javax.swing.JLabel;
33
import javax.swing.JPanel;
34
import javax.swing.JTextField;
35
import javax.swing.plaf.basic.BasicComboBoxEditor;
36

    
37

    
38
/**
39
 * Panel que contiene los controles del dialogo de salvar a raster.
40
 * @author Nacho Brodin (brodin_ign@gva.es)
41
 */
42
public class DataInputSaveRaster extends JPanel {
43
    final private static long serialVersionUID = -3370601314380922368L;
44
    private JPanel jPanel = null;
45
    private JPanel coordenadas = null;
46
    private JPanel pSupIzq = null;
47
    private JPanel pInfDer = null;
48

    
49
    /**
50
     * Control accesible para su traducci?n
51
     */
52
    public JLabel lSupIzq = null;
53
    private JTextField tSupIzqX = null;
54
    private JTextField tSupIzqY = null;
55

    
56
    /**
57
     * Control accesible para su traducci?n
58
     */
59
    public JLabel lInfDer = null;
60

    
61
    /**
62
     * Control accesible para su traducci?n
63
     */
64
    public JLabel lY = null;
65
    private JTextField tInfDerX = null;
66
    private JTextField tInfDerY = null;
67
    private JPanel pDatosImagen = null;
68
    private JPanel pDatosFichero = null;
69
    private JPanel pEscalaRes = null;
70
    private JPanel pNombre = null;
71

    
72
    /**
73
     * Control accesible para su traducci?n
74
     */
75
    public JLabel lEscala = null;
76
    private JTextField tEscala = null;
77

    
78
    /**
79
     * Control accesible para su traducci?n
80
     */
81
    public JLabel lFile = null;
82

    
83
    /**
84
     * Control accesible para su traducci?n
85
     */
86
    public JLabel lResolucion = null;
87

    
88
    /**
89
     * Control accesible para su traducci?n
90
     */
91
    public JLabel lPpp = null;
92
    private DefaultComboBoxModel defaultComboBoxModel = null;
93
    private BasicComboBoxEditor basicComboBoxEditor = null;
94
    private String string = null;
95
    private JComboBox jComboBox = null;
96

    
97
    /**
98
     * Control accesible para su traducci?n
99
     */
100
    public JButton bSeleccion = null;
101
    private JPanel pAnchoAlto = null;
102

    
103
    /**
104
     * Control accesible para su traducci?n
105
     */
106
    public JLabel lAncho = null;
107

    
108
    /**
109
     * Control accesible para su traducci?n
110
     */
111
    public JLabel lAlto = null;
112
    private JTextField tAncho = null;
113
    private JTextField tAlto = null;
114

    
115
    /**
116
     * Control accesible para su traducci?n
117
     */
118
    public JButton bPropiedades = null;
119

    
120
    /**
121
     * Constructor. Inicializa el panel.
122
     *
123
     */
124
    public DataInputSaveRaster() {
125
        super();
126
        initialize();
127
    }
128

    
129
    /**
130
     * Inicializa el panel.
131
     *
132
     */
133
    private void initialize() {
134
        this.setLayout(new BorderLayout());
135
        this.setSize(350, 208); //AnchoxAlto panel interior
136
        this.add(getJPanel(), java.awt.BorderLayout.CENTER);
137
    }
138

    
139
    /**
140
     * This method initializes jPanel
141
     *
142
     * @return javax.swing.JPanel
143
     */
144
    private JPanel getJPanel() {
145
        if (jPanel == null) {
146
            jPanel = new JPanel();
147
            jPanel.setLayout(new BorderLayout());
148
            jPanel.add(getCoordenadas(), java.awt.BorderLayout.NORTH);
149
            jPanel.add(getDatosImagen(), java.awt.BorderLayout.CENTER);
150
            jPanel.add(getDatosFichero(), java.awt.BorderLayout.SOUTH);
151
        }
152

    
153
        return jPanel;
154
    }
155

    
156
    /**
157
     * This method initializes jPanel1
158
     *
159
     * @return javax.swing.JPanel
160
     */
161
    private JPanel getCoordenadas() {
162
        if (coordenadas == null) {
163
            coordenadas = new JPanel();
164
            coordenadas.setLayout(new BorderLayout());
165
            coordenadas.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,
166
                                                                              0,
167
                                                                              0,
168
                                                                              0));
169
            coordenadas.add(getPsup_izq(), java.awt.BorderLayout.NORTH);
170
            coordenadas.add(getPinf_der(), java.awt.BorderLayout.SOUTH);
171
        }
172

    
173
        return coordenadas;
174
    }
175

    
176
    /**
177
     * This method initializes jPanel2
178
     *
179
     * @return javax.swing.JPanel
180
     */
181
    private JPanel getPsup_izq() {
182
        if (pSupIzq == null) {
183
            lSupIzq = new JLabel();
184
            lY = new JLabel();
185
            pSupIzq = new JPanel();
186

    
187
            FlowLayout flowLayout1 = new FlowLayout();
188
            pSupIzq.setLayout(flowLayout1);
189
            lSupIzq.setText("Sup. izq. X:");
190
            lY.setText(" Y:");
191
            flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
192
            flowLayout1.setHgap(5);
193
            pSupIzq.setAlignmentY(0.5F);
194
            pSupIzq.add(lSupIzq, null);
195
            pSupIzq.add(getTsup_izqX(), null);
196
            pSupIzq.add(lY, null);
197
            pSupIzq.add(getTsup_izqY(), null);
198
        }
199

    
200
        return pSupIzq;
201
    }
202

    
203
    /**
204
     * This method initializes jPanel3
205
     *
206
     * @return javax.swing.JPanel
207
     */
208
    private JPanel getPinf_der() {
209
        if (pInfDer == null) {
210
                lInfDer = new JLabel();
211
            pInfDer = new JPanel();
212
            lY= new JLabel();
213

    
214
            FlowLayout flowLayout2 = new FlowLayout();
215
            pInfDer.setLayout(flowLayout2);
216
            lY.setText(" Y:");
217
            lInfDer.setText("Inf. der.  X:");
218
            flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
219
            pInfDer.add(lInfDer, null);
220
            pInfDer.add(getTinf_derX(), null);
221
            pInfDer.add(lY, null);
222
            pInfDer.add(getTinf_derY(), null);
223
        }
224

    
225
        return pInfDer;
226
    }
227

    
228
    /**
229
     * This method initializes jTextField
230
     *
231
     * @return javax.swing.JTextField
232
     */
233
    public JTextField getTsup_izqX() {
234
        if (tSupIzqX == null) {
235
                tSupIzqX = new JTextField();
236
                tSupIzqX.setPreferredSize(new java.awt.Dimension(110, 19));
237
                tSupIzqX.setText("0");
238
                tSupIzqX.setMinimumSize(new java.awt.Dimension(110, 19));
239
        }
240

    
241
        return tSupIzqX;
242
    }
243

    
244
    /**
245
     * This method initializes jTextField
246
     *
247
     * @return javax.swing.JTextField
248
     */
249
    public JTextField getTsup_izqY() {
250
        if (tSupIzqY == null) {
251
                tSupIzqY = new JTextField();
252
                tSupIzqY.setMinimumSize(new java.awt.Dimension(110, 19));
253
                tSupIzqY.setPreferredSize(new java.awt.Dimension(110, 19));
254
                tSupIzqY.setText("0");
255
        }
256

    
257
        return tSupIzqY;
258
    }
259

    
260
    /**
261
     * This method initializes jTextField
262
     *
263
     * @return javax.swing.JTextField
264
     */
265
    public JTextField getTinf_derX() {
266
        if (tInfDerX == null) {
267
                tInfDerX = new JTextField();
268
                tInfDerX.setMinimumSize(new java.awt.Dimension(110, 19));
269
                tInfDerX.setPreferredSize(new java.awt.Dimension(110, 19));
270
                tInfDerX.setText("0");
271
        }
272

    
273
        return tInfDerX;
274
    }
275

    
276
    /**
277
     * This method initializes jTextField1
278
     *
279
     * @return javax.swing.JTextField
280
     */
281
    public JTextField getTinf_derY() {
282
        if (tInfDerY == null) {
283
                tInfDerY = new JTextField();
284
                tInfDerY.setMinimumSize(new java.awt.Dimension(110, 19));
285
                tInfDerY.setPreferredSize(new java.awt.Dimension(110, 19));
286
                tInfDerY.setText("0");
287
        }
288

    
289
        return tInfDerY;
290
    }
291

    
292
    /**
293
     * This method initializes jPanel1
294
     *
295
     * @return javax.swing.JPanel
296
     */
297
    private JPanel getDatosImagen() {
298
        if (pDatosImagen == null) {
299
            BorderLayout borderLayout1 = new BorderLayout();
300
            pDatosImagen = new JPanel();
301
            pDatosImagen.setLayout(borderLayout1);
302
            pDatosImagen.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,
303
                                                                             1));
304
            pDatosImagen.setAlignmentY(0.5F);
305
            borderLayout1.setHgap(0);
306
            borderLayout1.setVgap(0);
307
            pDatosImagen.add(getPescalaRes(), java.awt.BorderLayout.NORTH);
308
            pDatosImagen.add(getPanchoAlto(), java.awt.BorderLayout.SOUTH);
309
        }
310

    
311
        return pDatosImagen;
312
    }
313

    
314
    /**
315
     * This method initializes jPanel2
316
     *
317
     * @return javax.swing.JPanel
318
     */
319
    private JPanel getDatosFichero() {
320
        if (pDatosFichero == null) {
321
                pDatosFichero = new JPanel();
322
                pDatosFichero.setLayout(new BorderLayout());
323
                pDatosFichero.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
324
                pDatosFichero.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,
325
                                                                               0,
326
                                                                               0,
327
                                                                               0));
328
                pDatosFichero.add(getPnombre(), java.awt.BorderLayout.CENTER);
329
        }
330

    
331
        return pDatosFichero;
332
    }
333

    
334
    /**
335
     * This method initializes jPanel1
336
     *
337
     * @return javax.swing.JPanel
338
     */
339
    private JPanel getPescalaRes() {
340
        if (pEscalaRes == null) {
341
            lEscala = new JLabel();
342
            lResolucion = new JLabel();
343
            lPpp = new JLabel();
344

    
345
            FlowLayout flowLayout3 = new FlowLayout();
346
            pEscalaRes = new JPanel();
347
            pEscalaRes.setLayout(flowLayout3);
348
            lEscala.setText("Escala  1:");
349
            lResolucion.setText("Resoluci?n");
350
            lPpp.setText("ppp");
351
            lResolucion.setName("");
352
            flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
353
            flowLayout3.setVgap(20);
354
            pEscalaRes.add(lEscala, null);
355
            pEscalaRes.add(getTescala(), null);
356
            pEscalaRes.add(lResolucion, null);
357
            pEscalaRes.add(getJComboBox(), null);
358
            pEscalaRes.add(lPpp, null);
359
        }
360

    
361
        return pEscalaRes;
362
    }
363

    
364
    /**
365
     * This method initializes jPanel3
366
     *
367
     * @return javax.swing.JPanel
368
     */
369
    private JPanel getPnombre() {
370
        if (pNombre == null) {
371
            lFile = new JLabel();
372
            pNombre = new JPanel();
373

    
374
            FlowLayout flowLayout4 = new FlowLayout();
375
            pNombre.setLayout(flowLayout4);
376
            lFile.setText("Fichero");
377
            flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
378
            pNombre.add(lFile, null);
379
            pNombre.add(getBseleccion(), null);
380
            pNombre.add(this.getBPropiedades(), null);
381
            this.getBPropiedades().setText("Propiedades GeoTiff");
382
        }
383

    
384
        return pNombre;
385
    }
386

    
387
    /**
388
     * This method initializes jTextField
389
     *
390
     * @return javax.swing.JTextField
391
     */
392
    public JTextField getTescala() {
393
        if (tEscala == null) {
394
            tEscala = new JTextField();
395
            tEscala.setMinimumSize(new java.awt.Dimension(70, 19));
396
            tEscala.setPreferredSize(new java.awt.Dimension(80, 19));
397
            tEscala.setText("0");
398
        }
399

    
400
        return tEscala;
401
    }
402

    
403
    private Object makeObj(final String item) {
404
        return new Object() {
405
                public String toString() {
406
                    return item;
407
                }
408
            };
409
    }
410

    
411
    /**
412
     * This method initializes defaultComboBoxModel
413
     *
414
     * @return javax.swing.DefaultComboBoxModel
415
     */
416
    private DefaultComboBoxModel getDefaultComboBoxModel() {
417
        if (defaultComboBoxModel == null) {
418
            defaultComboBoxModel = new DefaultComboBoxModel();
419
        }
420

    
421
        return defaultComboBoxModel;
422
    }
423

    
424
    /**
425
     * This method initializes basicComboBoxEditor
426
     *
427
     * @return javax.swing.plaf.basic.BasicComboBoxEditor
428
     */
429
    private BasicComboBoxEditor getBasicComboBoxEditor() {
430
        if (basicComboBoxEditor == null) {
431
            basicComboBoxEditor = new BasicComboBoxEditor();
432
            basicComboBoxEditor.setItem(getString());
433
        }
434

    
435
        return basicComboBoxEditor;
436
    }
437

    
438
    /**
439
     * This method initializes string
440
     *
441
     * @return java.lang.String
442
     */
443
    private String getString() {
444
        if (string == null) {
445
            string = new String();
446
        }
447

    
448
        return string;
449
    }
450

    
451
    /**
452
     * This method initializes jComboBox
453
     *
454
     * @return javax.swing.JComboBox
455
     */
456
    public JComboBox getJComboBox() {
457
        if (jComboBox == null) {
458
            String[] lista = { "75", "150", "300" };
459
            jComboBox = new JComboBox(lista);
460
            jComboBox.setPreferredSize(new java.awt.Dimension(70, 24));
461
        }
462

    
463
        return jComboBox;
464
    }
465

    
466
    /**
467
     * This method initializes jComboBox
468
     *
469
     * @return javax.swing.JComboBox
470
     */
471
    public JButton getBPropiedades() {
472
        if (bPropiedades == null) {
473
            bPropiedades = new JButton();
474
        }
475

    
476
        return bPropiedades;
477
    }
478

    
479
    /**
480
     * This method initializes jButton
481
     *
482
     * @return javax.swing.JButton
483
     */
484
    public JButton getBseleccion() {
485
        if (bSeleccion == null) {
486
            bSeleccion = new JButton();
487
            bSeleccion.setText("Seleccionar");
488
        }
489

    
490
        return bSeleccion;
491
    }
492

    
493
    /**
494
     * This method initializes jPanel1
495
     *
496
     * @return javax.swing.JPanel
497
     */
498
    private JPanel getPanchoAlto() {
499
        if (pAnchoAlto == null) {
500
                lAlto = new JLabel();
501
            lAncho = new JLabel();
502

    
503
            FlowLayout flowLayout5 = new FlowLayout();
504
            pAnchoAlto = new JPanel();
505
            pAnchoAlto.setLayout(flowLayout5);
506
            lAncho.setText("Ancho.");
507
            flowLayout5.setAlignment(java.awt.FlowLayout.LEFT);
508
            flowLayout5.setVgap(20);
509
            lAlto.setText("Alto.");
510
            pAnchoAlto.add(lAncho, null);
511
            pAnchoAlto.add(getTancho(), null);
512
            pAnchoAlto.add(lAlto, null);
513
            pAnchoAlto.add(getTalto(), null);
514
        }
515

    
516
        return pAnchoAlto;
517
    }
518

    
519
    /**
520
     * This method initializes jTextField
521
     *
522
     * @return javax.swing.JTextField
523
     */
524
    public JTextField getTancho() {
525
        if (tAncho == null) {
526
            tAncho = new JTextField();
527
            tAncho.setPreferredSize(new java.awt.Dimension(80, 19));
528
            tAncho.setEditable(false);
529
            tAncho.setText("0");
530
        }
531

    
532
        return tAncho;
533
    }
534

    
535
    /**
536
     * This method initializes jTextField1
537
     *
538
     * @return javax.swing.JTextField
539
     */
540
    public JTextField getTalto() {
541
        if (tAlto == null) {
542
            tAlto = new JTextField();
543
            tAlto.setPreferredSize(new java.awt.Dimension(80, 19));
544
            tAlto.setText("0");
545
            tAlto.setEditable(false);
546
        }
547

    
548
        return tAlto;
549
    }
550
}