Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / dialogs / FConfigLayoutDialog.java @ 6877

History | View | Annotate | Download (21.8 KB)

1
/*
2
 * Created on 23-jun-2004
3
 *
4
 */
5
/* 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
package com.iver.cit.gvsig.gui.layout.dialogs;
46

    
47
import com.iver.andami.PluginServices;
48
import com.iver.andami.ui.mdiManager.IWindow;
49
import com.iver.andami.ui.mdiManager.ViewInfo;
50

    
51
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
import java.awt.Dimension;
56

    
57
import java.text.NumberFormat;
58

    
59
import javax.swing.JPanel;
60

    
61

    
62
/**
63
 * Clase para configurar el Layout.
64
 *
65
 * @author Vicente Caballero Navarro
66
 */
67
public class FConfigLayoutDialog extends JPanel implements IWindow {
68
        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
        private Layout m_layout = null;
92
        private javax.swing.JCheckBox chbHorizontal = null;
93
        private javax.swing.JCheckBox chbVertical = null;
94
        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
        private NumberFormat nf = NumberFormat.getInstance();
104

    
105
        /**
106
         * This is the default constructor
107
         *
108
         * @param layout Referencia al Layout.
109
         */
110
        public FConfigLayoutDialog(Layout layout) {
111
                super();
112
                m_layout = layout;
113
                initialize();
114
        }
115

    
116
        /**
117
         * This method initializes this
118
         */
119
        private void initialize() {
120
                nf.setMaximumFractionDigits(2);
121
                this.setLayout(null);
122
                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
        }
156

    
157
        /**
158
         * This method initializes lTamPag
159
         *
160
         * @return javax.swing.JLabel
161
         */
162
        private javax.swing.JLabel getLTamPag() {
163
                if (lTamPag == null) {
164
                        lTamPag = new javax.swing.JLabel();
165
                        lTamPag.setSize(134, 20);
166
                        lTamPag.setText(PluginServices.getText(this, "tamano_pagina") +
167
                                ":");
168
                        lTamPag.setLocation(25, 15);
169
                }
170

    
171
                return lTamPag;
172
        }
173

    
174
        /**
175
         * This method initializes cbTipoFolio
176
         *
177
         * @return javax.swing.JComboBox
178
         */
179
        private javax.swing.JComboBox getCbTipoFolio() {
180
                if (cbTipoFolio == null) {
181
                        cbTipoFolio = new javax.swing.JComboBox();
182
                        cbTipoFolio.setSize(175, 20);
183
                        cbTipoFolio.setPreferredSize(new java.awt.Dimension(130, 20));
184
                        cbTipoFolio.setLocation(175, 15);
185
                        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
                }
209

    
210
                return cbTipoFolio;
211
        }
212

    
213
        /**
214
         * This method initializes lDistancia
215
         *
216
         * @return javax.swing.JLabel
217
         */
218
        private javax.swing.JLabel getLDistancia() {
219
                if (lDistancia == null) {
220
                        lDistancia = new javax.swing.JLabel();
221
                        lDistancia.setSize(137, 19);
222
                        lDistancia.setText(PluginServices.getText(this, "distance_units"));
223
                        lDistancia.setLocation(25, 40);
224
                }
225

    
226
                return lDistancia;
227
        }
228

    
229
        /**
230
         * This method initializes cbUnidades
231
         *
232
         * @return javax.swing.JComboBox
233
         */
234
        private javax.swing.JComboBox getCbUnidades() {
235
                if (cbUnidades == null) {
236
                        cbUnidades = new javax.swing.JComboBox(Attributes.NAMES);
237
                        cbUnidades.setSize(175, 20);
238
                        cbUnidades.setLocation(175, 40);
239
                        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
                }
255

    
256
                return cbUnidades;
257
        }
258

    
259
        /**
260
         * This method initializes lAnchura
261
         *
262
         * @return javax.swing.JLabel
263
         */
264
        private javax.swing.JLabel getLAnchura() {
265
                if (lAnchura == null) {
266
                        lAnchura = new javax.swing.JLabel();
267
                        lAnchura.setSize(81, 21);
268
                        lAnchura.setText(PluginServices.getText(this, "anchura"));
269
                        lAnchura.setLocation(25, 65);
270
                }
271

    
272
                return lAnchura;
273
        }
274

    
275
        /**
276
         * This method initializes lAltura
277
         *
278
         * @return javax.swing.JLabel
279
         */
280
        private javax.swing.JLabel getLAltura() {
281
                if (lAltura == null) {
282
                        lAltura = new javax.swing.JLabel();
283
                        lAltura.setSize(90, 21);
284
                        lAltura.setText(PluginServices.getText(this, "altura"));
285
                        lAltura.setLocation(180, 65);
286
                }
287

    
288
                return lAltura;
289
        }
290

    
291
        /**
292
         * This method initializes tAncho
293
         *
294
         * @return javax.swing.JTextField
295
         */
296
        private javax.swing.JTextField getTAncho() {
297
                if (tAncho == null) {
298
                        tAncho = new javax.swing.JTextField();
299
                        tAncho.setSize(60, 20);
300
                        tAncho.setLocation(110, 65);
301

    
302
                        Size size = m_layout.getAtributes().getSizeinUnits(isLand, type);
303
                        String s = String.valueOf(nf.format(size.getAncho()));
304
                        tAncho.setText(s);
305
                }
306

    
307
                return tAncho;
308
        }
309

    
310
        /**
311
         * This method initializes tAlto
312
         *
313
         * @return javax.swing.JTextField
314
         */
315
        private javax.swing.JTextField getTAlto() {
316
                if (tAlto == null) {
317
                        tAlto = new javax.swing.JTextField();
318
                        tAlto.setSize(60, 20);
319
                        tAlto.setLocation(280, 65);
320

    
321
                        Size size = m_layout.getAtributes().getSizeinUnits(isLand, type);
322
                        String s = String.valueOf(nf.format(size.getAlto()));
323
                        tAlto.setText(s);
324
                }
325

    
326
                return tAlto;
327
        }
328

    
329
        /**
330
         * This method initializes lOrientacion
331
         *
332
         * @return javax.swing.JLabel
333
         */
334
        private javax.swing.JLabel getLOrientacion() {
335
                if (lOrientacion == null) {
336
                        lOrientacion = new javax.swing.JLabel();
337
                        lOrientacion.setSize(102, 38);
338
                        lOrientacion.setText(PluginServices.getText(this, "orientacion"));
339
                        lOrientacion.setLocation(25, 100);
340
                }
341

    
342
                return lOrientacion;
343
        }
344

    
345
        /**
346
         * This method initializes lMargenes
347
         *
348
         * @return javax.swing.JLabel
349
         */
350
        private javax.swing.JLabel getLMargenes() {
351
                if (lMargenes == null) {
352
                        lMargenes = new javax.swing.JLabel();
353
                        lMargenes.setSize(95, 20);
354
                        lMargenes.setText(PluginServices.getText(this, "margenes"));
355
                        lMargenes.setLocation(25, 145);
356
                }
357

    
358
                return lMargenes;
359
        }
360

    
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
                        getTSuperior().setEnabled(true);
379
                        getTIzquierdo().setEnabled(true);
380
                        getTInferior().setEnabled(true);
381
                        getTDerecho().setEnabled(true);
382
                } else {
383
                        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

    
394
        /**
395
         * This method initializes chbMargenes
396
         *
397
         * @return javax.swing.JCheckBox
398
         */
399
        private javax.swing.JCheckBox getChbMargenes() {
400
                if (chbMargenes == null) {
401
                        chbMargenes = new javax.swing.JCheckBox();
402
                        chbMargenes.setSize(230, 21);
403
                        chbMargenes.setText(PluginServices.getText(this,
404
                                        "utilizar_margenes_impresora"));
405
                        chbMargenes.setLocation(125, 145);
406
                        chbMargenes.setSelected(m_layout.getAtributes().isMargin());
407
                        setMargin(m_layout.getAtributes().isMargin());
408
                        chbMargenes.addActionListener(new java.awt.event.ActionListener() {
409
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
410
                                                if (chbMargenes.isSelected()) {
411
                                                        margin = true;
412
                                                } else {
413
                                                        margin = false;
414
                                                }
415

    
416
                                                setMargin(margin);
417
                                        }
418
                                });
419
                }
420

    
421
                return chbMargenes;
422
        }
423

    
424
        /**
425
         * This method initializes lSuperior
426
         *
427
         * @return javax.swing.JLabel
428
         */
429
        private javax.swing.JLabel getLSuperior() {
430
                if (lSuperior == null) {
431
                        lSuperior = new javax.swing.JLabel();
432
                        lSuperior.setSize(81, 20);
433
                        lSuperior.setText(PluginServices.getText(this, "Superior"));
434
                        lSuperior.setLocation(25, 167);
435
                }
436

    
437
                return lSuperior;
438
        }
439

    
440
        /**
441
         * This method initializes tSuperior
442
         *
443
         * @return javax.swing.JTextField
444
         */
445
        private javax.swing.JTextField getTSuperior() {
446
                if (tSuperior == null) {
447
                        tSuperior = new javax.swing.JTextField();
448
                        tSuperior.setSize(60, 20);
449
                        tSuperior.setLocation(110, 167);
450

    
451
                        if (m_layout.getAtributes().isMargin()) {
452
                                tSuperior.setText(String.valueOf(nf.format(
453
                                                        m_layout.getAtributes().toUnits(sup))));
454
                        }
455
                }
456

    
457
                return tSuperior;
458
        }
459

    
460
        /**
461
         * This method initializes lIzquierdo
462
         *
463
         * @return javax.swing.JLabel
464
         */
465
        private javax.swing.JLabel getLIzquierdo() {
466
                if (lIzquierdo == null) {
467
                        lIzquierdo = new javax.swing.JLabel();
468
                        lIzquierdo.setSize(88, 20);
469
                        lIzquierdo.setText(PluginServices.getText(this, "Izquierdo"));
470
                        lIzquierdo.setLocation(180, 167);
471
                }
472

    
473
                return lIzquierdo;
474
        }
475

    
476
        /**
477
         * This method initializes tIzquierdo
478
         *
479
         * @return javax.swing.JTextField
480
         */
481
        private javax.swing.JTextField getTIzquierdo() {
482
                if (tIzquierdo == null) {
483
                        tIzquierdo = new javax.swing.JTextField();
484
                        tIzquierdo.setSize(60, 20);
485
                        tIzquierdo.setLocation(280, 167);
486

    
487
                        if (m_layout.getAtributes().isMargin()) {
488
                                tIzquierdo.setText(String.valueOf(nf.format(
489
                                                        m_layout.getAtributes().toUnits(izq))));
490
                        }
491
                }
492

    
493
                return tIzquierdo;
494
        }
495

    
496
        /**
497
         * This method initializes lInferior
498
         *
499
         * @return javax.swing.JLabel
500
         */
501
        private javax.swing.JLabel getLInferior() {
502
                if (lInferior == null) {
503
                        lInferior = new javax.swing.JLabel();
504
                        lInferior.setSize(81, 21);
505
                        lInferior.setText(PluginServices.getText(this, "Inferior"));
506
                        lInferior.setLocation(25, 190);
507
                }
508

    
509
                return lInferior;
510
        }
511

    
512
        /**
513
         * This method initializes tInferior
514
         *
515
         * @return javax.swing.JTextField
516
         */
517
        private javax.swing.JTextField getTInferior() {
518
                if (tInferior == null) {
519
                        tInferior = new javax.swing.JTextField();
520
                        tInferior.setSize(60, 20);
521
                        tInferior.setLocation(110, 190);
522

    
523
                        if (m_layout.getAtributes().isMargin()) {
524
                                tInferior.setText(String.valueOf(nf.format(
525
                                                        m_layout.getAtributes().toUnits(inf))));
526
                        }
527
                }
528

    
529
                return tInferior;
530
        }
531

    
532
        /**
533
         * This method initializes lDerecho
534
         *
535
         * @return javax.swing.JLabel
536
         */
537
        private javax.swing.JLabel getLDerecho() {
538
                if (lDerecho == null) {
539
                        lDerecho = new javax.swing.JLabel();
540
                        lDerecho.setSize(87, 21);
541
                        lDerecho.setText(PluginServices.getText(this, "Derecho"));
542
                        lDerecho.setLocation(180, 190);
543
                }
544

    
545
                return lDerecho;
546
        }
547

    
548
        /**
549
         * This method initializes tDerecho
550
         *
551
         * @return javax.swing.JTextField
552
         */
553
        private javax.swing.JTextField getTDerecho() {
554
                if (tDerecho == null) {
555
                        tDerecho = new javax.swing.JTextField();
556
                        tDerecho.setSize(60, 20);
557
                        tDerecho.setLocation(280, 190);
558

    
559
                        if (m_layout.getAtributes().isMargin()) {
560
                                tDerecho.setText(String.valueOf(nf.format(
561
                                                        m_layout.getAtributes().toUnits(der))));
562
                        }
563
                }
564

    
565
                return tDerecho;
566
        }
567

    
568
        /**
569
         * This method initializes lResolucion
570
         *
571
         * @return javax.swing.JLabel
572
         */
573
        private javax.swing.JLabel getLResolucion() {
574
                if (lResolucion == null) {
575
                        lResolucion = new javax.swing.JLabel();
576
                        lResolucion.setSize(164, 21);
577
                        lResolucion.setText(PluginServices.getText(this,
578
                                        "resolucion_resultado"));
579
                        lResolucion.setLocation(25, 215);
580
                }
581

    
582
                return lResolucion;
583
        }
584

    
585
        /**
586
         * This method initializes cbResolucion
587
         *
588
         * @return javax.swing.JComboBox
589
         */
590
        private javax.swing.JComboBox getCbResolucion() {
591
                if (cbResolucion == null) {
592
                        cbResolucion = new javax.swing.JComboBox();
593
                        cbResolucion.setSize(150, 20);
594
                        cbResolucion.setLocation(195, 215);
595
                        cbResolucion.addItem(PluginServices.getText(this, "alta"));
596
                        cbResolucion.addItem(PluginServices.getText(this, "normal"));
597
                        cbResolucion.addItem(PluginServices.getText(this, "baja"));
598
                        cbResolucion.setSelectedIndex(m_layout.getAtributes().getResolution());
599
                        cbResolucion.addActionListener(new java.awt.event.ActionListener() {
600
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
601
                                                resolution = cbResolucion.getSelectedIndex();
602
                                        }
603
                                });
604
                }
605

    
606
                return cbResolucion;
607
        }
608

    
609
        /**
610
         * This method initializes bAceptar
611
         *
612
         * @return javax.swing.JButton
613
         */
614
        private javax.swing.JButton getBAceptar() {
615
                if (bAceptar == null) {
616
                        bAceptar = new javax.swing.JButton();
617
                        bAceptar.setSize(84, 23);
618
                        bAceptar.setText(PluginServices.getText(this, "Aceptar"));
619
                        bAceptar.setLocation(130, 245);
620
                        bAceptar.addActionListener(new java.awt.event.ActionListener() {
621
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
622
                                                m_layout.getAtributes().setUnit(unit);
623

    
624
                                                if (isLand) {
625
                                                        m_layout.getAtributes().setIsLandScape(true);
626
                                                } else {
627
                                                        m_layout.getAtributes().setIsLandScape(false);
628
                                                }
629

    
630
                                                m_layout.getAtributes().setType(type);
631
                                                m_layout.getAtributes().setSizeinUnits(isLand);
632
                                                obtainArea();
633

    
634
                                                double[] area = { sup, inf, izq, der };
635

    
636
                                                if (type == Attributes.CUSTOM) {
637
                                                        Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf(
638
                                                                                getTAncho().getText()).doubleValue(),
639
                                                                        Double.valueOf(getTAlto().getText())
640
                                                                                  .doubleValue());
641
                                                }
642

    
643
                                                m_layout.getAtributes().setSelectedOptions(type, unit,
644
                                                        isLand, margin, resolution, area);
645
                                                PluginServices.getMDIManager().closeView(FConfigLayoutDialog.this);
646
                                                m_layout.fullRect();
647
                                                //m_layout.refresh();
648
                                        }
649
                                });
650
                }
651

    
652
                return bAceptar;
653
        }
654

    
655
        /**
656
         * This method initializes bCancelar
657
         *
658
         * @return javax.swing.JButton
659
         */
660
        private javax.swing.JButton getBCancelar() {
661
                if (bCancelar == null) {
662
                        bCancelar = new javax.swing.JButton();
663
                        bCancelar.setSize(85, 23);
664
                        bCancelar.setText(PluginServices.getText(this, "Cancelar"));
665
                        bCancelar.setLocation(245, 245);
666
                        bCancelar.addActionListener(new java.awt.event.ActionListener() {
667
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
668
                                                //setVisible(false);
669
                                                PluginServices.getMDIManager().closeView(FConfigLayoutDialog.this);
670
                                        }
671
                                });
672
                }
673

    
674
                return bCancelar;
675
        }
676

    
677
        /**
678
         * This method initializes chbHorizontal
679
         *
680
         * @return javax.swing.JCheckBox
681
         */
682
        private javax.swing.JCheckBox getChbHorizontal() {
683
                if (chbHorizontal == null) {
684
                        chbHorizontal = new javax.swing.JCheckBox();
685
                        chbHorizontal.setSize(99, 21);
686
                        chbHorizontal.setText(PluginServices.getText(this, "horizontal"));
687
                        chbHorizontal.setLocation(130, 110);
688
                        chbHorizontal.setSelected(isLand);
689
                        chbHorizontal.addActionListener(new java.awt.event.ActionListener() {
690
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
691
                                                isLand = true;
692
                                                getChbVertical().setSelected(false);
693

    
694
                                                if (chbHorizontal.isSelected()) {
695
                                                        double iz = izq;
696
                                                        izq = inf;
697
                                                        inf = der;
698
                                                        der = sup;
699
                                                        sup = iz;
700

    
701
                                                        setMargin(margin);
702

    
703
                                                        //}else{
704
                                                        if (type == Attributes.CUSTOM) {
705
                                                                Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf(
706
                                                                                        getTAlto().getText()).doubleValue(),
707
                                                                                Double.valueOf(getTAncho().getText())
708
                                                                                          .doubleValue());
709
                                                        }
710

    
711
                                                        Size size = m_layout.getAtributes().getSizeinUnits(isLand,
712
                                                                        type);
713
                                                        getTAncho().setText(String.valueOf(nf.format(
714
                                                                                size.getAncho())));
715
                                                        getTAlto().setText(String.valueOf(nf.format(
716
                                                                                size.getAlto())));
717
                                                }
718

    
719
                                                chbHorizontal.setSelected(true);
720
                                        }
721
                                });
722
                }
723

    
724
                return chbHorizontal;
725
        }
726

    
727
        /**
728
         * This method initializes chbVertical
729
         *
730
         * @return javax.swing.JCheckBox
731
         */
732
        private javax.swing.JCheckBox getChbVertical() {
733
                if (chbVertical == null) {
734
                        chbVertical = new javax.swing.JCheckBox();
735
                        chbVertical.setSize(94, 23);
736
                        chbVertical.setText(PluginServices.getText(this, "vertical"));
737
                        chbVertical.setLocation(245, 110);
738
                        chbVertical.setSelected(!isLand);
739
                        chbVertical.addActionListener(new java.awt.event.ActionListener() {
740
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
741
                                                isLand = false;
742
                                                getChbHorizontal().setSelected(false);
743

    
744
                                                if (chbVertical.isSelected()) {
745
                                                        double in = inf;
746
                                                        inf = izq;
747
                                                        izq = sup;
748
                                                        sup = der;
749
                                                        der = in;
750

    
751
                                                        setMargin(margin);
752

    
753
                                                        //}else{
754
                                                        if (type == Attributes.CUSTOM) {
755
                                                                Attributes.CUSTOM_PAPER_SIZE = new Size(Double.valueOf(
756
                                                                                        getTAncho().getText()).doubleValue(),
757
                                                                                Double.valueOf(getTAlto().getText())
758
                                                                                          .doubleValue());
759
                                                        }
760

    
761
                                                        Size size = m_layout.getAtributes().getSizeinUnits(isLand,
762
                                                                        type);
763
                                                        getTAncho().setText(String.valueOf(nf.format(
764
                                                                                size.getAncho())));
765
                                                        getTAlto().setText(String.valueOf(nf.format(
766
                                                                                size.getAlto())));
767
                                                }
768

    
769
                                                chbVertical.setSelected(true);
770
                                        }
771
                                });
772
                }
773

    
774
                return chbVertical;
775
        }
776

    
777
        /* (non-Javadoc)
778
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
779
         */
780
        public ViewInfo getViewInfo() {
781
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
782
                m_viewinfo.setWidth(371);
783
                m_viewinfo.setHeight(300);
784
                m_viewinfo.setTitle(PluginServices.getText(this, "Preparar_pagina"));
785

    
786
                return m_viewinfo;
787
        }
788

    
789
        /**
790
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#viewActivated()
791
         */
792
        public void viewActivated() {
793
        }
794

    
795
        /**
796
         * Obtiene el ?rea de los JtextField.
797
         */
798
        private void obtainArea() {
799
                String s = (getTSuperior().getText());
800
                s = s.replace(',', '.');
801

    
802
                if (s.length() == 0) {
803
                        s = "0";
804
                }
805

    
806
                sup = m_layout.getAtributes().fromUnits(Double.valueOf(s).doubleValue());
807
                s = (getTIzquierdo().getText());
808
                s = s.replace(',', '.');
809

    
810
                if (s.length() == 0) {
811
                        s = "0";
812
                }
813

    
814
                izq = m_layout.getAtributes().fromUnits(Double.valueOf(s).doubleValue());
815
                s = (getTInferior().getText());
816
                s = s.replace(',', '.');
817

    
818
                if (s.length() == 0) {
819
                        s = "0";
820
                }
821

    
822
                inf = m_layout.getAtributes().fromUnits(Double.valueOf(s).doubleValue());
823
                s = (getTDerecho().getText());
824
                s = s.replace(',', '.');
825

    
826
                if (s.length() == 0) {
827
                        s = "0";
828
                }
829

    
830
                der = m_layout.getAtributes().fromUnits(Double.valueOf(s).doubleValue());
831
        }
832
}