Statistics
| Revision:

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

History | View | Annotate | Download (12 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
 * Panel que contiene los elementos para el dialogo de salvar a raster
39
 * @author Nacho Brodin <brodin_ign@gva.es>
40
 */
41
public class DataInputSaveRasterProps extends JPanel{
42

    
43
        private JPanel jPanel = null;
44
        private JPanel coordenadas = null;
45
        private JPanel psup_izq = null;
46
        private JPanel pinf_der = null;
47
        private JLabel lsup_izq = null;
48
        private JTextField tsup_izqX = null;
49
        private JTextField tsup_izqY = null;
50
        private JLabel linf_der = null;
51
        private JLabel y = null;
52
        private JTextField tinf_derX = null;
53
        private JTextField tinf_derY = null;
54
        private JPanel datosImagen = null;
55
        private JPanel datosFichero = null;
56
        private JPanel pescalaRes = null;
57
        private JPanel pnombre = null;
58
        private JLabel lescala = null;
59
        private JTextField tescala = null;
60
        private JLabel lfile = null;
61
        private JLabel lresolucion = null;
62
        private JLabel lppp = null;
63
        private DefaultComboBoxModel defaultComboBoxModel = null;   
64
        private BasicComboBoxEditor basicComboBoxEditor = null;   
65
        private String string = null;  
66
        private JComboBox jComboBox = null;
67
        private JButton bseleccion = null;
68
        private JPanel panchoAlto = null;
69
        private JLabel lancho = null;
70
        private JLabel jLabel2 = null;
71
        private JTextField tancho = null;
72
        private JTextField talto = null;
73
        private JButton bcompresion = null;
74
        
75
        /**
76
         * Constructor. Inicializa el panel.
77
         *
78
         */
79
        public DataInputSaveRasterProps() {
80
                super();
81
                initialize();
82
        }
83
        
84
        private  void initialize() {
85
                this.setLayout(new BorderLayout());
86
                this.setSize(350, 208); //AnchoxAlto panel interior
87
                this.add(getJPanel(), java.awt.BorderLayout.CENTER);
88
        }
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
                return jPanel;
105
        }
106
        /**
107
         * This method initializes jPanel1        
108
         *         
109
         * @return javax.swing.JPanel        
110
         */    
111
        private JPanel getCoordenadas() {
112
                if (coordenadas == null) {
113
                        coordenadas = new JPanel();
114
                        coordenadas.setLayout(new BorderLayout());
115
                        coordenadas.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0));
116
                        coordenadas.add(getPsup_izq(), java.awt.BorderLayout.NORTH);
117
                        coordenadas.add(getPinf_der(), java.awt.BorderLayout.SOUTH);
118
                }
119
                return coordenadas;
120
        }
121
        /**
122
         * This method initializes jPanel2        
123
         *         
124
         * @return javax.swing.JPanel        
125
         */    
126
        private JPanel getPsup_izq() {
127
                if (psup_izq == null) {
128
                        lsup_izq = new JLabel();
129
                        y = new JLabel();
130
                        psup_izq = new JPanel();
131
                        FlowLayout flowLayout1 = new FlowLayout();
132
                        psup_izq.setLayout(flowLayout1);
133
                        lsup_izq.setText("Sup. izq. X:");
134
                        y.setText(" Y:");
135
                        flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
136
                        flowLayout1.setHgap(5);
137
                        psup_izq.setAlignmentY(0.5F);
138
                        psup_izq.add(lsup_izq, null);
139
                        psup_izq.add(getTsup_izqX(), null);
140
                        psup_izq.add(y,null);
141
                        psup_izq.add(getTsup_izqY(), null);
142
                }
143
                return psup_izq;
144
        }
145
        /**
146
         * This method initializes jPanel3        
147
         *         
148
         * @return javax.swing.JPanel        
149
         */    
150
        private JPanel getPinf_der() {
151
                if (pinf_der == null) {
152
                        linf_der = new JLabel();
153
                        pinf_der = new JPanel();
154
                        y = new JLabel();
155
                        FlowLayout flowLayout2 = new FlowLayout();
156
                        pinf_der.setLayout(flowLayout2);
157
                        y.setText(" Y:");
158
                        linf_der.setText("Inf. der.  X:");
159
                        flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
160
                        pinf_der.add(linf_der, null);
161
                        pinf_der.add(getTinf_derX(), null);
162
                        pinf_der.add(y,null);
163
                        pinf_der.add(getTinf_derY(), null);
164
                }
165
                return pinf_der;
166
        }
167
        /**
168
         * This method initializes jTextField        
169
         *         
170
         * @return javax.swing.JTextField        
171
         */    
172
        public JTextField getTsup_izqX() {
173
                if (tsup_izqX == null) {
174
                        tsup_izqX = new JTextField();
175
                        tsup_izqX.setPreferredSize(new java.awt.Dimension(110,19));
176
                        tsup_izqX.setText("0");
177
                        tsup_izqX.setMinimumSize(new java.awt.Dimension(110,19));
178
                }
179
                return tsup_izqX;
180
        }
181
        /**
182
         * This method initializes jTextField        
183
         *         
184
         * @return javax.swing.JTextField        
185
         */    
186
        public JTextField getTsup_izqY() {
187
                if (tsup_izqY == null) {
188
                        tsup_izqY = new JTextField();
189
                        tsup_izqY.setMinimumSize(new java.awt.Dimension(110,19));
190
                        tsup_izqY.setPreferredSize(new java.awt.Dimension(110,19));
191
                        tsup_izqY.setText("0");
192
                }
193
                return tsup_izqY;
194
        }
195
        /**
196
         * This method initializes jTextField        
197
         *         
198
         * @return javax.swing.JTextField        
199
         */    
200
        public JTextField getTinf_derX() {
201
                if (tinf_derX == null) {
202
                        tinf_derX = new JTextField();
203
                        tinf_derX.setMinimumSize(new java.awt.Dimension(110,19));
204
                        tinf_derX.setPreferredSize(new java.awt.Dimension(110,19));
205
                        tinf_derX.setText("0");
206
                }
207
                return tinf_derX;
208
        }
209
        /**
210
         * This method initializes jTextField1        
211
         *         
212
         * @return javax.swing.JTextField        
213
         */    
214
        public JTextField getTinf_derY() {
215
                if (tinf_derY == null) {
216
                        tinf_derY = new JTextField();
217
                        tinf_derY.setMinimumSize(new java.awt.Dimension(110,19));
218
                        tinf_derY.setPreferredSize(new java.awt.Dimension(110,19));
219
                        tinf_derY.setText("0");
220
                }
221
                return tinf_derY;
222
        }
223
        /**
224
         * This method initializes jPanel1        
225
         *         
226
         * @return javax.swing.JPanel        
227
         */    
228
        private JPanel getDatosImagen() {
229
                if (datosImagen == null) {
230
                        BorderLayout borderLayout1 = new BorderLayout();
231
                        datosImagen = new JPanel();
232
                        datosImagen.setLayout(borderLayout1);
233
                        datosImagen.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
234
                        datosImagen.setAlignmentY(0.5F);
235
                        borderLayout1.setHgap(0);
236
                        borderLayout1.setVgap(0);
237
                        datosImagen.add(getPescalaRes(), java.awt.BorderLayout.NORTH);
238
                        datosImagen.add(getPanchoAlto(), java.awt.BorderLayout.SOUTH);
239
                }
240
                return datosImagen;
241
        }
242
        /**
243
         * This method initializes jPanel2        
244
         *         
245
         * @return javax.swing.JPanel        
246
         */    
247
        private JPanel getDatosFichero() {
248
                if (datosFichero == null) {
249
                        datosFichero = new JPanel();
250
                        datosFichero.setLayout(new BorderLayout());
251
                        datosFichero.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
252
                        datosFichero.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0));
253
                        datosFichero.add(getPnombre(), java.awt.BorderLayout.CENTER);
254
                }
255
                return datosFichero;
256
        }
257
        /**
258
         * This method initializes jPanel1        
259
         *         
260
         * @return javax.swing.JPanel        
261
         */    
262
        private JPanel getPescalaRes() {
263
                if (pescalaRes == null) {
264
                        lescala = new JLabel();
265
                        lresolucion = new JLabel();
266
                        lppp = new JLabel();
267
                        FlowLayout flowLayout3 = new FlowLayout();
268
                        pescalaRes = new JPanel();
269
                        pescalaRes.setLayout(flowLayout3);
270
                        lescala.setText("Escala  1:");
271
                        lresolucion.setText("Resoluci?n");
272
                        lppp.setText("ppp");
273
                        lresolucion.setName("");
274
                        flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
275
                        flowLayout3.setVgap(20);
276
                        pescalaRes.add(lescala, null);
277
                        pescalaRes.add(getTescala(), null);
278
                        pescalaRes.add(lresolucion, null);
279
                        pescalaRes.add(getJComboBox(), null);
280
                        pescalaRes.add(lppp, null);
281
                }
282
                return pescalaRes;
283
        }
284
        /**
285
         * This method initializes jPanel3        
286
         *         
287
         * @return javax.swing.JPanel        
288
         */    
289
        private JPanel getPnombre() {
290
                if (pnombre == null) {
291
                        lfile = new JLabel();
292
                        pnombre = new JPanel();
293
                        FlowLayout flowLayout4 = new FlowLayout();
294
                        pnombre.setLayout(flowLayout4);
295
                        lfile.setText("Fichero");
296
                        flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
297
                        pnombre.add(lfile, null);
298
                        pnombre.add(getBseleccion(), null);
299
                        pnombre.add(this.getBCompresion(), null);
300
                        this.getBCompresion().setText("Propiedades GeoTiff");
301
                }
302
                return pnombre;
303
        }
304
        /**
305
         * This method initializes jTextField        
306
         *         
307
         * @return javax.swing.JTextField        
308
         */    
309
        public JTextField getTescala() {
310
                if (tescala == null) {
311
                        tescala = new JTextField();
312
                        tescala.setMinimumSize(new java.awt.Dimension(70,19));
313
                        tescala.setPreferredSize(new java.awt.Dimension(80,19));
314
                        tescala.setText("0");
315
                }
316
                return tescala;
317
        }
318
        
319
        private Object makeObj(final String item)  {
320
             return new Object() { public String toString() { return item; } };
321
           }
322
         
323
        /**
324
         * This method initializes defaultComboBoxModel        
325
         *         
326
         * @return javax.swing.DefaultComboBoxModel        
327
         */    
328
        private DefaultComboBoxModel getDefaultComboBoxModel() {
329
                if (defaultComboBoxModel == null) {
330
                        defaultComboBoxModel = new DefaultComboBoxModel();
331
                }
332
                return defaultComboBoxModel;
333
        }
334
        /**
335
         * This method initializes basicComboBoxEditor        
336
         *         
337
         * @return javax.swing.plaf.basic.BasicComboBoxEditor        
338
         */    
339
        private BasicComboBoxEditor getBasicComboBoxEditor() {
340
                if (basicComboBoxEditor == null) {
341
                        basicComboBoxEditor = new BasicComboBoxEditor();
342
                        basicComboBoxEditor.setItem(getString());
343
                }
344
                return basicComboBoxEditor;
345
        }
346
        /**
347
         * This method initializes string        
348
         *         
349
         * @return java.lang.String        
350
         */    
351
        private String getString() {
352
                if (string == null) {
353
                        string = new String();
354
                }
355
                return string;
356
        }
357
        /**
358
         * This method initializes jComboBox        
359
         *         
360
         * @return javax.swing.JComboBox        
361
         */    
362
        public JComboBox getJComboBox() {
363
                if (jComboBox == null) {
364
                        String[] lista={"75","150","300"};
365
                        jComboBox = new JComboBox(lista);
366
                        jComboBox.setPreferredSize(new java.awt.Dimension(70,24));
367
                }
368
                return jComboBox;
369
        }
370
        
371
        /**
372
         * This method initializes jComboBox        
373
         *         
374
         * @return javax.swing.JComboBox        
375
         */    
376
        public JButton getBCompresion() {
377
                if (bcompresion == null) {
378
                        bcompresion = new JButton();
379
                }
380
                return bcompresion;
381
        }
382
        
383
        /**
384
         * This method initializes jButton        
385
         *         
386
         * @return javax.swing.JButton        
387
         */    
388
        public JButton getBseleccion() {
389
                if (bseleccion == null) {
390
                        bseleccion = new JButton();
391
                        bseleccion.setText("Seleccionar");
392
                }
393
                return bseleccion;
394
        }
395
        /**
396
         * This method initializes jPanel1        
397
         *         
398
         * @return javax.swing.JPanel        
399
         */    
400
        private JPanel getPanchoAlto() {
401
                if (panchoAlto == null) {
402
                        jLabel2 = new JLabel();
403
                        lancho = new JLabel();
404
                        FlowLayout flowLayout5 = new FlowLayout();
405
                        panchoAlto = new JPanel();
406
                        panchoAlto.setLayout(flowLayout5);
407
                        lancho.setText("Ancho.");
408
                        flowLayout5.setAlignment(java.awt.FlowLayout.LEFT);
409
                        flowLayout5.setVgap(20);
410
                        jLabel2.setText("Alto.");
411
                        panchoAlto.add(lancho, null);
412
                        panchoAlto.add(getTancho(), null);
413
                        panchoAlto.add(jLabel2, null);
414
                        panchoAlto.add(getTalto(), null);
415
                        
416
                }
417
                return panchoAlto;
418
        }
419
        /**
420
         * This method initializes jTextField        
421
         *         
422
         * @return javax.swing.JTextField        
423
         */    
424
        public JTextField getTancho() {
425
                if (tancho == null) {
426
                        tancho = new JTextField();
427
                        tancho.setPreferredSize(new java.awt.Dimension(80,19));
428
                        tancho.setEditable(false);
429
                        tancho.setText("0");
430
                }
431
                return tancho;
432
        }
433
        /**
434
         * This method initializes jTextField1        
435
         *         
436
         * @return javax.swing.JTextField        
437
         */    
438
        public JTextField getTalto() {
439
                if (talto == null) {
440
                        talto = new JTextField();
441
                        talto.setPreferredSize(new java.awt.Dimension(80,19));
442
                        talto.setText("0");
443
                        talto.setEditable(false);
444
                }
445
                return talto;
446
        }
447
   }