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
/*
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.WindowInfo;
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,"personalizar_margenes"));
404
                        chbMargenes.setLocation(125, 145);
405
                        chbMargenes.setSelected(m_layout.getAtributes().isMargin());
406
                        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
                                        }
417
                                });
418
                }
419

    
420
                return chbMargenes;
421
        }
422

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

    
436
                return lSuperior;
437
        }
438

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

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

    
456
                return tSuperior;
457
        }
458

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

    
472
                return lIzquierdo;
473
        }
474

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

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

    
492
                return tIzquierdo;
493
        }
494

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

    
508
                return lInferior;
509
        }
510

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

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

    
528
                return tInferior;
529
        }
530

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

    
544
                return lDerecho;
545
        }
546

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

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

    
564
                return tDerecho;
565
        }
566

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

    
581
                return lResolucion;
582
        }
583

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

    
605
                return cbResolucion;
606
        }
607

    
608
        /**
609
         * This method initializes bAceptar
610
         *
611
         * @return javax.swing.JButton
612
         */
613
        private javax.swing.JButton getBAceptar() {
614
                if (bAceptar == null) {
615
                        bAceptar = new javax.swing.JButton();
616
                        bAceptar.setSize(84, 23);
617
                        bAceptar.setText(PluginServices.getText(this, "Aceptar"));
618
                        bAceptar.setLocation(130, 245);
619
                        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
                                                PluginServices.getMDIManager().closeWindow(FConfigLayoutDialog.this);
645
                                                m_layout.fullRect();
646
                                                //m_layout.refresh();
647
                                        }
648
                                });
649
                }
650

    
651
                return bAceptar;
652
        }
653

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

    
673
                return bCancelar;
674
        }
675

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

    
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
                                                }
717

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

    
723
                return chbHorizontal;
724
        }
725

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

    
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
                                                }
767

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

    
773
                return chbVertical;
774
        }
775

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

    
785
                return m_viewinfo;
786
        }
787

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

    
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
                }
804

    
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
                }
812

    
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
                }
820

    
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
                }
828

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