Statistics
| Revision:

svn-gvsig-desktop / tags / v10_RC2c / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / dialogs / FConfigLayoutDialog.java @ 8745

History | View | Annotate | Download (21.8 KB)

1 312 fernando
/*
2
 * Created on 23-jun-2004
3
 *
4
 */
5 1103 fjp
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45 312 fernando
package com.iver.cit.gvsig.gui.layout.dialogs;
46
47 596 fernando
import com.iver.andami.PluginServices;
48 6877 cesar
import com.iver.andami.ui.mdiManager.IWindow;
49 6880 cesar
import com.iver.andami.ui.mdiManager.WindowInfo;
50 1074 vcaballero
51 312 fernando
import com.iver.cit.gvsig.gui.layout.Attributes;
52
import com.iver.cit.gvsig.gui.layout.Layout;
53
import com.iver.cit.gvsig.gui.layout.Size;
54
55 1074 vcaballero
import java.awt.Dimension;
56 312 fernando
57 1074 vcaballero
import java.text.NumberFormat;
58
59
import javax.swing.JPanel;
60
61
62 312 fernando
/**
63
 * Clase para configurar el Layout.
64 1074 vcaballero
 *
65 312 fernando
 * @author Vicente Caballero Navarro
66
 */
67 6877 cesar
public class FConfigLayoutDialog extends JPanel implements IWindow {
68 312 fernando
        private javax.swing.JLabel lTamPag = null;
69
        private javax.swing.JComboBox cbTipoFolio = null;
70
        private javax.swing.JLabel lDistancia = null;
71
        private javax.swing.JComboBox cbUnidades = null;
72
        private javax.swing.JLabel lAnchura = null;
73
        private javax.swing.JLabel lAltura = null;
74
        private javax.swing.JTextField tAncho = null;
75
        private javax.swing.JTextField tAlto = null;
76
        private javax.swing.JLabel lOrientacion = null;
77
        private javax.swing.JLabel lMargenes = null;
78
        private javax.swing.JCheckBox chbMargenes = null;
79
        private javax.swing.JLabel lSuperior = null;
80
        private javax.swing.JTextField tSuperior = null;
81
        private javax.swing.JLabel lIzquierdo = null;
82
        private javax.swing.JTextField tIzquierdo = null;
83
        private javax.swing.JLabel lInferior = null;
84
        private javax.swing.JTextField tInferior = null;
85
        private javax.swing.JLabel lDerecho = null;
86
        private javax.swing.JTextField tDerecho = null;
87
        private javax.swing.JLabel lResolucion = null;
88
        private javax.swing.JComboBox cbResolucion = null;
89
        private javax.swing.JButton bAceptar = null;
90
        private javax.swing.JButton bCancelar = null;
91 1074 vcaballero
        private Layout m_layout = null;
92 312 fernando
        private javax.swing.JCheckBox chbHorizontal = null;
93
        private javax.swing.JCheckBox chbVertical = null;
94 1074 vcaballero
        private int unit = 2;
95
        private int type = 0;
96
        private boolean isLand = true;
97
        private boolean margin = false;
98
        private int resolution = 1;
99
        private double der = 2.54;
100
        private double izq = 2.54;
101
        private double sup = 2.54;
102
        private double inf = 2.54;
103 312 fernando
        private NumberFormat nf = NumberFormat.getInstance();
104 1074 vcaballero
105 312 fernando
        /**
106
         * This is the default constructor
107 1074 vcaballero
         *
108
         * @param layout Referencia al Layout.
109 312 fernando
         */
110
        public FConfigLayoutDialog(Layout layout) {
111
                super();
112 1074 vcaballero
                m_layout = layout;
113 312 fernando
                initialize();
114
        }
115 1074 vcaballero
116 312 fernando
        /**
117
         * This method initializes this
118
         */
119
        private void initialize() {
120
                nf.setMaximumFractionDigits(2);
121
                this.setLayout(null);
122 1074 vcaballero
                type = m_layout.getAtributes().getType();
123
                unit = m_layout.getAtributes().getSelTypeUnit();
124
                isLand = m_layout.getAtributes().isLandSpace();
125
                sup = m_layout.getAtributes().m_area[0];
126
                inf = m_layout.getAtributes().m_area[1];
127
                izq = m_layout.getAtributes().m_area[2];
128
                der = m_layout.getAtributes().m_area[3];
129
                this.add(getLTamPag(), null);
130
                this.add(getCbTipoFolio(), null);
131
                this.add(getLDistancia(), null);
132
                this.add(getCbUnidades(), null);
133
                this.add(getLAnchura(), null);
134
                this.add(getLAltura(), null);
135
                this.add(getTAncho(), null);
136
                this.add(getTAlto(), null);
137
                this.add(getLOrientacion(), null);
138
                this.add(getLMargenes(), null);
139
                this.add(getChbMargenes(), null);
140
                this.add(getLSuperior(), null);
141
                this.add(getTSuperior(), null);
142
                this.add(getLIzquierdo(), null);
143
                this.add(getTIzquierdo(), null);
144
                this.add(getLInferior(), null);
145
                this.add(getTInferior(), null);
146
                this.add(getLDerecho(), null);
147
                this.add(getTDerecho(), null);
148
                this.add(getLResolucion(), null);
149
                this.add(getCbResolucion(), null);
150
                this.add(getBAceptar(), null);
151
                this.add(getBCancelar(), null);
152
                this.add(getChbHorizontal(), null);
153
                this.add(getChbVertical(), null);
154
                this.setPreferredSize(new Dimension(371, 300));
155 312 fernando
        }
156 1074 vcaballero
157 312 fernando
        /**
158
         * This method initializes lTamPag
159 1074 vcaballero
         *
160 312 fernando
         * @return javax.swing.JLabel
161
         */
162
        private javax.swing.JLabel getLTamPag() {
163 1074 vcaballero
                if (lTamPag == null) {
164 312 fernando
                        lTamPag = new javax.swing.JLabel();
165
                        lTamPag.setSize(134, 20);
166 1074 vcaballero
                        lTamPag.setText(PluginServices.getText(this, "tamano_pagina") +
167
                                ":");
168 312 fernando
                        lTamPag.setLocation(25, 15);
169
                }
170 1074 vcaballero
171 312 fernando
                return lTamPag;
172
        }
173 1074 vcaballero
174 312 fernando
        /**
175
         * This method initializes cbTipoFolio
176 1074 vcaballero
         *
177 312 fernando
         * @return javax.swing.JComboBox
178
         */
179
        private javax.swing.JComboBox getCbTipoFolio() {
180 1074 vcaballero
                if (cbTipoFolio == null) {
181 312 fernando
                        cbTipoFolio = new javax.swing.JComboBox();
182
                        cbTipoFolio.setSize(175, 20);
183 1074 vcaballero
                        cbTipoFolio.setPreferredSize(new java.awt.Dimension(130, 20));
184 312 fernando
                        cbTipoFolio.setLocation(175, 15);
185 1074 vcaballero
                        cbTipoFolio.addItem(PluginServices.getText(this,
186
                                        "Igual_que_la_impresora"));
187
                        cbTipoFolio.addItem(PluginServices.getText(this, "A4"));
188
                        cbTipoFolio.addItem(PluginServices.getText(this, "A3"));
189
                        cbTipoFolio.addItem(PluginServices.getText(this, "A2"));
190
                        cbTipoFolio.addItem(PluginServices.getText(this, "A1"));
191
                        cbTipoFolio.addItem(PluginServices.getText(this, "A0"));
192
                        cbTipoFolio.addItem(PluginServices.getText(this, "Personalizado"));
193
194
                        cbTipoFolio.setSelectedIndex(m_layout.getAtributes().getType());
195
                        cbTipoFolio.addActionListener(new java.awt.event.ActionListener() {
196
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
197
                                                type = cbTipoFolio.getSelectedIndex();
198
199
                                                Size size = m_layout.getAtributes().getSizeinUnits(isLand,
200
                                                                type);
201
                                                getTAlto().setText(String.valueOf(nf.format(
202
                                                                        size.getAlto())));
203
                                                getTAncho().setText(String.valueOf(nf.format(
204
                                                                        size.getAncho())));
205
                                                setMargin(margin);
206
                                        }
207
                                });
208 312 fernando
                }
209 1074 vcaballero
210 312 fernando
                return cbTipoFolio;
211
        }
212 1074 vcaballero
213 312 fernando
        /**
214
         * This method initializes lDistancia
215 1074 vcaballero
         *
216 312 fernando
         * @return javax.swing.JLabel
217
         */
218
        private javax.swing.JLabel getLDistancia() {
219 1074 vcaballero
                if (lDistancia == null) {
220 312 fernando
                        lDistancia = new javax.swing.JLabel();
221
                        lDistancia.setSize(137, 19);
222 1074 vcaballero
                        lDistancia.setText(PluginServices.getText(this, "distance_units"));
223 312 fernando
                        lDistancia.setLocation(25, 40);
224
                }
225 1074 vcaballero
226 312 fernando
                return lDistancia;
227
        }
228 1074 vcaballero
229 312 fernando
        /**
230
         * This method initializes cbUnidades
231 1074 vcaballero
         *
232 312 fernando
         * @return javax.swing.JComboBox
233
         */
234
        private javax.swing.JComboBox getCbUnidades() {
235 1074 vcaballero
                if (cbUnidades == null) {
236 362 vcaballero
                        cbUnidades = new javax.swing.JComboBox(Attributes.NAMES);
237 312 fernando
                        cbUnidades.setSize(175, 20);
238
                        cbUnidades.setLocation(175, 40);
239 1074 vcaballero
                        cbUnidades.setSelectedIndex(m_layout.getAtributes().getSelTypeUnit());
240
                        cbUnidades.addActionListener(new java.awt.event.ActionListener() {
241
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
242
                                                unit = cbUnidades.getSelectedIndex();
243
                                                m_layout.getAtributes().setUnit(unit);
244
245
                                                Size size = m_layout.getAtributes().getSizeinUnits(isLand,
246
                                                                type);
247
                                                getTAlto().setText(String.valueOf(nf.format(
248
                                                                        size.getAncho())));
249
                                                getTAncho().setText(String.valueOf(nf.format(
250
                                                                        size.getAlto())));
251
                                                setMargin(margin);
252
                                        }
253
                                });
254 312 fernando
                }
255 1074 vcaballero
256 312 fernando
                return cbUnidades;
257
        }
258 1074 vcaballero
259 312 fernando
        /**
260
         * This method initializes lAnchura
261 1074 vcaballero
         *
262 312 fernando
         * @return javax.swing.JLabel
263
         */
264
        private javax.swing.JLabel getLAnchura() {
265 1074 vcaballero
                if (lAnchura == null) {
266 312 fernando
                        lAnchura = new javax.swing.JLabel();
267
                        lAnchura.setSize(81, 21);
268 1074 vcaballero
                        lAnchura.setText(PluginServices.getText(this, "anchura"));
269 312 fernando
                        lAnchura.setLocation(25, 65);
270
                }
271 1074 vcaballero
272 312 fernando
                return lAnchura;
273
        }
274 1074 vcaballero
275 312 fernando
        /**
276
         * This method initializes lAltura
277 1074 vcaballero
         *
278 312 fernando
         * @return javax.swing.JLabel
279
         */
280
        private javax.swing.JLabel getLAltura() {
281 1074 vcaballero
                if (lAltura == null) {
282 312 fernando
                        lAltura = new javax.swing.JLabel();
283
                        lAltura.setSize(90, 21);
284 1074 vcaballero
                        lAltura.setText(PluginServices.getText(this, "altura"));
285 312 fernando
                        lAltura.setLocation(180, 65);
286
                }
287 1074 vcaballero
288 312 fernando
                return lAltura;
289
        }
290 1074 vcaballero
291 312 fernando
        /**
292
         * This method initializes tAncho
293 1074 vcaballero
         *
294 312 fernando
         * @return javax.swing.JTextField
295
         */
296
        private javax.swing.JTextField getTAncho() {
297 1074 vcaballero
                if (tAncho == null) {
298 312 fernando
                        tAncho = new javax.swing.JTextField();
299
                        tAncho.setSize(60, 20);
300
                        tAncho.setLocation(110, 65);
301 1074 vcaballero
302
                        Size size = m_layout.getAtributes().getSizeinUnits(isLand, type);
303
                        String s = String.valueOf(nf.format(size.getAncho()));
304 312 fernando
                        tAncho.setText(s);
305
                }
306 1074 vcaballero
307 312 fernando
                return tAncho;
308
        }
309 1074 vcaballero
310 312 fernando
        /**
311
         * This method initializes tAlto
312 1074 vcaballero
         *
313 312 fernando
         * @return javax.swing.JTextField
314
         */
315
        private javax.swing.JTextField getTAlto() {
316 1074 vcaballero
                if (tAlto == null) {
317 312 fernando
                        tAlto = new javax.swing.JTextField();
318
                        tAlto.setSize(60, 20);
319
                        tAlto.setLocation(280, 65);
320 1074 vcaballero
321
                        Size size = m_layout.getAtributes().getSizeinUnits(isLand, type);
322
                        String s = String.valueOf(nf.format(size.getAlto()));
323 312 fernando
                        tAlto.setText(s);
324
                }
325 1074 vcaballero
326 312 fernando
                return tAlto;
327
        }
328 1074 vcaballero
329 312 fernando
        /**
330
         * This method initializes lOrientacion
331 1074 vcaballero
         *
332 312 fernando
         * @return javax.swing.JLabel
333
         */
334
        private javax.swing.JLabel getLOrientacion() {
335 1074 vcaballero
                if (lOrientacion == null) {
336 312 fernando
                        lOrientacion = new javax.swing.JLabel();
337
                        lOrientacion.setSize(102, 38);
338 1074 vcaballero
                        lOrientacion.setText(PluginServices.getText(this, "orientacion"));
339 312 fernando
                        lOrientacion.setLocation(25, 100);
340
                }
341 1074 vcaballero
342 312 fernando
                return lOrientacion;
343
        }
344 1074 vcaballero
345 312 fernando
        /**
346
         * This method initializes lMargenes
347 1074 vcaballero
         *
348 312 fernando
         * @return javax.swing.JLabel
349
         */
350
        private javax.swing.JLabel getLMargenes() {
351 1074 vcaballero
                if (lMargenes == null) {
352 312 fernando
                        lMargenes = new javax.swing.JLabel();
353
                        lMargenes.setSize(95, 20);
354 1074 vcaballero
                        lMargenes.setText(PluginServices.getText(this, "margenes"));
355 312 fernando
                        lMargenes.setLocation(25, 145);
356
                }
357 1074 vcaballero
358 312 fernando
                return lMargenes;
359
        }
360 1074 vcaballero
361
        /**
362
         * Inserta si se dibuja los margenes sobre el Layout o no.
363
         *
364
         * @param b True si se tiene que dibujar los margenes.
365
         */
366
        private void setMargin(boolean b) {
367
                margin = b;
368
369
                if (b) {
370
                        getTSuperior().setText(String.valueOf(nf.format(
371
                                                m_layout.getAtributes().toUnits(sup))));
372
                        getTIzquierdo().setText(String.valueOf(nf.format(
373
                                                m_layout.getAtributes().toUnits(izq))));
374
                        getTInferior().setText(String.valueOf(nf.format(
375
                                                m_layout.getAtributes().toUnits(inf))));
376
                        getTDerecho().setText(String.valueOf(nf.format(
377
                                                m_layout.getAtributes().toUnits(der))));
378 312 fernando
                        getTSuperior().setEnabled(true);
379
                        getTIzquierdo().setEnabled(true);
380
                        getTInferior().setEnabled(true);
381
                        getTDerecho().setEnabled(true);
382 1074 vcaballero
                } else {
383 312 fernando
                        getTSuperior().setText("");
384
                        getTIzquierdo().setText("");
385
                        getTInferior().setText("");
386
                        getTDerecho().setText("");
387
                        getTSuperior().setEnabled(false);
388
                        getTIzquierdo().setEnabled(false);
389
                        getTInferior().setEnabled(false);
390
                        getTDerecho().setEnabled(false);
391
                }
392
        }
393 1074 vcaballero
394 312 fernando
        /**
395
         * This method initializes chbMargenes
396 1074 vcaballero
         *
397 312 fernando
         * @return javax.swing.JCheckBox
398
         */
399
        private javax.swing.JCheckBox getChbMargenes() {
400 1074 vcaballero
                if (chbMargenes == null) {
401 312 fernando
                        chbMargenes = new javax.swing.JCheckBox();
402
                        chbMargenes.setSize(230, 21);
403 7235 jmvivo
                        chbMargenes.setText(PluginServices.getText(this,"personalizar_margenes"));
404 312 fernando
                        chbMargenes.setLocation(125, 145);
405
                        chbMargenes.setSelected(m_layout.getAtributes().isMargin());
406 1074 vcaballero
                        setMargin(m_layout.getAtributes().isMargin());
407
                        chbMargenes.addActionListener(new java.awt.event.ActionListener() {
408
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
409
                                                if (chbMargenes.isSelected()) {
410
                                                        margin = true;
411
                                                } else {
412
                                                        margin = false;
413
                                                }
414
415
                                                setMargin(margin);
416 312 fernando
                                        }
417 1074 vcaballero
                                });
418 312 fernando
                }
419 1074 vcaballero
420 312 fernando
                return chbMargenes;
421
        }
422 1074 vcaballero
423 312 fernando
        /**
424
         * This method initializes lSuperior
425 1074 vcaballero
         *
426 312 fernando
         * @return javax.swing.JLabel
427
         */
428
        private javax.swing.JLabel getLSuperior() {
429 1074 vcaballero
                if (lSuperior == null) {
430 312 fernando
                        lSuperior = new javax.swing.JLabel();
431
                        lSuperior.setSize(81, 20);
432 1074 vcaballero
                        lSuperior.setText(PluginServices.getText(this, "Superior"));
433 312 fernando
                        lSuperior.setLocation(25, 167);
434
                }
435 1074 vcaballero
436 312 fernando
                return lSuperior;
437
        }
438 1074 vcaballero
439 312 fernando
        /**
440
         * This method initializes tSuperior
441 1074 vcaballero
         *
442 312 fernando
         * @return javax.swing.JTextField
443
         */
444
        private javax.swing.JTextField getTSuperior() {
445 1074 vcaballero
                if (tSuperior == null) {
446 312 fernando
                        tSuperior = new javax.swing.JTextField();
447
                        tSuperior.setSize(60, 20);
448
                        tSuperior.setLocation(110, 167);
449 1074 vcaballero
450
                        if (m_layout.getAtributes().isMargin()) {
451
                                tSuperior.setText(String.valueOf(nf.format(
452
                                                        m_layout.getAtributes().toUnits(sup))));
453 312 fernando
                        }
454
                }
455 1074 vcaballero
456 312 fernando
                return tSuperior;
457
        }
458 1074 vcaballero
459 312 fernando
        /**
460
         * This method initializes lIzquierdo
461 1074 vcaballero
         *
462 312 fernando
         * @return javax.swing.JLabel
463
         */
464
        private javax.swing.JLabel getLIzquierdo() {
465 1074 vcaballero
                if (lIzquierdo == null) {
466 312 fernando
                        lIzquierdo = new javax.swing.JLabel();
467
                        lIzquierdo.setSize(88, 20);
468 1074 vcaballero
                        lIzquierdo.setText(PluginServices.getText(this, "Izquierdo"));
469 312 fernando
                        lIzquierdo.setLocation(180, 167);
470
                }
471 1074 vcaballero
472 312 fernando
                return lIzquierdo;
473
        }
474 1074 vcaballero
475 312 fernando
        /**
476
         * This method initializes tIzquierdo
477 1074 vcaballero
         *
478 312 fernando
         * @return javax.swing.JTextField
479
         */
480
        private javax.swing.JTextField getTIzquierdo() {
481 1074 vcaballero
                if (tIzquierdo == null) {
482 312 fernando
                        tIzquierdo = new javax.swing.JTextField();
483
                        tIzquierdo.setSize(60, 20);
484
                        tIzquierdo.setLocation(280, 167);
485 1074 vcaballero
486
                        if (m_layout.getAtributes().isMargin()) {
487
                                tIzquierdo.setText(String.valueOf(nf.format(
488
                                                        m_layout.getAtributes().toUnits(izq))));
489 312 fernando
                        }
490
                }
491 1074 vcaballero
492 312 fernando
                return tIzquierdo;
493
        }
494 1074 vcaballero
495 312 fernando
        /**
496
         * This method initializes lInferior
497 1074 vcaballero
         *
498 312 fernando
         * @return javax.swing.JLabel
499
         */
500
        private javax.swing.JLabel getLInferior() {
501 1074 vcaballero
                if (lInferior == null) {
502 312 fernando
                        lInferior = new javax.swing.JLabel();
503
                        lInferior.setSize(81, 21);
504 1074 vcaballero
                        lInferior.setText(PluginServices.getText(this, "Inferior"));
505 312 fernando
                        lInferior.setLocation(25, 190);
506
                }
507 1074 vcaballero
508 312 fernando
                return lInferior;
509
        }
510 1074 vcaballero
511 312 fernando
        /**
512
         * This method initializes tInferior
513 1074 vcaballero
         *
514 312 fernando
         * @return javax.swing.JTextField
515
         */
516
        private javax.swing.JTextField getTInferior() {
517 1074 vcaballero
                if (tInferior == null) {
518 312 fernando
                        tInferior = new javax.swing.JTextField();
519
                        tInferior.setSize(60, 20);
520
                        tInferior.setLocation(110, 190);
521 1074 vcaballero
522
                        if (m_layout.getAtributes().isMargin()) {
523
                                tInferior.setText(String.valueOf(nf.format(
524
                                                        m_layout.getAtributes().toUnits(inf))));
525 312 fernando
                        }
526
                }
527 1074 vcaballero
528 312 fernando
                return tInferior;
529
        }
530 1074 vcaballero
531 312 fernando
        /**
532
         * This method initializes lDerecho
533 1074 vcaballero
         *
534 312 fernando
         * @return javax.swing.JLabel
535
         */
536
        private javax.swing.JLabel getLDerecho() {
537 1074 vcaballero
                if (lDerecho == null) {
538 312 fernando
                        lDerecho = new javax.swing.JLabel();
539
                        lDerecho.setSize(87, 21);
540 1074 vcaballero
                        lDerecho.setText(PluginServices.getText(this, "Derecho"));
541 312 fernando
                        lDerecho.setLocation(180, 190);
542
                }
543 1074 vcaballero
544 312 fernando
                return lDerecho;
545
        }
546 1074 vcaballero
547 312 fernando
        /**
548
         * This method initializes tDerecho
549 1074 vcaballero
         *
550 312 fernando
         * @return javax.swing.JTextField
551
         */
552
        private javax.swing.JTextField getTDerecho() {
553 1074 vcaballero
                if (tDerecho == null) {
554 312 fernando
                        tDerecho = new javax.swing.JTextField();
555
                        tDerecho.setSize(60, 20);
556
                        tDerecho.setLocation(280, 190);
557 1074 vcaballero
558
                        if (m_layout.getAtributes().isMargin()) {
559
                                tDerecho.setText(String.valueOf(nf.format(
560
                                                        m_layout.getAtributes().toUnits(der))));
561 312 fernando
                        }
562
                }
563 1074 vcaballero
564 312 fernando
                return tDerecho;
565
        }
566 1074 vcaballero
567 312 fernando
        /**
568
         * This method initializes lResolucion
569 1074 vcaballero
         *
570 312 fernando
         * @return javax.swing.JLabel
571
         */
572
        private javax.swing.JLabel getLResolucion() {
573 1074 vcaballero
                if (lResolucion == null) {
574 312 fernando
                        lResolucion = new javax.swing.JLabel();
575
                        lResolucion.setSize(164, 21);
576 1074 vcaballero
                        lResolucion.setText(PluginServices.getText(this,
577
                                        "resolucion_resultado"));
578 312 fernando
                        lResolucion.setLocation(25, 215);
579
                }
580 1074 vcaballero
581 312 fernando
                return lResolucion;
582
        }
583 1074 vcaballero
584 312 fernando
        /**
585
         * This method initializes cbResolucion
586 1074 vcaballero
         *
587 312 fernando
         * @return javax.swing.JComboBox
588
         */
589
        private javax.swing.JComboBox getCbResolucion() {
590 1074 vcaballero
                if (cbResolucion == null) {
591 312 fernando
                        cbResolucion = new javax.swing.JComboBox();
592
                        cbResolucion.setSize(150, 20);
593
                        cbResolucion.setLocation(195, 215);
594 1074 vcaballero
                        cbResolucion.addItem(PluginServices.getText(this, "alta"));
595
                        cbResolucion.addItem(PluginServices.getText(this, "normal"));
596
                        cbResolucion.addItem(PluginServices.getText(this, "baja"));
597 312 fernando
                        cbResolucion.setSelectedIndex(m_layout.getAtributes().getResolution());
598 1074 vcaballero
                        cbResolucion.addActionListener(new java.awt.event.ActionListener() {
599
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
600
                                                resolution = cbResolucion.getSelectedIndex();
601
                                        }
602
                                });
603 312 fernando
                }
604 1074 vcaballero
605 312 fernando
                return cbResolucion;
606
        }
607 1074 vcaballero
608 312 fernando
        /**
609
         * This method initializes bAceptar
610 1074 vcaballero
         *
611 312 fernando
         * @return javax.swing.JButton
612
         */
613
        private javax.swing.JButton getBAceptar() {
614 1074 vcaballero
                if (bAceptar == null) {
615 312 fernando
                        bAceptar = new javax.swing.JButton();
616
                        bAceptar.setSize(84, 23);
617 1074 vcaballero
                        bAceptar.setText(PluginServices.getText(this, "Aceptar"));
618 312 fernando
                        bAceptar.setLocation(130, 245);
619 1074 vcaballero
                        bAceptar.addActionListener(new java.awt.event.ActionListener() {
620
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
621
                                                m_layout.getAtributes().setUnit(unit);
622
623
                                                if (isLand) {
624
                                                        m_layout.getAtributes().setIsLandScape(true);
625
                                                } else {
626
                                                        m_layout.getAtributes().setIsLandScape(false);
627
                                                }
628
629
                                                m_layout.getAtributes().setType(type);
630
                                                m_layout.getAtributes().setSizeinUnits(isLand);
631
                                                obtainArea();
632
633
                                                double[] area = { sup, inf, izq, der };
634
635
                                                if (type == Attributes.CUSTOM) {
636
                                                        Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf(
637
                                                                                getTAncho().getText()).doubleValue(),
638
                                                                        Double.valueOf(getTAlto().getText())
639
                                                                                  .doubleValue());
640
                                                }
641
642
                                                m_layout.getAtributes().setSelectedOptions(type, unit,
643
                                                        isLand, margin, resolution, area);
644 6880 cesar
                                                PluginServices.getMDIManager().closeWindow(FConfigLayoutDialog.this);
645 2506 caballero
                                                m_layout.fullRect();
646
                                                //m_layout.refresh();
647 312 fernando
                                        }
648 1074 vcaballero
                                });
649 312 fernando
                }
650 1074 vcaballero
651 312 fernando
                return bAceptar;
652
        }
653 1074 vcaballero
654 312 fernando
        /**
655
         * This method initializes bCancelar
656 1074 vcaballero
         *
657 312 fernando
         * @return javax.swing.JButton
658
         */
659
        private javax.swing.JButton getBCancelar() {
660 1074 vcaballero
                if (bCancelar == null) {
661 312 fernando
                        bCancelar = new javax.swing.JButton();
662
                        bCancelar.setSize(85, 23);
663 1074 vcaballero
                        bCancelar.setText(PluginServices.getText(this, "Cancelar"));
664 312 fernando
                        bCancelar.setLocation(245, 245);
665 1074 vcaballero
                        bCancelar.addActionListener(new java.awt.event.ActionListener() {
666
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
667
                                                //setVisible(false);
668 6880 cesar
                                                PluginServices.getMDIManager().closeWindow(FConfigLayoutDialog.this);
669 1074 vcaballero
                                        }
670
                                });
671 312 fernando
                }
672 1074 vcaballero
673 312 fernando
                return bCancelar;
674
        }
675 1074 vcaballero
676 312 fernando
        /**
677
         * This method initializes chbHorizontal
678 1074 vcaballero
         *
679 312 fernando
         * @return javax.swing.JCheckBox
680
         */
681
        private javax.swing.JCheckBox getChbHorizontal() {
682 1074 vcaballero
                if (chbHorizontal == null) {
683 312 fernando
                        chbHorizontal = new javax.swing.JCheckBox();
684
                        chbHorizontal.setSize(99, 21);
685 1074 vcaballero
                        chbHorizontal.setText(PluginServices.getText(this, "horizontal"));
686 312 fernando
                        chbHorizontal.setLocation(130, 110);
687
                        chbHorizontal.setSelected(isLand);
688 1074 vcaballero
                        chbHorizontal.addActionListener(new java.awt.event.ActionListener() {
689
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
690
                                                isLand = true;
691 312 fernando
                                                getChbVertical().setSelected(false);
692 1074 vcaballero
693
                                                if (chbHorizontal.isSelected()) {
694
                                                        double iz = izq;
695
                                                        izq = inf;
696
                                                        inf = der;
697
                                                        der = sup;
698
                                                        sup = iz;
699
700
                                                        setMargin(margin);
701
702
                                                        //}else{
703
                                                        if (type == Attributes.CUSTOM) {
704
                                                                Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf(
705
                                                                                        getTAlto().getText()).doubleValue(),
706
                                                                                Double.valueOf(getTAncho().getText())
707
                                                                                          .doubleValue());
708
                                                        }
709
710
                                                        Size size = m_layout.getAtributes().getSizeinUnits(isLand,
711
                                                                        type);
712
                                                        getTAncho().setText(String.valueOf(nf.format(
713
                                                                                size.getAncho())));
714
                                                        getTAlto().setText(String.valueOf(nf.format(
715
                                                                                size.getAlto())));
716 312 fernando
                                                }
717 1074 vcaballero
718
                                                chbHorizontal.setSelected(true);
719 312 fernando
                                        }
720 1074 vcaballero
                                });
721 312 fernando
                }
722 1074 vcaballero
723 312 fernando
                return chbHorizontal;
724
        }
725 1074 vcaballero
726 312 fernando
        /**
727
         * This method initializes chbVertical
728 1074 vcaballero
         *
729 312 fernando
         * @return javax.swing.JCheckBox
730
         */
731
        private javax.swing.JCheckBox getChbVertical() {
732 1074 vcaballero
                if (chbVertical == null) {
733 312 fernando
                        chbVertical = new javax.swing.JCheckBox();
734
                        chbVertical.setSize(94, 23);
735 1074 vcaballero
                        chbVertical.setText(PluginServices.getText(this, "vertical"));
736 312 fernando
                        chbVertical.setLocation(245, 110);
737
                        chbVertical.setSelected(!isLand);
738 1074 vcaballero
                        chbVertical.addActionListener(new java.awt.event.ActionListener() {
739
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
740
                                                isLand = false;
741 312 fernando
                                                getChbHorizontal().setSelected(false);
742 1074 vcaballero
743
                                                if (chbVertical.isSelected()) {
744
                                                        double in = inf;
745
                                                        inf = izq;
746
                                                        izq = sup;
747
                                                        sup = der;
748
                                                        der = in;
749
750
                                                        setMargin(margin);
751
752
                                                        //}else{
753
                                                        if (type == Attributes.CUSTOM) {
754
                                                                Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf(
755
                                                                                        getTAncho().getText()).doubleValue(),
756
                                                                                Double.valueOf(getTAlto().getText())
757
                                                                                          .doubleValue());
758
                                                        }
759
760
                                                        Size size = m_layout.getAtributes().getSizeinUnits(isLand,
761
                                                                        type);
762
                                                        getTAncho().setText(String.valueOf(nf.format(
763
                                                                                size.getAncho())));
764
                                                        getTAlto().setText(String.valueOf(nf.format(
765
                                                                                size.getAlto())));
766 312 fernando
                                                }
767 1074 vcaballero
768
                                                chbVertical.setSelected(true);
769 312 fernando
                                        }
770 1074 vcaballero
                                });
771 312 fernando
                }
772 1074 vcaballero
773 312 fernando
                return chbVertical;
774
        }
775 1074 vcaballero
776 312 fernando
        /* (non-Javadoc)
777
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
778
         */
779 6880 cesar
        public WindowInfo getWindowInfo() {
780
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
781 1074 vcaballero
                m_viewinfo.setWidth(371);
782
                m_viewinfo.setHeight(300);
783
                m_viewinfo.setTitle(PluginServices.getText(this, "Preparar_pagina"));
784 596 fernando
785 312 fernando
                return m_viewinfo;
786
        }
787 1074 vcaballero
788 312 fernando
        /**
789 6880 cesar
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
790 312 fernando
         */
791
        public void viewActivated() {
792
        }
793 1074 vcaballero
794
        /**
795
         * Obtiene el ?rea de los JtextField.
796
         */
797
        private void obtainArea() {
798
                String s = (getTSuperior().getText());
799
                s = s.replace(',', '.');
800
801
                if (s.length() == 0) {
802
                        s = "0";
803 312 fernando
                }
804 1074 vcaballero
805
                sup = m_layout.getAtributes().fromUnits(Double.valueOf(s).doubleValue());
806
                s = (getTIzquierdo().getText());
807
                s = s.replace(',', '.');
808
809
                if (s.length() == 0) {
810
                        s = "0";
811 312 fernando
                }
812 1074 vcaballero
813
                izq = m_layout.getAtributes().fromUnits(Double.valueOf(s).doubleValue());
814
                s = (getTInferior().getText());
815
                s = s.replace(',', '.');
816
817
                if (s.length() == 0) {
818
                        s = "0";
819 312 fernando
                }
820 1074 vcaballero
821
                inf = m_layout.getAtributes().fromUnits(Double.valueOf(s).doubleValue());
822
                s = (getTDerecho().getText());
823
                s = s.replace(',', '.');
824
825
                if (s.length() == 0) {
826
                        s = "0";
827 312 fernando
                }
828 1074 vcaballero
829
                der = m_layout.getAtributes().fromUnits(Double.valueOf(s).doubleValue());
830 312 fernando
        }
831 1074 vcaballero
}