Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / fframes / gui / dialogs / FFrameGraphicsDialog.java @ 9392

History | View | Annotate | Download (7.04 KB)

1
/*
2
 * Created on 02-ago-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.fframes.gui.dialogs;
46

    
47
import java.awt.geom.Rectangle2D;
48

    
49
import com.iver.andami.PluginServices;
50
import com.iver.andami.ui.mdiManager.WindowInfo;
51
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
52
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
53
import com.iver.cit.gvsig.project.documents.layout.FLayoutUtilities;
54
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGraphics;
55
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame;
56
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.JPRotation;
57
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
58
import com.iver.cit.gvsig.project.documents.view.legend.gui.FPanelLegendDefault;
59

    
60

    
61
/**
62
 * Di?logo de las propiedades de los gr?ficos.
63
 *
64
 * @author Vicente Caballero Navarro
65
 */
66
public class FFrameGraphicsDialog extends FPanelLegendDefault
67
        implements IFFrameDialog {
68
        private Rectangle2D rect = new Rectangle2D.Double();
69
        private Layout m_layout = null; //  @jve:visual-info  decl-index=0 visual-constraint="393,10"
70
        private boolean isAcepted = false;
71
        private FFrameGraphics fframegraphics = null;
72
        private javax.swing.JButton bAceptar = null;
73
        private javax.swing.JButton bCancelar = null;
74
        private JPRotation pRotation = null;
75
        private FFrameGraphics newFFrameGraphics;
76

    
77

    
78
        /**
79
         * Crea un nuevo FFrameGraphicsDialog.
80
         *
81
         * @param layout Referencia al Layout.
82
         * @param fframe Referencia al fframe de gr?fico.
83
         */
84
        public FFrameGraphicsDialog(Layout layout, FFrameGraphics fframe) {
85
                m_layout = layout;
86
                fframegraphics = fframe;
87
                setFSymbol((FSymbol) fframegraphics.getFSymbol());
88
                //fillCheckBox.setSelected(false);
89

    
90
                initialize();
91
                if (getFSymbol().getSymbolType()==FConstant.SHAPE_TYPE_POINT){
92
                        this.getJPanelPoint().setVisible(true);
93
                }else{
94
                this.getJPanelPoint().setVisible(false);
95
                }
96
        }
97

    
98
        /**
99
         * This method initializes this
100
         */
101
        private void initialize() {
102
                this.add(getBAceptar(), null);
103
                this.add(getBCancelar(), null);
104
                this.setSize(582, 373);
105
                this.add(getPRotation(), null);
106
                getPRotation().setRotation(fframegraphics.getRotation());
107
        }
108

    
109
        /**
110
         * @see com.iver.mdiApp.ui.MDIManager.SingletonWindow#getWindowModel()
111
         */
112
        public Object getViewModel() {
113
                return "FPanelLegendDefault";
114
        }
115

    
116
        /**
117
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
118
         */
119
        public WindowInfo getWindowInfo() {
120
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
121
                m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_grafico"));
122

    
123
                return m_viewinfo;
124
        }
125

    
126
        /**
127
         * @see com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#setRectangle(java.awt.geom.Rectangle2D)
128
         */
129
        public void setRectangle(Rectangle2D r) {
130
                rect.setRect(r);
131
        }
132

    
133
        /**
134
         * @see com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
135
         */
136
        public boolean getIsAcepted() {
137
                return isAcepted;
138
        }
139

    
140
        /**
141
         * This method initializes bAceptar
142
         *
143
         * @return javax.swing.JButton
144
         */
145
        private javax.swing.JButton getBAceptar() {
146
                if (bAceptar == null) {
147
                        bAceptar = new javax.swing.JButton();
148
                        bAceptar.setBounds(85, 326, 122, 28);
149
                        bAceptar.setText(PluginServices.getText(this, "Aceptar"));
150
                        bAceptar.addActionListener(new java.awt.event.ActionListener() {
151

    
152
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
153
                                                if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT) {
154
                                                        updateControls(false); // Para que lo que haya en
155
                                                }
156
                                                newFFrameGraphics=(FFrameGraphics)fframegraphics.cloneFFrame(m_layout);
157
//                                                FFrameGraphics fframeAux=(FFrameGraphics)fframegraphics.cloneFFrame(m_layout);
158
//                                                fframeAux.setBoundBox(fframegraphics.getBoundBox());
159
//                                                if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
160
//                                                fframeAux.setSize(FLayoutUtilities.toSheetDistance(Integer.parseInt(getJTextField().getText()),m_layout.getLayoutControl().getAT()));
161
//                                                fframeAux.setFSymbol(getFSymbol());
162
//                                                fframeAux.setRotation(getPRotation().getRotation());
163
                                                //boolean exists=m_layout.getLayoutContext().getEFS().modifyFFrame(fframegraphics,fframeAux);
164
                                                //if (!exists) {
165
                                                        newFFrameGraphics.setBoundBox(fframegraphics.getBoundBox());
166
                                                        if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
167
                                                                newFFrameGraphics.setSize(FLayoutUtilities.toSheetDistance(Integer.parseInt(getJTextField().getText()),m_layout.getLayoutControl().getAT()));
168
                                                        newFFrameGraphics.setFSymbol(getFSymbol());
169
                                                        newFFrameGraphics.setRotation(getPRotation().getRotation());
170
                                                //}
171
//                                                boolean exists=m_layout.getLayoutContext().getEFS().modifyFFrame(fframegraphics,fframeAux);
172
                                                m_layout.getLayoutContext().updateFFrames();
173
                                                m_layout.getLayoutControl().refresh();
174
                                                isAcepted = true;
175
                                                PluginServices.getMDIManager().closeWindow(FFrameGraphicsDialog.this);
176

    
177

    
178
                                        }
179
                                });
180
                }
181

    
182
                return bAceptar;
183
        }
184

    
185
        /**
186
         * This method initializes bCancelar
187
         *
188
         * @return javax.swing.JButton
189
         */
190
        private javax.swing.JButton getBCancelar() {
191
                if (bCancelar == null) {
192
                        bCancelar = new javax.swing.JButton();
193
                        bCancelar.setBounds(292, 326, 122, 28);
194
                        bCancelar.setText(PluginServices.getText(this, "Cancelar"));
195
                        bCancelar.addActionListener(new java.awt.event.ActionListener() {
196
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
197
                                                PluginServices.getMDIManager().closeWindow(FFrameGraphicsDialog.this);
198
                                        }
199
                                });
200
                }
201

    
202
                return bCancelar;
203
        }
204

    
205
        /**
206
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
207
         */
208
        public void viewActivated() {
209
        }
210

    
211
        /**
212
         * This method initializes pRotation
213
         *
214
         * @return javax.swing.JPanel
215
         */
216
        private JPRotation getPRotation() {
217
                if (pRotation == null) {
218
                        pRotation = new JPRotation();
219
                        pRotation.setBounds(415, 156, 120, 120);
220
                }
221
                return pRotation;
222
        }
223

    
224
        public IFFrame getFFrame() {
225
                return newFFrameGraphics;
226
        }
227
}  //  @jve:decl-index=0:visual-constraint="10,10"