Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / dialogs / FBorderDialog.java @ 2476

History | View | Annotate | Download (19.2 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.gui.layout.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
import java.util.ArrayList;
52

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

    
56
import com.iver.andami.PluginServices;
57
import com.iver.andami.ui.mdiManager.View;
58
import com.iver.andami.ui.mdiManager.ViewInfo;
59
import com.iver.cit.gvsig.gui.layout.FLayoutGraphics;
60
import com.iver.cit.gvsig.gui.layout.FLayoutUtilities;
61
import com.iver.cit.gvsig.gui.layout.Layout;
62
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGraphics;
63
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
64
import com.iver.cit.gvsig.gui.layout.fframes.dialogs.FFrameGraphicsDialog;
65

    
66

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

    
99
        /**
100
         * This is the default constructor
101
         *
102
         * @param l Referencia al Layout.
103
         */
104
        public FBorderDialog(Layout l) {
105
                super();
106
                layout = l;
107
                flg = new FLayoutGraphics(layout);
108
                fframegraphics = new FFrameGraphics();
109
                fframegraphics.setColor(Color.red);
110
                fframegraphics.update(Layout.RECTANGLESIMPLE, layout.getAT());
111

    
112
                initialize();
113
        }
114

    
115
        /**
116
         * This method initializes this
117
         */
118
        private void initialize() {
119
                for (int i = 0; i < layout.getFFrames().size(); i++) {
120
                        if (((IFFrame) layout.getFFrames().get(i)).getSelected() != IFFrame.NOSELECT) {
121
                                selecList.add(layout.getFFrames().get(i));
122
                        }
123
                }
124

    
125
                this.setLayout(null);
126
                m_NameUnit = layout.getAtributes().getNameUnit();
127
                this.add(getRbSeleccionados(), null);
128
                this.add(getRbTodos(), null);
129
                this.add(getRbMargen(), null);
130
                this.add(getChbAgrupar(), null);
131
                this.add(getPPosicion(), null);
132
                this.add(getBAceptar(), null);
133
                this.add(getBCancelar(), null);
134
                this.add(getBConfigurar(), null);
135
                this.setSize(371, 223);
136

    
137
                ButtonGroup group = new ButtonGroup();
138
                group.add(getRbSeleccionados());
139
                group.add(getRbTodos());
140
                group.add(getRbMargen());
141
        }
142

    
143
        /**
144
         * This method initializes rbSeleccionados
145
         *
146
         * @return javax.swing.JRadioButton
147
         */
148
        private javax.swing.JRadioButton getRbSeleccionados() {
149
                if (rbSeleccionados == null) {
150
                        rbSeleccionados = new javax.swing.JRadioButton();
151
                        rbSeleccionados.setBounds(10, 8, 416, 20);
152
                        rbSeleccionados.setText(PluginServices.getText(this,
153
                                        "colocar_alrededor_seleccionados"));
154

    
155
                        if (selecList.size() == 0) {
156
                                rbSeleccionados.setEnabled(false);
157
                                getRbTodos().setSelected(true);
158
                        } else {
159
                                rbSeleccionados.setSelected(true);
160
                        }
161
                }
162

    
163
                return rbSeleccionados;
164
        }
165

    
166
        /**
167
         * This method initializes rbTodos
168
         *
169
         * @return javax.swing.JRadioButton
170
         */
171
        private javax.swing.JRadioButton getRbTodos() {
172
                if (rbTodos == null) {
173
                        rbTodos = new javax.swing.JRadioButton();
174
                        rbTodos.setBounds(10, 29, 332, 20);
175
                        rbTodos.setText(PluginServices.getText(this,
176
                                        "colocar_alrededor_todos"));
177
                }
178

    
179
                return rbTodos;
180
        }
181

    
182
        /**
183
         * This method initializes rbMargen
184
         *
185
         * @return javax.swing.JRadioButton
186
         */
187
        private javax.swing.JRadioButton getRbMargen() {
188
                if (rbMargen == null) {
189
                        rbMargen = new javax.swing.JRadioButton();
190
                        rbMargen.setBounds(10, 51, 286, 20);
191
                        rbMargen.setText(PluginServices.getText(this, "colocar_a_margenes"));
192
                }
193

    
194
                return rbMargen;
195
        }
196

    
197
        /**
198
         * This method initializes chbAgrupar
199
         *
200
         * @return javax.swing.JCheckBox
201
         */
202
        private javax.swing.JCheckBox getChbAgrupar() {
203
                if (chbAgrupar == null) {
204
                        chbAgrupar = new javax.swing.JCheckBox();
205
                        chbAgrupar.setBounds(10, 70, 280, 20);
206
                        chbAgrupar.setText(PluginServices.getText(this, "agrupar_linea"));
207
                }
208

    
209
                return chbAgrupar;
210
        }
211

    
212
        /**
213
         * This method initializes pPosicion
214
         *
215
         * @return javax.swing.JPanel
216
         */
217
        private javax.swing.JPanel getPPosicion() {
218
                if (pPosicion == null) {
219
                        pPosicion = new javax.swing.JPanel();
220
                        pPosicion.setLayout(null);
221
                        pPosicion.add(getChbIgualLados(), null);
222
                        pPosicion.add(getLunidades(), null);
223
                        pPosicion.add(getTTodosLados(), null);
224
                        pPosicion.add(getLSuperior(), null);
225
                        pPosicion.add(getLInferior(), null);
226
                        pPosicion.add(getTSuperior(), null);
227
                        pPosicion.add(getTInferior(), null);
228
                        pPosicion.add(getLIzquierda(), null);
229
                        pPosicion.add(getLDerecha(), null);
230
                        pPosicion.add(getTIzquierda(), null);
231
                        pPosicion.add(getTDerecha(), null);
232
                        pPosicion.add(getLUnidades(), null);
233
                        pPosicion.setBounds(12, 92, 350, 97);
234
                        pPosicion.setBorder(javax.swing.BorderFactory.createTitledBorder(
235
                                        null, PluginServices.getText(this, "posicion_linea"),
236
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
237
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
238
                }
239

    
240
                return pPosicion;
241
        }
242

    
243
        /**
244
         * This method initializes chbIgualLados
245
         *
246
         * @return javax.swing.JCheckBox
247
         */
248
        private javax.swing.JCheckBox getChbIgualLados() {
249
                if (chbIgualLados == null) {
250
                        chbIgualLados = new javax.swing.JCheckBox();
251
                        chbIgualLados.setBounds(10, 16, 243, 21);
252
                        chbIgualLados.setText(PluginServices.getText(this,
253
                                        "igual_todos_lados"));
254
                        chbIgualLados.setSelected(true);
255
                        chbIgualLados.addActionListener(new java.awt.event.ActionListener() {
256
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
257
                                                if (!chbIgualLados.isSelected()) {
258
                                                        getTTodosLados().setEnabled(false);
259
                                                        getTSuperior().setEnabled(true);
260
                                                        getTInferior().setEnabled(true);
261
                                                        getTIzquierda().setEnabled(true);
262
                                                        getTDerecha().setEnabled(true);
263
                                                } else {
264
                                                        getTTodosLados().setEnabled(true);
265
                                                        getTSuperior().setEnabled(false);
266
                                                        getTInferior().setEnabled(false);
267
                                                        getTIzquierda().setEnabled(false);
268
                                                        getTDerecha().setEnabled(false);
269
                                                        getTSuperior().setText(tTodosLados.getText());
270
                                                        getTInferior().setText(tTodosLados.getText());
271
                                                        getTIzquierda().setText(tTodosLados.getText());
272
                                                        getTDerecha().setText(tTodosLados.getText());
273
                                                }
274
                                        }
275
                                });
276
                }
277

    
278
                return chbIgualLados;
279
        }
280

    
281
        /**
282
         * This method initializes lunidades
283
         *
284
         * @return javax.swing.JLabel
285
         */
286
        private javax.swing.JLabel getLunidades() {
287
                if (lunidades == null) {
288
                        lunidades = new javax.swing.JLabel();
289
                        lunidades.setBounds(264, 64, 78, 18);
290
                        lunidades.setText(m_NameUnit);
291
                }
292

    
293
                return lunidades;
294
        }
295

    
296
        /**
297
         * This method initializes tTodosLados
298
         *
299
         * @return javax.swing.JTextField
300
         */
301
        private javax.swing.JTextField getTTodosLados() {
302
                if (tTodosLados == null) {
303
                        tTodosLados = new javax.swing.JTextField();
304
                        tTodosLados.setBounds(267, 19, 48, 16);
305
                        tTodosLados.setText("0.5");
306
                        tTodosLados.addCaretListener(new javax.swing.event.CaretListener() {
307
                                        public void caretUpdate(javax.swing.event.CaretEvent e) {
308
                                                if (getChbIgualLados().isSelected()) {
309
                                                        getTSuperior().setText(tTodosLados.getText());
310
                                                        getTInferior().setText(tTodosLados.getText());
311
                                                        getTIzquierda().setText(tTodosLados.getText());
312
                                                        getTDerecha().setText(tTodosLados.getText());
313
                                                }
314
                                        }
315
                                });
316
                }
317

    
318
                return tTodosLados;
319
        }
320

    
321
        /**
322
         * This method initializes lSuperior
323
         *
324
         * @return javax.swing.JLabel
325
         */
326
        private javax.swing.JLabel getLSuperior() {
327
                if (lSuperior == null) {
328
                        lSuperior = new javax.swing.JLabel();
329
                        lSuperior.setBounds(10, 55, 62, 16);
330
                        lSuperior.setText(PluginServices.getText(this, "Superior"));
331
                }
332

    
333
                return lSuperior;
334
        }
335

    
336
        /**
337
         * This method initializes lInferior
338
         *
339
         * @return javax.swing.JLabel
340
         */
341
        private javax.swing.JLabel getLInferior() {
342
                if (lInferior == null) {
343
                        lInferior = new javax.swing.JLabel();
344
                        lInferior.setBounds(10, 72, 62, 16);
345
                        lInferior.setText(PluginServices.getText(this, "Inferior"));
346
                }
347

    
348
                return lInferior;
349
        }
350

    
351
        /**
352
         * This method initializes tSuperior
353
         *
354
         * @return javax.swing.JTextField
355
         */
356
        private javax.swing.JTextField getTSuperior() {
357
                if (tSuperior == null) {
358
                        tSuperior = new javax.swing.JTextField();
359
                        tSuperior.setBounds(78, 55, 48, 16);
360
                        tSuperior.setText("0.5");
361
                        tSuperior.setEnabled(false);
362
                }
363

    
364
                return tSuperior;
365
        }
366

    
367
        /**
368
         * This method initializes tInferior
369
         *
370
         * @return javax.swing.JTextField
371
         */
372
        private javax.swing.JTextField getTInferior() {
373
                if (tInferior == null) {
374
                        tInferior = new javax.swing.JTextField();
375
                        tInferior.setBounds(78, 72, 48, 16);
376
                        tInferior.setText("0.5");
377
                        tInferior.setEnabled(false);
378
                }
379

    
380
                return tInferior;
381
        }
382

    
383
        /**
384
         * This method initializes lIzquierda
385
         *
386
         * @return javax.swing.JLabel
387
         */
388
        private javax.swing.JLabel getLIzquierda() {
389
                if (lIzquierda == null) {
390
                        lIzquierda = new javax.swing.JLabel();
391
                        lIzquierda.setBounds(140, 55, 62, 16);
392
                        lIzquierda.setText(PluginServices.getText(this, "Izquierda"));
393
                }
394

    
395
                return lIzquierda;
396
        }
397

    
398
        /**
399
         * This method initializes lDerecha
400
         *
401
         * @return javax.swing.JLabel
402
         */
403
        private javax.swing.JLabel getLDerecha() {
404
                if (lDerecha == null) {
405
                        lDerecha = new javax.swing.JLabel();
406
                        lDerecha.setBounds(140, 72, 62, 16);
407
                        lDerecha.setText(PluginServices.getText(this, "Derecha"));
408
                }
409

    
410
                return lDerecha;
411
        }
412

    
413
        /**
414
         * This method initializes tIzquierda
415
         *
416
         * @return javax.swing.JTextField
417
         */
418
        private javax.swing.JTextField getTIzquierda() {
419
                if (tIzquierda == null) {
420
                        tIzquierda = new javax.swing.JTextField();
421
                        tIzquierda.setBounds(207, 55, 48, 16);
422
                        tIzquierda.setText("0.5");
423
                        tIzquierda.setEnabled(false);
424
                }
425

    
426
                return tIzquierda;
427
        }
428

    
429
        /**
430
         * This method initializes tDerecha
431
         *
432
         * @return javax.swing.JTextField
433
         */
434
        private javax.swing.JTextField getTDerecha() {
435
                if (tDerecha == null) {
436
                        tDerecha = new javax.swing.JTextField();
437
                        tDerecha.setBounds(207, 72, 48, 16);
438
                        tDerecha.setText("0.5");
439
                        tDerecha.setEnabled(false);
440
                }
441

    
442
                return tDerecha;
443
        }
444

    
445
        /**
446
         * This method initializes lUnidades
447
         *
448
         * @return javax.swing.JLabel
449
         */
450
        private javax.swing.JLabel getLUnidades() {
451
                if (lUnidades == null) {
452
                        lUnidades = new javax.swing.JLabel();
453
                        lUnidades.setBounds(207, 36, 134, 18);
454
                        lUnidades.setText(PluginServices.getText(this, "map_units"));
455
                }
456

    
457
                return lUnidades;
458
        }
459

    
460
        /**
461
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
462
         */
463
        public ViewInfo getViewInfo() {
464
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
465
                m_viewinfo.setTitle(PluginServices.getText(this, "ajustes_linea_grafica"));
466

    
467
                return m_viewinfo;
468
        }
469

    
470
        /**
471
         * This method initializes bAceptar
472
         *
473
         * @return javax.swing.JButton
474
         */
475
        private javax.swing.JButton getBAceptar() {
476
                if (bAceptar == null) {
477
                        bAceptar = new javax.swing.JButton();
478
                        bAceptar.setBounds(134, 193, 100, 20);
479
                        bAceptar.setText(PluginServices.getText(this, "Aceptar"));
480
                        bAceptar.addActionListener(new java.awt.event.ActionListener() {
481
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
482
                                                double x = Double.parseDouble(getTIzquierda().getText()
483
                                                                                                                  .toString());
484
                                                double y = Double.parseDouble(getTSuperior().getText()
485
                                                                                                                  .toString());
486
                                                double w = Double.parseDouble(getTDerecha().getText()
487
                                                                                                                  .toString());
488
                                                double h = Double.parseDouble(getTInferior().getText()
489
                                                                                                                  .toString());
490

    
491
                                                if (!getChbAgrupar().isSelected()) {
492
                                                        Rectangle2D re = new Rectangle2D.Double();
493

    
494
                                                        if (getRbSeleccionados().isSelected()) {
495
                                                                if (selecList.size() > 0) {
496
                                                                        re=getRectangle((IFFrame) selecList.get(0));
497
                                                                        
498
                                                                }
499

    
500
                                                                for (int i = 1; i < selecList.size(); i++) {
501
                                                                        Rectangle2D rectaux = getRectangle((IFFrame) selecList.get(i));
502
                                                                        re.add(rectaux);
503
                                                                }
504

    
505
                                                                //                                                crear un Rect?ngulo alrededor de los fframes seleccionados. 
506
                                                        } else if (getRbTodos().isSelected()) {
507
                                                                if (layout.getFFrames().size() > 0) {
508
                                                                        re=getRectangle((IFFrame) layout.getFFrames().get(0));
509
                                                                }
510

    
511
                                                                for (int i = 1; i < layout.getFFrames().size();
512
                                                                                i++) {
513
                                                                        Rectangle2D rectaux = getRectangle((IFFrame) layout.getFFrames()
514
                                                                                                                                                                  .get(i));
515
                                                                        re.add(rectaux);
516
                                                                }
517

    
518
                                                                //                                                creaer un Rect?ngulo que incluya a todos los fframes.
519
                                                        } else if (getRbMargen().isSelected()) {
520
                                                                //                                                creaer un Rect?ngulo en los m?rgenes del Layout.
521
                                                                re.setRect(layout.getAtributes().getArea());
522
                                                        }
523

    
524
                                                        re.setRect(re.getX() - x, re.getY() - y, re.getWidth() + x + w,
525
                                                                re.getHeight() + y + h);
526

    
527
                                                        Rectangle2D.Double rectangle = FLayoutUtilities.fromSheetRect(re,
528
                                                                        layout.getAT());
529

    
530
                                                        /*if (layout.isCuadricula()){
531
                                                           FLayoutUtilities.setRectGrid(rectangle,
532
                                                                              layout.getAtributes().getUnitInPixelsX(),layout.getAtributes().getUnitInPixelsY(), layout.getAT());
533
                                                           }
534
                                                         */
535
                                                        re = FLayoutUtilities.toSheetRect(rectangle,
536
                                                                        layout.getAT());
537
                                                        fframegraphics.setBoundBox(re);
538
                                                        layout.addFFrame(fframegraphics, true);
539
                                                } else { //Agrupar
540

    
541
                                                        Rectangle2D re = new Rectangle2D.Double();
542
                                                        //FFrameGroup fframegroup = new FFrameGroup();
543

    
544
                                                        if (getRbSeleccionados().isSelected()) {
545
                                                                if (selecList.size() > 0) {
546
                                                                        re=getRectangle((IFFrame) selecList.get(0));
547
                                                                }
548

    
549
                                                                for (int i = 1; i < selecList.size(); i++) {
550
                                                                        Rectangle2D rectaux = getRectangle((IFFrame) selecList.get(i));
551
                                                                        re.add(rectaux);
552
                                                                }
553

    
554
                                                                //                                                crear un Rect?ngulo alrededor de los fframes seleccionados. 
555
                                                        } else if (getRbTodos().isSelected()) {
556
                                                                if (layout.getFFrames().size() > 0) {
557
                                                                        re=getRectangle((IFFrame) layout.getFFrames().get(0));
558
                                                                }
559

    
560
                                                                for (int i = 1; i < layout.getFFrames().size();
561
                                                                                i++) {
562
                                                                        Rectangle2D rectaux = getRectangle((IFFrame) layout.getFFrames().get(i));
563
                                                                        ((IFFrame) layout.getFFrames().get(i)).setSelected(true);
564
                                                                        re.add(rectaux);
565
                                                                }
566

    
567
                                                                //                                                creaer un Rect?ngulo que incluya a todos los fframes.
568
                                                        } else if (getRbMargen().isSelected()) {
569
                                                                //                                                creaer un Rect?ngulo en los m?rgenes del Layout.
570
                                                                re.setRect(layout.getAtributes().getArea());
571
                                                        }
572

    
573
                                                        re.setRect(re.getX() - x, re.getY() - y, re.getWidth() + x + w,
574
                                                                re.getHeight() + y + h);
575

    
576
                                                        Rectangle2D.Double rectangle = FLayoutUtilities.fromSheetRect(re,
577
                                                                        layout.getAT());
578

    
579
                                                        /*if (layout.isCuadricula()){
580
                                                           FLayoutUtilities.setRectGrid(rectangle,
581
                                                                           layout.getAtributes().getUnitInPixelsX(),layout.getAtributes().getUnitInPixelsY(), layout.getAT());
582
                                                           }*/
583
                                                        re.setRect(FLayoutUtilities.toSheetRect(rectangle,
584
                                                                        layout.getAT()));
585
                                                        fframegraphics.setBoundBox(re);
586
                                                        layout.addFFrame(fframegraphics, false);
587
                                                        flg.grouping();
588
                                                }
589

    
590
                                                PluginServices.getMDIManager().closeView(FBorderDialog.this);
591
                                                layout.setStatus(Layout.DESACTUALIZADO);
592
                                                layout.repaint();
593
                                        }
594
                                });
595
                }
596

    
597
                return bAceptar;
598
        }
599

    
600
        /**
601
         * This method initializes bCancelar
602
         *
603
         * @return javax.swing.JButton
604
         */
605
        private javax.swing.JButton getBCancelar() {
606
                if (bCancelar == null) {
607
                        bCancelar = new javax.swing.JButton();
608
                        bCancelar.setBounds(251, 193, 100, 20);
609
                        bCancelar.setText(PluginServices.getText(this, "Cancelar"));
610
                        bCancelar.addActionListener(new java.awt.event.ActionListener() {
611
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
612
                                                PluginServices.getMDIManager().closeView(FBorderDialog.this);
613
                                        }
614
                                });
615
                }
616

    
617
                return bCancelar;
618
        }
619

    
620
        /**
621
         * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
622
         */
623
        public void viewActivated() {
624
        }
625

    
626
        /**
627
         * This method initializes bConfigurar
628
         *
629
         * @return javax.swing.JButton
630
         */
631
        private javax.swing.JButton getBConfigurar() {
632
                if (bConfigurar == null) {
633
                        bConfigurar = new javax.swing.JButton();
634
                        bConfigurar.setBounds(17, 193, 100, 20);
635
                        bConfigurar.setText(PluginServices.getText(this, "configurar"));
636
                        bConfigurar.addActionListener(new java.awt.event.ActionListener() {
637
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
638
                                                FFrameGraphicsDialog graphicsdialog = new FFrameGraphicsDialog(layout,
639
                                                                fframegraphics);
640

    
641
                                                PluginServices.getMDIManager().addView(graphicsdialog);
642
                                        }
643
                                });
644
                }
645

    
646
                return bConfigurar;
647
        }
648
        private Rectangle2D getRectangle(IFFrame f){
649
                Rectangle2D.Double re= new Rectangle2D.Double();
650
                re.setRect(f.getBoundBox());
651
                Point2D p1=new Point2D.Double();
652
                Point2D p2=new Point2D.Double();
653
                Point2D p3=new Point2D.Double();
654
                Point2D p4=new Point2D.Double();
655
                double rotation=(f).getRotation();
656
                AffineTransform at=new AffineTransform();
657
                at.rotate(Math.toRadians(rotation), re.x + (re.width / 2),
658
                                re.y + (re.height / 2));
659
                at.transform(new Point2D.Double(re.getX(),re.getY()),p1);
660
                at.transform(new Point2D.Double(re.getMaxX(),re.getY()),p2);
661
                at.transform(new Point2D.Double(re.getMaxX(),re.getMaxY()),p3);
662
                at.transform(new Point2D.Double(re.getX(),re.getMaxY()),p4);
663
                if (p1.getX()<p4.getX()){
664
                        re.x=p1.getX();
665
                }else{
666
                        re.x=p4.getX();
667
                }
668
                if (p1.getY()<p2.getY()){
669
                        re.y=p1.getY();
670
                }else{
671
                        re.y=p2.getY();
672
                }
673
                if (p2.getX()>p3.getX()){
674
                        re.width=p2.getX()-re.x;
675
                }else{
676
                        re.width=p3.getX()-re.x;
677
                }
678
                if (p4.getY()>p3.getY()){
679
                        re.height=p4.getY()-re.y;
680
                }else{
681
                        re.height=p3.getY()-re.y;
682
                }
683
                return re;
684
        }
685
}