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 312 fernando
/*
2
 * Created on 02-ago-2004
3
 *
4
 */
5 1103 fjp
/* 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 312 fernando
package com.iver.cit.gvsig.gui.layout.fframes.dialogs;
46
47 2209 vcaballero
import java.awt.geom.Rectangle2D;
48
49 596 fernando
import com.iver.andami.PluginServices;
50
import com.iver.andami.ui.mdiManager.ViewInfo;
51 1074 vcaballero
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
52 3553 caballero
import com.iver.cit.gvsig.gui.layout.FLayoutUtilities;
53 312 fernando
import com.iver.cit.gvsig.gui.layout.Layout;
54
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGraphics;
55 2209 vcaballero
import com.iver.cit.gvsig.gui.thememanager.legendmanager.panels.FPanelLegendDefault;
56 312 fernando
57 1074 vcaballero
58 312 fernando
/**
59 1074 vcaballero
 * Di?logo de las propiedades de los gr?ficos.
60
 *
61 312 fernando
 * @author Vicente Caballero Navarro
62
 */
63 1074 vcaballero
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 312 fernando
        private javax.swing.JButton bAceptar = null;
70
        private javax.swing.JButton bCancelar = null;
71 2305 vcaballero
        private JPRotation pRotation = null;
72 1074 vcaballero
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 2589 caballero
                //fillCheckBox.setSelected(false);
84 1074 vcaballero
85 312 fernando
                initialize();
86 2434 caballero
                if (getFSymbol().getSymbolType()==FConstant.SHAPE_TYPE_POINT){
87
                        this.getJPanelPoint().setVisible(true);
88
                }else{
89 1321 vcaballero
                this.getJPanelPoint().setVisible(false);
90 2434 caballero
                }
91 312 fernando
        }
92 1074 vcaballero
93 312 fernando
        /**
94
         * This method initializes this
95
         */
96
        private void initialize() {
97 1074 vcaballero
                this.add(getBAceptar(), null);
98
                this.add(getBCancelar(), null);
99 2737 caballero
                this.setSize(582, 373);
100 2305 vcaballero
                this.add(getPRotation(), null);
101
                getPRotation().setRotation(fframegraphics.getRotation());
102 312 fernando
        }
103 1074 vcaballero
104 312 fernando
        /**
105 1074 vcaballero
         * @see com.iver.mdiApp.ui.MDIManager.SingletonView#getViewModel()
106
         */
107
        public Object getViewModel() {
108
                return "FPanelLegendDefault";
109
        }
110 312 fernando
111 1074 vcaballero
        /**
112 6877 cesar
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#getViewInfo()
113 1074 vcaballero
         */
114
        public ViewInfo getViewInfo() {
115
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
116
                m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_grafico"));
117 312 fernando
118 1074 vcaballero
                return m_viewinfo;
119
        }
120 312 fernando
121 1074 vcaballero
        /**
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 312 fernando
        public boolean getIsAcepted() {
132 1074 vcaballero
                return isAcepted;
133
        }
134
135 312 fernando
        /**
136
         * This method initializes bAceptar
137 1074 vcaballero
         *
138 312 fernando
         * @return javax.swing.JButton
139
         */
140
        private javax.swing.JButton getBAceptar() {
141 1074 vcaballero
                if (bAceptar == null) {
142 312 fernando
                        bAceptar = new javax.swing.JButton();
143
                        bAceptar.setBounds(85, 326, 122, 28);
144 1074 vcaballero
                        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 5928 caballero
                                                        updateControls(false); // Para que lo que haya en
149 1074 vcaballero
                                                }
150
151 3553 caballero
                                                FFrameGraphics fframeAux=(FFrameGraphics)fframegraphics.cloneFFrame(m_layout);
152
                                                fframeAux.setBoundBox(fframegraphics.getBoundBox());
153 5928 caballero
                                                if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
154 3553 caballero
                                                fframeAux.setSize(FLayoutUtilities.toSheetDistance(Integer.parseInt(getJTextField().getText()),m_layout.getAT()));
155
                                                fframeAux.setFSymbol(getFSymbol());
156
                                                fframeAux.setRotation(getPRotation().getRotation());
157 5928 caballero
                                                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 3553 caballero
                                                m_layout.updateFFrames();
166 1074 vcaballero
                                                m_layout.refresh();
167
                                                isAcepted = true;
168 6604 caballero
                                                PluginServices.getMDIManager().closeView(FFrameGraphicsDialog.this);
169
170
171 312 fernando
                                        }
172 1074 vcaballero
                                });
173
                }
174 312 fernando
175
                return bAceptar;
176
        }
177 1074 vcaballero
178 312 fernando
        /**
179
         * This method initializes bCancelar
180 1074 vcaballero
         *
181 312 fernando
         * @return javax.swing.JButton
182
         */
183
        private javax.swing.JButton getBCancelar() {
184 1074 vcaballero
                if (bCancelar == null) {
185 312 fernando
                        bCancelar = new javax.swing.JButton();
186
                        bCancelar.setBounds(292, 326, 122, 28);
187 1074 vcaballero
                        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 312 fernando
                }
194 1074 vcaballero
195 312 fernando
                return bCancelar;
196
        }
197 1074 vcaballero
198 312 fernando
        /**
199 6877 cesar
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#viewActivated()
200 312 fernando
         */
201
        public void viewActivated() {
202
        }
203 2305 vcaballero
204
        /**
205 5928 caballero
         * This method initializes pRotation
206
         *
207
         * @return javax.swing.JPanel
208
         */
209 2305 vcaballero
        private JPRotation getPRotation() {
210
                if (pRotation == null) {
211
                        pRotation = new JPRotation();
212 2737 caballero
                        pRotation.setBounds(415, 156, 120, 120);
213 2305 vcaballero
                }
214
                return pRotation;
215
        }
216 2737 caballero
}  //  @jve:decl-index=0:visual-constraint="10,10"