Statistics
| Revision:

svn-gvsig-desktop / tags / Root_v061 / libraries / libCq CMS for java.old / src / org / cresques / ui / raster / DataInputSaveRasterProps.java @ 4812

History | View | Annotate | Download (14.6 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 elementos para el dialogo de salvar a raster
40
 * @author Nacho Brodin (brodin_ign@gva.es)
41
 */
42
public class DataInputSaveRasterProps extends JPanel {
43
    final private static long serialVersionUID = -3370601314380922368L;
44
    private JPanel jPanel = null;
45
    private JPanel coordenadas = null;
46
    private JPanel psup_izq = null;
47
    private JPanel pinf_der = null;
48
    private JLabel lsup_izq = null;
49
    private JTextField tsup_izqX = null;
50
    private JTextField tsup_izqY = null;
51
    private JLabel linf_der = null;
52
    private JLabel y = null;
53
    private JTextField tinf_derX = null;
54
    private JTextField tinf_derY = null;
55
    private JPanel datosImagen = null;
56
    private JPanel datosFichero = null;
57
    private JPanel pescalaRes = null;
58
    private JPanel pnombre = null;
59
    private JLabel lescala = null;
60
    private JTextField tescala = null;
61
    private JLabel lfile = null;
62
    private JLabel lresolucion = null;
63
    private JLabel lppp = null;
64
    private DefaultComboBoxModel defaultComboBoxModel = null;
65
    private BasicComboBoxEditor basicComboBoxEditor = null;
66
    private String string = null;
67
    private JComboBox jComboBox = null;
68
    private JButton bseleccion = null;
69
    private JPanel panchoAlto = null;
70
    private JLabel lancho = null;
71
    private JLabel jLabel2 = null;
72
    private JTextField tancho = null;
73
    private JTextField talto = null;
74
    private JButton bcompresion = null;
75

    
76
    /**
77
     * Constructor. Inicializa el panel.
78
     *
79
     */
80
    public DataInputSaveRasterProps() {
81
        super();
82
        initialize();
83
    }
84

    
85
    private void initialize() {
86
        this.setLayout(new BorderLayout());
87
        this.setSize(350, 208); //AnchoxAlto panel interior
88
        this.add(getJPanel(), java.awt.BorderLayout.CENTER);
89
    }
90

    
91
    /**
92
     * This method initializes jPanel
93
     *
94
     * @return javax.swing.JPanel
95
     */
96
    private JPanel getJPanel() {
97
        if (jPanel == null) {
98
            jPanel = new JPanel();
99
            jPanel.setLayout(new BorderLayout());
100
            jPanel.add(getCoordenadas(), java.awt.BorderLayout.NORTH);
101
            jPanel.add(getDatosImagen(), java.awt.BorderLayout.CENTER);
102
            jPanel.add(getDatosFichero(), java.awt.BorderLayout.SOUTH);
103
        }
104

    
105
        return jPanel;
106
    }
107

    
108
    /**
109
     * This method initializes jPanel1
110
     *
111
     * @return javax.swing.JPanel
112
     */
113
    private JPanel getCoordenadas() {
114
        if (coordenadas == null) {
115
            coordenadas = new JPanel();
116
            coordenadas.setLayout(new BorderLayout());
117
            coordenadas.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,
118
                                                                              0,
119
                                                                              0,
120
                                                                              0));
121
            coordenadas.add(getPsup_izq(), java.awt.BorderLayout.NORTH);
122
            coordenadas.add(getPinf_der(), java.awt.BorderLayout.SOUTH);
123
        }
124

    
125
        return coordenadas;
126
    }
127

    
128
    /**
129
     * This method initializes jPanel2
130
     *
131
     * @return javax.swing.JPanel
132
     */
133
    private JPanel getPsup_izq() {
134
        if (psup_izq == null) {
135
            lsup_izq = new JLabel();
136
            y = new JLabel();
137
            psup_izq = new JPanel();
138

    
139
            FlowLayout flowLayout1 = new FlowLayout();
140
            psup_izq.setLayout(flowLayout1);
141
            lsup_izq.setText("Sup. izq. X:");
142
            y.setText(" Y:");
143
            flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
144
            flowLayout1.setHgap(5);
145
            psup_izq.setAlignmentY(0.5F);
146
            psup_izq.add(lsup_izq, null);
147
            psup_izq.add(getTsup_izqX(), null);
148
            psup_izq.add(y, null);
149
            psup_izq.add(getTsup_izqY(), null);
150
        }
151

    
152
        return psup_izq;
153
    }
154

    
155
    /**
156
     * This method initializes jPanel3
157
     *
158
     * @return javax.swing.JPanel
159
     */
160
    private JPanel getPinf_der() {
161
        if (pinf_der == null) {
162
            linf_der = new JLabel();
163
            pinf_der = new JPanel();
164
            y = new JLabel();
165

    
166
            FlowLayout flowLayout2 = new FlowLayout();
167
            pinf_der.setLayout(flowLayout2);
168
            y.setText(" Y:");
169
            linf_der.setText("Inf. der.  X:");
170
            flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
171
            pinf_der.add(linf_der, null);
172
            pinf_der.add(getTinf_derX(), null);
173
            pinf_der.add(y, null);
174
            pinf_der.add(getTinf_derY(), null);
175
        }
176

    
177
        return pinf_der;
178
    }
179

    
180
    /**
181
     * This method initializes jTextField
182
     *
183
     * @return javax.swing.JTextField
184
     */
185
    public JTextField getTsup_izqX() {
186
        if (tsup_izqX == null) {
187
            tsup_izqX = new JTextField();
188
            tsup_izqX.setPreferredSize(new java.awt.Dimension(110, 19));
189
            tsup_izqX.setText("0");
190
            tsup_izqX.setMinimumSize(new java.awt.Dimension(110, 19));
191
        }
192

    
193
        return tsup_izqX;
194
    }
195

    
196
    /**
197
     * This method initializes jTextField
198
     *
199
     * @return javax.swing.JTextField
200
     */
201
    public JTextField getTsup_izqY() {
202
        if (tsup_izqY == null) {
203
            tsup_izqY = new JTextField();
204
            tsup_izqY.setMinimumSize(new java.awt.Dimension(110, 19));
205
            tsup_izqY.setPreferredSize(new java.awt.Dimension(110, 19));
206
            tsup_izqY.setText("0");
207
        }
208

    
209
        return tsup_izqY;
210
    }
211

    
212
    /**
213
     * This method initializes jTextField
214
     *
215
     * @return javax.swing.JTextField
216
     */
217
    public JTextField getTinf_derX() {
218
        if (tinf_derX == null) {
219
            tinf_derX = new JTextField();
220
            tinf_derX.setMinimumSize(new java.awt.Dimension(110, 19));
221
            tinf_derX.setPreferredSize(new java.awt.Dimension(110, 19));
222
            tinf_derX.setText("0");
223
        }
224

    
225
        return tinf_derX;
226
    }
227

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

    
241
        return tinf_derY;
242
    }
243

    
244
    /**
245
     * This method initializes jPanel1
246
     *
247
     * @return javax.swing.JPanel
248
     */
249
    private JPanel getDatosImagen() {
250
        if (datosImagen == null) {
251
            BorderLayout borderLayout1 = new BorderLayout();
252
            datosImagen = new JPanel();
253
            datosImagen.setLayout(borderLayout1);
254
            datosImagen.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,
255
                                                                             1));
256
            datosImagen.setAlignmentY(0.5F);
257
            borderLayout1.setHgap(0);
258
            borderLayout1.setVgap(0);
259
            datosImagen.add(getPescalaRes(), java.awt.BorderLayout.NORTH);
260
            datosImagen.add(getPanchoAlto(), java.awt.BorderLayout.SOUTH);
261
        }
262

    
263
        return datosImagen;
264
    }
265

    
266
    /**
267
     * This method initializes jPanel2
268
     *
269
     * @return javax.swing.JPanel
270
     */
271
    private JPanel getDatosFichero() {
272
        if (datosFichero == null) {
273
            datosFichero = new JPanel();
274
            datosFichero.setLayout(new BorderLayout());
275
            datosFichero.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
276
            datosFichero.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,
277
                                                                               0,
278
                                                                               0,
279
                                                                               0));
280
            datosFichero.add(getPnombre(), java.awt.BorderLayout.CENTER);
281
        }
282

    
283
        return datosFichero;
284
    }
285

    
286
    /**
287
     * This method initializes jPanel1
288
     *
289
     * @return javax.swing.JPanel
290
     */
291
    private JPanel getPescalaRes() {
292
        if (pescalaRes == null) {
293
            lescala = new JLabel();
294
            lresolucion = new JLabel();
295
            lppp = new JLabel();
296

    
297
            FlowLayout flowLayout3 = new FlowLayout();
298
            pescalaRes = new JPanel();
299
            pescalaRes.setLayout(flowLayout3);
300
            lescala.setText("Escala  1:");
301
            lresolucion.setText("Resoluci?n");
302
            lppp.setText("ppp");
303
            lresolucion.setName("");
304
            flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
305
            flowLayout3.setVgap(20);
306
            pescalaRes.add(lescala, null);
307
            pescalaRes.add(getTescala(), null);
308
            pescalaRes.add(lresolucion, null);
309
            pescalaRes.add(getJComboBox(), null);
310
            pescalaRes.add(lppp, null);
311
        }
312

    
313
        return pescalaRes;
314
    }
315

    
316
    /**
317
     * This method initializes jPanel3
318
     *
319
     * @return javax.swing.JPanel
320
     */
321
    private JPanel getPnombre() {
322
        if (pnombre == null) {
323
            lfile = new JLabel();
324
            pnombre = new JPanel();
325

    
326
            FlowLayout flowLayout4 = new FlowLayout();
327
            pnombre.setLayout(flowLayout4);
328
            lfile.setText("Fichero");
329
            flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
330
            pnombre.add(lfile, null);
331
            pnombre.add(getBseleccion(), null);
332
            pnombre.add(this.getBCompresion(), null);
333
            this.getBCompresion().setText("Propiedades GeoTiff");
334
        }
335

    
336
        return pnombre;
337
    }
338

    
339
    /**
340
     * This method initializes jTextField
341
     *
342
     * @return javax.swing.JTextField
343
     */
344
    public JTextField getTescala() {
345
        if (tescala == null) {
346
            tescala = new JTextField();
347
            tescala.setMinimumSize(new java.awt.Dimension(70, 19));
348
            tescala.setPreferredSize(new java.awt.Dimension(80, 19));
349
            tescala.setText("0");
350
        }
351

    
352
        return tescala;
353
    }
354

    
355
    private Object makeObj(final String item) {
356
        return new Object() {
357
                public String toString() {
358
                    return item;
359
                }
360
            };
361
    }
362

    
363
    /**
364
     * This method initializes defaultComboBoxModel
365
     *
366
     * @return javax.swing.DefaultComboBoxModel
367
     */
368
    private DefaultComboBoxModel getDefaultComboBoxModel() {
369
        if (defaultComboBoxModel == null) {
370
            defaultComboBoxModel = new DefaultComboBoxModel();
371
        }
372

    
373
        return defaultComboBoxModel;
374
    }
375

    
376
    /**
377
     * This method initializes basicComboBoxEditor
378
     *
379
     * @return javax.swing.plaf.basic.BasicComboBoxEditor
380
     */
381
    private BasicComboBoxEditor getBasicComboBoxEditor() {
382
        if (basicComboBoxEditor == null) {
383
            basicComboBoxEditor = new BasicComboBoxEditor();
384
            basicComboBoxEditor.setItem(getString());
385
        }
386

    
387
        return basicComboBoxEditor;
388
    }
389

    
390
    /**
391
     * This method initializes string
392
     *
393
     * @return java.lang.String
394
     */
395
    private String getString() {
396
        if (string == null) {
397
            string = new String();
398
        }
399

    
400
        return string;
401
    }
402

    
403
    /**
404
     * This method initializes jComboBox
405
     *
406
     * @return javax.swing.JComboBox
407
     */
408
    public JComboBox getJComboBox() {
409
        if (jComboBox == null) {
410
            String[] lista = { "75", "150", "300" };
411
            jComboBox = new JComboBox(lista);
412
            jComboBox.setPreferredSize(new java.awt.Dimension(70, 24));
413
        }
414

    
415
        return jComboBox;
416
    }
417

    
418
    /**
419
     * This method initializes jComboBox
420
     *
421
     * @return javax.swing.JComboBox
422
     */
423
    public JButton getBCompresion() {
424
        if (bcompresion == null) {
425
            bcompresion = new JButton();
426
        }
427

    
428
        return bcompresion;
429
    }
430

    
431
    /**
432
     * This method initializes jButton
433
     *
434
     * @return javax.swing.JButton
435
     */
436
    public JButton getBseleccion() {
437
        if (bseleccion == null) {
438
            bseleccion = new JButton();
439
            bseleccion.setText("Seleccionar");
440
        }
441

    
442
        return bseleccion;
443
    }
444

    
445
    /**
446
     * This method initializes jPanel1
447
     *
448
     * @return javax.swing.JPanel
449
     */
450
    private JPanel getPanchoAlto() {
451
        if (panchoAlto == null) {
452
            jLabel2 = new JLabel();
453
            lancho = new JLabel();
454

    
455
            FlowLayout flowLayout5 = new FlowLayout();
456
            panchoAlto = new JPanel();
457
            panchoAlto.setLayout(flowLayout5);
458
            lancho.setText("Ancho.");
459
            flowLayout5.setAlignment(java.awt.FlowLayout.LEFT);
460
            flowLayout5.setVgap(20);
461
            jLabel2.setText("Alto.");
462
            panchoAlto.add(lancho, null);
463
            panchoAlto.add(getTancho(), null);
464
            panchoAlto.add(jLabel2, null);
465
            panchoAlto.add(getTalto(), null);
466
        }
467

    
468
        return panchoAlto;
469
    }
470

    
471
    /**
472
     * This method initializes jTextField
473
     *
474
     * @return javax.swing.JTextField
475
     */
476
    public JTextField getTancho() {
477
        if (tancho == null) {
478
            tancho = new JTextField();
479
            tancho.setPreferredSize(new java.awt.Dimension(80, 19));
480
            tancho.setEditable(false);
481
            tancho.setText("0");
482
        }
483

    
484
        return tancho;
485
    }
486

    
487
    /**
488
     * This method initializes jTextField1
489
     *
490
     * @return javax.swing.JTextField
491
     */
492
    public JTextField getTalto() {
493
        if (talto == null) {
494
            talto = new JTextField();
495
            talto.setPreferredSize(new java.awt.Dimension(80, 19));
496
            talto.setText("0");
497
            talto.setEditable(false);
498
        }
499

    
500
        return talto;
501
    }
502
}