Statistics
| Revision:

root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / layout / fframes / gui / dialogs / FFrameGroupDialog.java @ 31496

History | View | Annotate | Download (4.6 KB)

1
package org.gvsig.app.project.documents.layout.fframes.gui.dialogs;
2

    
3
import java.awt.geom.Rectangle2D;
4

    
5
import javax.swing.JPanel;
6

    
7
import org.gvsig.andami.PluginServices;
8
import org.gvsig.andami.ui.mdiManager.WindowInfo;
9
import org.gvsig.app.project.documents.layout.FLayoutUtilities;
10
import org.gvsig.app.project.documents.layout.fframes.FFrameGroup;
11
import org.gvsig.app.project.documents.layout.fframes.IFFrame;
12
import org.gvsig.app.project.documents.layout.fframes.gui.JPRotation;
13
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
14

    
15

    
16

    
17
/**
18
 * Di?logo de un grupo de fframe del Layout.
19
 *
20
 * @author Vicente Caballero Navarro
21
 */
22
public class FFrameGroupDialog extends JPanel implements IFFrameDialog {
23
        private javax.swing.JPanel jContentPane = null;
24
        private javax.swing.JButton bAceptar = null;
25
        private javax.swing.JButton bCancelar = null;
26
        private Rectangle2D rect = new Rectangle2D.Double();
27
        private FFrameGroup fframegroup = null;
28
        private LayoutPanel m_layout = null;
29
        private boolean isAcepted = false;
30
        private JPRotation pRotation = null;
31
        private FFrameGroup newFFrameGroup;
32

    
33

    
34
        /**
35
         * This is the default constructor
36
         *
37
         * @param layout Referencia al Layout.
38
         * @param fframe Referencia al fframe de imagen.
39
         */
40
        public FFrameGroupDialog(LayoutPanel layout, FFrameGroup fframe) {
41
                super();
42
                fframegroup = fframe;
43
                m_layout = layout;
44
                initialize();
45
        }
46

    
47
        /**
48
         * Inserta el rect?ngulo que ocupar? el fframe de imagen.
49
         *
50
         * @param r Rect?ngulo.
51
         */
52
        public void setRectangle(Rectangle2D r) {
53
                rect.setRect(r);
54
        }
55

    
56
        /**
57
         * This method initializes this
58
         */
59
        private void initialize() {
60
                this.setLayout(null);
61
                this.add(getJContentPane(), null);
62
                this.setSize(196, 191);
63
                getPRotation().setRotation(fframegroup.getRotation());
64
        }
65

    
66
        /**
67
         * This method initializes jContentPane
68
         *
69
         * @return javax.swing.JPanel
70
         */
71
        private javax.swing.JPanel getJContentPane() {
72
                if (jContentPane == null) {
73
                        jContentPane = new javax.swing.JPanel();
74
                        jContentPane.setLayout(null);
75
                        jContentPane.add(getBAceptar(), null);
76
                        jContentPane.add(getBCancelar(), null);
77
                        jContentPane.setSize(192, 186);
78
                        jContentPane.setLocation(0, 0);
79
                        jContentPane.add(getPRotation(), null);
80
                }
81

    
82
                return jContentPane;
83
        }
84

    
85
        /**
86
         * This method initializes bAceptar
87
         *
88
         * @return javax.swing.JButton
89
         */
90
        private javax.swing.JButton getBAceptar() {
91
                if (bAceptar == null) {
92
                        bAceptar = new javax.swing.JButton();
93
                        bAceptar.setSize(85, 26);
94
                        bAceptar.setText(PluginServices.getText(this, "Aceptar"));
95
                        bAceptar.setLocation(7, 147);
96
                        bAceptar.addActionListener(new java.awt.event.ActionListener() {
97

    
98
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
99
                                                  newFFrameGroup=(FFrameGroup)fframegroup.cloneFFrame(m_layout);
100
                                                  newFFrameGroup.setBoundBox(FLayoutUtilities.toSheetRect(
101
                                                                rect, m_layout.getLayoutControl().getAT()));
102
                                                  newFFrameGroup.setRotation(getPRotation().getRotation());
103
                                                PluginServices.getMDIManager().closeWindow(FFrameGroupDialog.this);
104
                                                //m_layout.refresh();
105
                                                isAcepted = true;
106
                                        }
107
                                });
108
                }
109

    
110
                return bAceptar;
111
        }
112

    
113
        /**
114
         * This method initializes bCancelar
115
         *
116
         * @return javax.swing.JButton
117
         */
118
        private javax.swing.JButton getBCancelar() {
119
                if (bCancelar == null) {
120
                        bCancelar = new javax.swing.JButton();
121
                        bCancelar.setSize(85, 26);
122
                        bCancelar.setText(PluginServices.getText(this, "Cancelar"));
123
                        bCancelar.setLocation(99, 147);
124
                        bCancelar.addActionListener(new java.awt.event.ActionListener() {
125
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
126
                                                PluginServices.getMDIManager().closeWindow(FFrameGroupDialog.this);
127
                                        }
128
                                });
129
                }
130

    
131
                return bCancelar;
132
        }
133

    
134
        /* (non-Javadoc)
135
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
136
         */
137
        public WindowInfo getWindowInfo() {
138
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
139
                m_viewinfo.setTitle(PluginServices.getText(this,
140
                                "propiedades_marco_imagenes"));
141

    
142
                return m_viewinfo;
143
        }
144

    
145
        /**
146
         * @see org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
147
         */
148
        public boolean getIsAcepted() {
149
                return isAcepted;
150
        }
151

    
152
        /**
153
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
154
         */
155
        public void viewActivated() {
156
        }
157

    
158
        /**
159
         * This method initializes pRotation
160
         *
161
         * @return javax.swing.JPanel
162
         */
163
        private JPRotation getPRotation() {
164
                if (pRotation == null) {
165
                        pRotation = new JPRotation();
166
                        pRotation.setBounds(30, 10, 120, 120);
167
                }
168
                return pRotation;
169
        }
170

    
171
        public IFFrame getFFrame() {
172
                return newFFrameGroup;
173
        }
174

    
175
        public Object getWindowProfile() {
176
                return WindowInfo.DIALOG_PROFILE;
177
        }
178

    
179
}  //  @jve:decl-index=0:visual-constraint="10,10"
180