Statistics
| Revision:

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

History | View | Annotate | Download (6.33 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.gui.layout.fframes.dialogs;
46

    
47
import java.awt.geom.Rectangle2D;
48

    
49
import com.iver.andami.PluginServices;
50
import com.iver.andami.ui.mdiManager.ViewInfo;
51
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
52
import com.iver.cit.gvsig.gui.layout.FLayoutUtilities;
53
import com.iver.cit.gvsig.gui.layout.Layout;
54
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGraphics;
55
import com.iver.cit.gvsig.gui.thememanager.legendmanager.panels.FPanelLegendDefault;
56

    
57

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

    
73
        /**
74
         * Crea un nuevo FFrameGraphicsDialog.
75
         *
76
         * @param layout Referencia al Layout.
77
         * @param fframe Referencia al fframe de gr?fico.
78
         */
79
        public FFrameGraphicsDialog(Layout layout, FFrameGraphics fframe) {
80
                m_layout = layout;
81
                fframegraphics = fframe;
82
                setFSymbol(fframegraphics.getFSymbol());
83
                //fillCheckBox.setSelected(false);
84

    
85
                initialize();
86
                if (getFSymbol().getSymbolType()==FConstant.SHAPE_TYPE_POINT){
87
                        this.getJPanelPoint().setVisible(true);
88
                }else{
89
                this.getJPanelPoint().setVisible(false);
90
                }
91
        }
92

    
93
        /**
94
         * This method initializes this
95
         */
96
        private void initialize() {
97
                this.add(getBAceptar(), null);
98
                this.add(getBCancelar(), null);
99
                this.setSize(582, 373);
100
                this.add(getPRotation(), null);
101
                getPRotation().setRotation(fframegraphics.getRotation());
102
        }
103

    
104
        /**
105
         * @see com.iver.mdiApp.ui.MDIManager.SingletonView#getViewModel()
106
         */
107
        public Object getViewModel() {
108
                return "FPanelLegendDefault";
109
        }
110

    
111
        /**
112
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#getViewInfo()
113
         */
114
        public ViewInfo getViewInfo() {
115
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
116
                m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_grafico"));
117

    
118
                return m_viewinfo;
119
        }
120

    
121
        /**
122
         * @see com.iver.cit.gvsig.gui.layout.fframes.dialogs.IFFrameDialog#setRectangle(java.awt.geom.Rectangle2D)
123
         */
124
        public void setRectangle(Rectangle2D r) {
125
                rect.setRect(r);
126
        }
127

    
128
        /**
129
         * @see com.iver.cit.gvsig.gui.layout.fframes.dialogs.IFFrameDialog#getIsAcepted()
130
         */
131
        public boolean getIsAcepted() {
132
                return isAcepted;
133
        }
134

    
135
        /**
136
         * This method initializes bAceptar
137
         *
138
         * @return javax.swing.JButton
139
         */
140
        private javax.swing.JButton getBAceptar() {
141
                if (bAceptar == null) {
142
                        bAceptar = new javax.swing.JButton();
143
                        bAceptar.setBounds(85, 326, 122, 28);
144
                        bAceptar.setText(PluginServices.getText(this, "Aceptar"));
145
                        bAceptar.addActionListener(new java.awt.event.ActionListener() {
146
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
147
                                                if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT) {
148
                                                        updateControls(false); // Para que lo que haya en
149
                                                }
150

    
151
                                                FFrameGraphics fframeAux=(FFrameGraphics)fframegraphics.cloneFFrame(m_layout);
152
                                                fframeAux.setBoundBox(fframegraphics.getBoundBox());
153
                                                if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
154
                                                fframeAux.setSize(FLayoutUtilities.toSheetDistance(Integer.parseInt(getJTextField().getText()),m_layout.getAT()));
155
                                                fframeAux.setFSymbol(getFSymbol());
156
                                                fframeAux.setRotation(getPRotation().getRotation());
157
                                                boolean exists=m_layout.getEFS().modifyFFrame(fframegraphics,fframeAux);
158
                                                if (!exists) {
159
                                                        fframegraphics.setBoundBox(fframegraphics.getBoundBox());
160
                                                        if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
161
                                                        fframegraphics.setSize(FLayoutUtilities.toSheetDistance(Integer.parseInt(getJTextField().getText()),m_layout.getAT()));
162
                                                        fframegraphics.setFSymbol(getFSymbol());
163
                                                        fframegraphics.setRotation(getPRotation().getRotation());
164
                                                }
165
                                                m_layout.updateFFrames();
166
                                                m_layout.refresh();
167
                                                isAcepted = true;
168
                                                PluginServices.getMDIManager().closeView(FFrameGraphicsDialog.this);
169

    
170

    
171
                                        }
172
                                });
173
                }
174

    
175
                return bAceptar;
176
        }
177

    
178
        /**
179
         * This method initializes bCancelar
180
         *
181
         * @return javax.swing.JButton
182
         */
183
        private javax.swing.JButton getBCancelar() {
184
                if (bCancelar == null) {
185
                        bCancelar = new javax.swing.JButton();
186
                        bCancelar.setBounds(292, 326, 122, 28);
187
                        bCancelar.setText(PluginServices.getText(this, "Cancelar"));
188
                        bCancelar.addActionListener(new java.awt.event.ActionListener() {
189
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
190
                                                PluginServices.getMDIManager().closeView(FFrameGraphicsDialog.this);
191
                                        }
192
                                });
193
                }
194

    
195
                return bCancelar;
196
        }
197

    
198
        /**
199
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#viewActivated()
200
         */
201
        public void viewActivated() {
202
        }
203

    
204
        /**
205
         * This method initializes pRotation
206
         *
207
         * @return javax.swing.JPanel
208
         */
209
        private JPRotation getPRotation() {
210
                if (pRotation == null) {
211
                        pRotation = new JPRotation();
212
                        pRotation.setBounds(415, 156, 120, 120);
213
                }
214
                return pRotation;
215
        }
216
}  //  @jve:decl-index=0:visual-constraint="10,10"