Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / gui / dialogs / FBorderDialog.java @ 9641

History | View | Annotate | Download (21.3 KB)

1
/*
2
 * Created on 28-jul-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.project.documents.layout.gui.dialogs;
46

    
47
import java.awt.Color;
48
import java.awt.geom.AffineTransform;
49
import java.awt.geom.Point2D;
50
import java.awt.geom.Rectangle2D;
51

    
52
import javax.swing.ButtonGroup;
53
import javax.swing.JPanel;
54

    
55
import com.iver.andami.PluginServices;
56
import com.iver.andami.ui.mdiManager.IWindow;
57
import com.iver.andami.ui.mdiManager.WindowInfo;
58
import com.iver.cit.gvsig.fmap.core.adapter.GeometryAdapter;
59
import com.iver.cit.gvsig.fmap.core.adapter.RectangleAdapter;
60
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
61
import com.iver.cit.gvsig.project.documents.layout.FLayoutGraphics;
62
import com.iver.cit.gvsig.project.documents.layout.LayoutControl;
63
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGraphics;
64
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGraphicsFactory;
65
import com.iver.cit.gvsig.project.documents.layout.fframes.FrameFactory;
66
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame;
67
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.FFrameGraphicsDialog;
68
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
69

    
70

    
71
/**
72
 * Di?logo con todas las opciones para crear un borde a los fframes.
73
 *
74
 * @author Vicente Caballero Navarro
75
 */
76
public class FBorderDialog extends JPanel implements IWindow {
77
        private javax.swing.JRadioButton rbSeleccionados = null;
78
        private javax.swing.JRadioButton rbTodos = null;
79
        private javax.swing.JRadioButton rbMargen = null;
80
        private javax.swing.JCheckBox chbAgrupar = null;
81
        private javax.swing.JPanel pPosicion = null;
82
        private javax.swing.JCheckBox chbIgualLados = null;
83
        private javax.swing.JLabel lunidades = null;
84
        private javax.swing.JTextField tTodosLados = null;
85
        private javax.swing.JLabel lSuperior = null;
86
        private javax.swing.JLabel lInferior = null;
87
        private javax.swing.JTextField tSuperior = null;
88
        private javax.swing.JTextField tInferior = null;
89
        private javax.swing.JLabel lIzquierda = null;
90
        private javax.swing.JLabel lDerecha = null;
91
        private javax.swing.JTextField tIzquierda = null;
92
        private javax.swing.JTextField tDerecha = null;
93
        private javax.swing.JLabel lUnidades = null;
94
        private javax.swing.JButton bAceptar = null;
95
        private javax.swing.JButton bCancelar = null;
96
        private Layout layout = null;
97
        private IFFrame[] selecList;// = new ArrayList();
98
        private FFrameGraphics fframegraphics = null;
99
        private FLayoutGraphics flg = null;
100
        private String m_NameUnit = null;
101
        private javax.swing.JButton bConfigurar = null;
102
        GeometryAdapter geometry=new RectangleAdapter();
103
        private boolean isAccepted=false;
104
        private ISymbol symbol;
105

    
106
        /**
107
         * This is the default constructor
108
         *
109
         * @param l Referencia al Layout.
110
         */
111
        public FBorderDialog(Layout l) {
112
                super();
113
                layout = l;
114
                flg = new FLayoutGraphics(layout);
115
                fframegraphics =(FFrameGraphics)FrameFactory.createFrameFromName(FFrameGraphicsFactory.registerName);
116

    
117
                fframegraphics.setLayout(layout);
118

    
119
                fframegraphics.setColor(Color.black);
120
                fframegraphics.update(FFrameGraphics.RECTANGLE, layout.getLayoutControl().getAT());
121

    
122

    
123
                initialize();
124
                startFFrameGraphic();
125
        }
126
        private void startFFrameGraphic() {
127
                IFFrame[] fframes=layout.getLayoutContext().getFFrames();
128
                double x = Double.parseDouble(getTIzquierda().getText()
129
                                  .toString());
130
                double y = Double.parseDouble(getTSuperior().getText()
131
                                  .toString());
132
                double w = Double.parseDouble(getTDerecha().getText()
133
                                  .toString());
134
                double h = Double.parseDouble(getTInferior().getText()
135
                                  .toString());
136

    
137
                Rectangle2D re = new Rectangle2D.Double();
138

    
139
                if (getRbSeleccionados().isSelected()) {
140
                        if (selecList.length > 0) {
141
                                re=getRectangle(selecList[0]);
142

    
143
                        }
144

    
145
                        for (int i = 1; i < selecList.length; i++) {
146
                                Rectangle2D rectaux = getRectangle(selecList[i]);
147
                                re.add(rectaux);
148
                        }
149

    
150
                        //                                                crear un Rect?ngulo alrededor de los fframes seleccionados.
151
                } else if (getRbTodos().isSelected()) {
152
                        if (fframes.length > 0) {
153
                                re=getRectangle(fframes[0]);
154
                        }
155

    
156
                        for (int i = 1; i < fframes.length;
157
                                        i++) {
158
                                Rectangle2D rectaux = getRectangle(fframes[i]);
159
                                re.add(rectaux);
160
                        }
161

    
162
                        //                                                creaer un Rect?ngulo que incluya a todos los fframes.
163
                } else if (getRbMargen().isSelected()) {
164
                        //                                                creaer un Rect?ngulo en los m?rgenes del Layout.
165
                        re.setRect(layout.getLayoutContext().getAtributes().getArea());
166
                }
167

    
168
                re.setRect(re.getX() - x, re.getY() - y, re.getWidth() + x + w,
169
                        re.getHeight() + y + h);
170

    
171
                geometry=new RectangleAdapter();
172
                geometry.addPoint(new Point2D.Double(re.getX(),re.getY()));
173
                geometry.addPoint(new Point2D.Double(re.getMaxX(),re.getMaxY()));
174
                geometry.end();
175
                fframegraphics.setGeometryAdapter(geometry);
176
        }
177
        /**
178
         * This method initializes this
179
         */
180
        private void initialize() {
181
                selecList=layout.getLayoutContext().getFFrameSelected();
182
                this.setLayout(null);
183
                m_NameUnit = layout.getLayoutContext().getAtributes().getNameUnit();
184
                this.add(getRbSeleccionados(), null);
185
                this.add(getRbTodos(), null);
186
                this.add(getRbMargen(), null);
187
                this.add(getChbAgrupar(), null);
188
                this.add(getPPosicion(), null);
189
                this.add(getBAceptar(), null);
190
                this.add(getBCancelar(), null);
191
                this.add(getBConfigurar(), null);
192
                this.setSize(371, 223);
193

    
194
                ButtonGroup group = new ButtonGroup();
195
                group.add(getRbSeleccionados());
196
                group.add(getRbTodos());
197
                group.add(getRbMargen());
198
        }
199

    
200
        /**
201
         * This method initializes rbSeleccionados
202
         *
203
         * @return javax.swing.JRadioButton
204
         */
205
        private javax.swing.JRadioButton getRbSeleccionados() {
206
                if (rbSeleccionados == null) {
207
                        rbSeleccionados = new javax.swing.JRadioButton();
208
                        rbSeleccionados.setBounds(10, 8, 416, 20);
209
                        rbSeleccionados.setText(PluginServices.getText(this,
210
                                        "colocar_alrededor_seleccionados"));
211

    
212
                        if (selecList.length == 0) {
213
                                rbSeleccionados.setEnabled(false);
214
                                getRbTodos().setSelected(true);
215
                        } else {
216
                                rbSeleccionados.setSelected(true);
217
                        }
218
                }
219

    
220
                return rbSeleccionados;
221
        }
222

    
223
        /**
224
         * This method initializes rbTodos
225
         *
226
         * @return javax.swing.JRadioButton
227
         */
228
        private javax.swing.JRadioButton getRbTodos() {
229
                if (rbTodos == null) {
230
                        rbTodos = new javax.swing.JRadioButton();
231
                        rbTodos.setBounds(10, 29, 332, 20);
232
                        rbTodos.setText(PluginServices.getText(this,
233
                                        "colocar_alrededor_todos"));
234
                }
235

    
236
                return rbTodos;
237
        }
238

    
239
        /**
240
         * This method initializes rbMargen
241
         *
242
         * @return javax.swing.JRadioButton
243
         */
244
        private javax.swing.JRadioButton getRbMargen() {
245
                if (rbMargen == null) {
246
                        rbMargen = new javax.swing.JRadioButton();
247
                        rbMargen.setBounds(10, 51, 286, 20);
248
                        rbMargen.setText(PluginServices.getText(this, "colocar_a_margenes"));
249
                }
250

    
251
                return rbMargen;
252
        }
253

    
254
        /**
255
         * This method initializes chbAgrupar
256
         *
257
         * @return javax.swing.JCheckBox
258
         */
259
        private javax.swing.JCheckBox getChbAgrupar() {
260
                if (chbAgrupar == null) {
261
                        chbAgrupar = new javax.swing.JCheckBox();
262
                        chbAgrupar.setBounds(10, 70, 280, 20);
263
                        chbAgrupar.setText(PluginServices.getText(this, "agrupar_linea"));
264
                }
265

    
266
                return chbAgrupar;
267
        }
268

    
269
        /**
270
         * This method initializes pPosicion
271
         *
272
         * @return javax.swing.JPanel
273
         */
274
        private javax.swing.JPanel getPPosicion() {
275
                if (pPosicion == null) {
276
                        pPosicion = new javax.swing.JPanel();
277
                        pPosicion.setLayout(null);
278
                        pPosicion.add(getChbIgualLados(), null);
279
                        pPosicion.add(getLunidades(), null);
280
                        pPosicion.add(getTTodosLados(), null);
281
                        pPosicion.add(getLSuperior(), null);
282
                        pPosicion.add(getLInferior(), null);
283
                        pPosicion.add(getTSuperior(), null);
284
                        pPosicion.add(getTInferior(), null);
285
                        pPosicion.add(getLIzquierda(), null);
286
                        pPosicion.add(getLDerecha(), null);
287
                        pPosicion.add(getTIzquierda(), null);
288
                        pPosicion.add(getTDerecha(), null);
289
                        pPosicion.add(getLUnidades(), null);
290
                        pPosicion.setBounds(12, 92, 350, 97);
291
                        pPosicion.setBorder(javax.swing.BorderFactory.createTitledBorder(
292
                                        null, PluginServices.getText(this, "posicion_linea"),
293
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
294
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
295
                }
296

    
297
                return pPosicion;
298
        }
299

    
300
        /**
301
         * This method initializes chbIgualLados
302
         *
303
         * @return javax.swing.JCheckBox
304
         */
305
        private javax.swing.JCheckBox getChbIgualLados() {
306
                if (chbIgualLados == null) {
307
                        chbIgualLados = new javax.swing.JCheckBox();
308
                        chbIgualLados.setBounds(10, 16, 243, 21);
309
                        chbIgualLados.setText(PluginServices.getText(this,
310
                                        "igual_todos_lados"));
311
                        chbIgualLados.setSelected(true);
312
                        chbIgualLados.addActionListener(new java.awt.event.ActionListener() {
313
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
314
                                                if (!chbIgualLados.isSelected()) {
315
                                                        getTTodosLados().setEnabled(false);
316
                                                        getTSuperior().setEnabled(true);
317
                                                        getTInferior().setEnabled(true);
318
                                                        getTIzquierda().setEnabled(true);
319
                                                        getTDerecha().setEnabled(true);
320
                                                } else {
321
                                                        getTTodosLados().setEnabled(true);
322
                                                        getTSuperior().setEnabled(false);
323
                                                        getTInferior().setEnabled(false);
324
                                                        getTIzquierda().setEnabled(false);
325
                                                        getTDerecha().setEnabled(false);
326
                                                        getTSuperior().setText(tTodosLados.getText());
327
                                                        getTInferior().setText(tTodosLados.getText());
328
                                                        getTIzquierda().setText(tTodosLados.getText());
329
                                                        getTDerecha().setText(tTodosLados.getText());
330
                                                }
331
                                        }
332
                                });
333
                }
334

    
335
                return chbIgualLados;
336
        }
337

    
338
        /**
339
         * This method initializes lunidades
340
         *
341
         * @return javax.swing.JLabel
342
         */
343
        private javax.swing.JLabel getLunidades() {
344
                if (lunidades == null) {
345
                        lunidades = new javax.swing.JLabel();
346
                        lunidades.setBounds(264, 64, 78, 18);
347
                        lunidades.setText(PluginServices.getText(this,m_NameUnit));
348
                }
349

    
350
                return lunidades;
351
        }
352

    
353
        /**
354
         * This method initializes tTodosLados
355
         *
356
         * @return javax.swing.JTextField
357
         */
358
        private javax.swing.JTextField getTTodosLados() {
359
                if (tTodosLados == null) {
360
                        tTodosLados = new javax.swing.JTextField();
361
                        tTodosLados.setBounds(267, 19, 48, 16);
362
                        tTodosLados.setText("0.5");
363
                        tTodosLados.addCaretListener(new javax.swing.event.CaretListener() {
364
                                        public void caretUpdate(javax.swing.event.CaretEvent e) {
365
                                                if (getChbIgualLados().isSelected()) {
366
                                                        getTSuperior().setText(tTodosLados.getText());
367
                                                        getTInferior().setText(tTodosLados.getText());
368
                                                        getTIzquierda().setText(tTodosLados.getText());
369
                                                        getTDerecha().setText(tTodosLados.getText());
370
                                                }
371
                                        }
372
                                });
373
                }
374

    
375
                return tTodosLados;
376
        }
377

    
378
        /**
379
         * This method initializes lSuperior
380
         *
381
         * @return javax.swing.JLabel
382
         */
383
        private javax.swing.JLabel getLSuperior() {
384
                if (lSuperior == null) {
385
                        lSuperior = new javax.swing.JLabel();
386
                        lSuperior.setBounds(10, 55, 62, 16);
387
                        lSuperior.setText(PluginServices.getText(this, "Superior"));
388
                }
389

    
390
                return lSuperior;
391
        }
392

    
393
        /**
394
         * This method initializes lInferior
395
         *
396
         * @return javax.swing.JLabel
397
         */
398
        private javax.swing.JLabel getLInferior() {
399
                if (lInferior == null) {
400
                        lInferior = new javax.swing.JLabel();
401
                        lInferior.setBounds(10, 72, 62, 16);
402
                        lInferior.setText(PluginServices.getText(this, "Inferior"));
403
                }
404

    
405
                return lInferior;
406
        }
407

    
408
        /**
409
         * This method initializes tSuperior
410
         *
411
         * @return javax.swing.JTextField
412
         */
413
        private javax.swing.JTextField getTSuperior() {
414
                if (tSuperior == null) {
415
                        tSuperior = new javax.swing.JTextField();
416
                        tSuperior.setBounds(78, 55, 48, 16);
417
                        tSuperior.setText("0.5");
418
                        tSuperior.setEnabled(false);
419
                }
420

    
421
                return tSuperior;
422
        }
423

    
424
        /**
425
         * This method initializes tInferior
426
         *
427
         * @return javax.swing.JTextField
428
         */
429
        private javax.swing.JTextField getTInferior() {
430
                if (tInferior == null) {
431
                        tInferior = new javax.swing.JTextField();
432
                        tInferior.setBounds(78, 72, 48, 16);
433
                        tInferior.setText("0.5");
434
                        tInferior.setEnabled(false);
435
                }
436

    
437
                return tInferior;
438
        }
439

    
440
        /**
441
         * This method initializes lIzquierda
442
         *
443
         * @return javax.swing.JLabel
444
         */
445
        private javax.swing.JLabel getLIzquierda() {
446
                if (lIzquierda == null) {
447
                        lIzquierda = new javax.swing.JLabel();
448
                        lIzquierda.setBounds(140, 55, 62, 16);
449
                        lIzquierda.setText(PluginServices.getText(this, "Izquierda"));
450
                }
451

    
452
                return lIzquierda;
453
        }
454

    
455
        /**
456
         * This method initializes lDerecha
457
         *
458
         * @return javax.swing.JLabel
459
         */
460
        private javax.swing.JLabel getLDerecha() {
461
                if (lDerecha == null) {
462
                        lDerecha = new javax.swing.JLabel();
463
                        lDerecha.setBounds(140, 72, 62, 16);
464
                        lDerecha.setText(PluginServices.getText(this, "Derecha"));
465
                }
466

    
467
                return lDerecha;
468
        }
469

    
470
        /**
471
         * This method initializes tIzquierda
472
         *
473
         * @return javax.swing.JTextField
474
         */
475
        private javax.swing.JTextField getTIzquierda() {
476
                if (tIzquierda == null) {
477
                        tIzquierda = new javax.swing.JTextField();
478
                        tIzquierda.setBounds(207, 55, 48, 16);
479
                        tIzquierda.setText("0.5");
480
                        tIzquierda.setEnabled(false);
481
                }
482

    
483
                return tIzquierda;
484
        }
485

    
486
        /**
487
         * This method initializes tDerecha
488
         *
489
         * @return javax.swing.JTextField
490
         */
491
        private javax.swing.JTextField getTDerecha() {
492
                if (tDerecha == null) {
493
                        tDerecha = new javax.swing.JTextField();
494
                        tDerecha.setBounds(207, 72, 48, 16);
495
                        tDerecha.setText("0.5");
496
                        tDerecha.setEnabled(false);
497
                }
498

    
499
                return tDerecha;
500
        }
501

    
502
        /**
503
         * This method initializes lUnidades
504
         *
505
         * @return javax.swing.JLabel
506
         */
507
        private javax.swing.JLabel getLUnidades() {
508
                if (lUnidades == null) {
509
                        lUnidades = new javax.swing.JLabel();
510
                        lUnidades.setBounds(207, 36, 134, 18);
511
                        lUnidades.setText(PluginServices.getText(this, "map_units"));
512
                }
513

    
514
                return lUnidades;
515
        }
516

    
517
        /**
518
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
519
         */
520
        public WindowInfo getWindowInfo() {
521
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
522
                m_viewinfo.setTitle(PluginServices.getText(this, "ajustes_linea_grafica"));
523

    
524
                return m_viewinfo;
525
        }
526

    
527
        /**
528
         * This method initializes bAceptar
529
         *
530
         * @return javax.swing.JButton
531
         */
532
        private javax.swing.JButton getBAceptar() {
533
                if (bAceptar == null) {
534
                        bAceptar = new javax.swing.JButton();
535
                        bAceptar.setBounds(134, 193, 100, 20);
536
                        bAceptar.setText(PluginServices.getText(this, "Aceptar"));
537
                        bAceptar.addActionListener(new java.awt.event.ActionListener() {
538
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
539
                                                IFFrame[] fframes=layout.getLayoutContext().getFFrames();
540
                                                double x = Double.parseDouble(getTIzquierda().getText()
541
                                                                                                                  .toString());
542
                                                double y = Double.parseDouble(getTSuperior().getText()
543
                                                                                                                  .toString());
544
                                                double w = Double.parseDouble(getTDerecha().getText()
545
                                                                                                                  .toString());
546
                                                double h = Double.parseDouble(getTInferior().getText()
547
                                                                                                                  .toString());
548

    
549
                                                if (!getChbAgrupar().isSelected()) {
550
                                                        Rectangle2D re = new Rectangle2D.Double();
551

    
552
                                                        if (getRbSeleccionados().isSelected()) {
553
                                                                if (selecList.length > 0) {
554
                                                                        re=getRectangle(selecList[0]);
555

    
556
                                                                }
557

    
558
                                                                for (int i = 1; i < selecList.length; i++) {
559
                                                                        Rectangle2D rectaux = getRectangle(selecList[i]);
560
                                                                        re.add(rectaux);
561
                                                                }
562

    
563
                                                                //                                                crear un Rect?ngulo alrededor de los fframes seleccionados.
564
                                                        } else if (getRbTodos().isSelected()) {
565
                                                                if (fframes.length > 0) {
566
                                                                        re=getRectangle(fframes[0]);
567
                                                                }
568

    
569
                                                                for (int i = 1; i < fframes.length;
570
                                                                                i++) {
571
                                                                        Rectangle2D rectaux = getRectangle(fframes[i]);
572
                                                                        re.add(rectaux);
573
                                                                }
574

    
575
                                                                //                                                creaer un Rect?ngulo que incluya a todos los fframes.
576
                                                        } else if (getRbMargen().isSelected()) {
577
                                                                //                                                creaer un Rect?ngulo en los m?rgenes del Layout.
578
                                                                re.setRect(layout.getLayoutContext().getAtributes().getArea());
579
                                                        }
580

    
581
                                                        re.setRect(re.getX() - x, re.getY() - y, re.getWidth() + x + w,
582
                                                                re.getHeight() + y + h);
583

    
584
                                                        geometry=new RectangleAdapter();
585
                                                        geometry.addPoint(new Point2D.Double(re.getX(),re.getY()));
586
                                                        geometry.addPoint(new Point2D.Double(re.getMaxX(),re.getMaxY()));
587
                                                        geometry.end();
588
                                                        fframegraphics.setGeometryAdapter(geometry);
589
                                                        fframegraphics.setBoundBox(re);
590
                                                        if (symbol!=null)
591
                                                                fframegraphics.setFSymbol(symbol);
592
                                                        layout.getLayoutContext().addFFrame(fframegraphics, true,true);
593
                                                } else { //Agrupar
594

    
595
                                                        Rectangle2D re = new Rectangle2D.Double();
596
                                                        if (getRbSeleccionados().isSelected()) {
597
                                                                if (selecList.length > 0) {
598
                                                                        re=getRectangle(selecList[0]);
599
                                                                }
600

    
601
                                                                for (int i = 1; i < selecList.length; i++) {
602
                                                                        Rectangle2D rectaux = getRectangle(selecList[i]);
603
                                                                        re.add(rectaux);
604
                                                                }
605

    
606
                                                                //                                                crear un Rect?ngulo alrededor de los fframes seleccionados.
607
                                                        } else if (getRbTodos().isSelected()) {
608
                                                                if (fframes.length > 0) {
609
                                                                        re=getRectangle(fframes[0]);
610
                                                                }
611

    
612
                                                                for (int i = 1; i < fframes.length;
613
                                                                                i++) {
614
                                                                        Rectangle2D rectaux = getRectangle(fframes[i]);
615
                                                                        fframes[i].setSelected(true);
616
                                                                        re.add(rectaux);
617
                                                                }
618

    
619
                                                                //                                                creaer un Rect?ngulo que incluya a todos los fframes.
620
                                                        } else if (getRbMargen().isSelected()) {
621
                                                                //                                                creaer un Rect?ngulo en los m?rgenes del Layout.
622
                                                                re.setRect(layout.getLayoutContext().getAtributes().getArea());
623
                                                        }
624

    
625
                                                        re.setRect(re.getX() - x, re.getY() - y, re.getWidth() + x + w,
626
                                                                re.getHeight() + y + h);
627

    
628
                                                        geometry=new RectangleAdapter();
629
                                                        geometry.addPoint(new Point2D.Double(re.getX(),re.getY()));
630
                                                        geometry.addPoint(new Point2D.Double(re.getMaxX(),re.getMaxY()));
631
                                                        geometry.end();
632
                                                        fframegraphics.setGeometryAdapter(geometry);
633
                                                        fframegraphics.setBoundBox(re);
634
                                                        if (symbol!=null)
635
                                                                fframegraphics.setFSymbol(symbol);
636
                                                        layout.getLayoutContext().getEFS().startComplexCommand();
637
                                                        layout.getLayoutContext().addFFrame(fframegraphics, false,true);
638
                                                        flg.grouping();
639
                                                        layout.getLayoutContext().getEFS().endComplexCommand(PluginServices.getText(this,"group_graphic_line"));
640

    
641
                                                }
642

    
643
                                                PluginServices.getMDIManager().closeWindow(FBorderDialog.this);
644
                                                layout.getLayoutControl().setStatus(LayoutControl.DESACTUALIZADO);
645
                                                layout.getLayoutControl().repaint();
646
                                                isAccepted=true;
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.setBounds(251, 193, 100, 20);
663
                        bCancelar.setText(PluginServices.getText(this, "Cancelar"));
664
                        bCancelar.addActionListener(new java.awt.event.ActionListener() {
665
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
666
                                                PluginServices.getMDIManager().closeWindow(FBorderDialog.this);
667
                                                isAccepted=false;
668
                                        }
669
                                });
670
                }
671

    
672
                return bCancelar;
673
        }
674

    
675
        /**
676
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
677
         */
678
        public void viewActivated() {
679
        }
680

    
681
        /**
682
         * This method initializes bConfigurar
683
         *
684
         * @return javax.swing.JButton
685
         */
686
        private javax.swing.JButton getBConfigurar() {
687
                if (bConfigurar == null) {
688
                        bConfigurar = new javax.swing.JButton();
689
                        bConfigurar.setBounds(17, 193, 100, 20);
690
                        bConfigurar.setText(PluginServices.getText(this, "configurar"));
691
                        bConfigurar.addActionListener(new java.awt.event.ActionListener() {
692
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
693
                                                FFrameGraphicsDialog graphicsdialog = new FFrameGraphicsDialog(layout,
694
                                                                fframegraphics);
695
                                                PluginServices.getMDIManager().addWindow(graphicsdialog);
696
                                                symbol=graphicsdialog.getFSymbol();
697
                                        }
698
                                });
699
                }
700

    
701
                return bConfigurar;
702
        }
703
        private Rectangle2D getRectangle(IFFrame f){
704
                Rectangle2D.Double re= new Rectangle2D.Double();
705
                re.setRect(f.getBoundBox());
706
                Point2D p1=new Point2D.Double();
707
                Point2D p2=new Point2D.Double();
708
                Point2D p3=new Point2D.Double();
709
                Point2D p4=new Point2D.Double();
710
                double rotation=(f).getRotation();
711
                AffineTransform at=new AffineTransform();
712
                at.rotate(Math.toRadians(rotation), re.x + (re.width / 2),
713
                                re.y + (re.height / 2));
714
                at.transform(new Point2D.Double(re.getX(),re.getY()),p1);
715
                at.transform(new Point2D.Double(re.getMaxX(),re.getY()),p2);
716
                at.transform(new Point2D.Double(re.getMaxX(),re.getMaxY()),p3);
717
                at.transform(new Point2D.Double(re.getX(),re.getMaxY()),p4);
718
                if (p1.getX()<p4.getX()){
719
                        re.x=p1.getX();
720
                }else{
721
                        re.x=p4.getX();
722
                }
723
                if (p1.getY()<p2.getY()){
724
                        re.y=p1.getY();
725
                }else{
726
                        re.y=p2.getY();
727
                }
728
                if (p2.getX()>p3.getX()){
729
                        re.width=p2.getX()-re.x;
730
                }else{
731
                        re.width=p3.getX()-re.x;
732
                }
733
                if (p4.getY()>p3.getY()){
734
                        re.height=p4.getY()-re.y;
735
                }else{
736
                        re.height=p3.getY()-re.y;
737
                }
738
                return re;
739
        }
740
        public boolean isAccepted() {
741
                return isAccepted;
742
        }
743
}