root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / fframes / gui / dialogs / FFrameGraphicsDialog.java @ 7304
History | View | Annotate | Download (6.49 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.gui.layout.Layout; |
53 |
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGraphics; |
54 |
import com.iver.cit.gvsig.project.documents.layout.FLayoutUtilities; |
55 |
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.JPRotation; |
56 |
import com.iver.cit.gvsig.project.documents.view.legend.gui.FPanelLegendDefault; |
57 |
|
58 |
|
59 |
/**
|
60 |
* Di?logo de las propiedades de los gr?ficos.
|
61 |
*
|
62 |
* @author Vicente Caballero Navarro
|
63 |
*/
|
64 |
public class FFrameGraphicsDialog extends FPanelLegendDefault |
65 |
implements IFFrameDialog {
|
66 |
private Rectangle2D rect = new Rectangle2D.Double(); |
67 |
private Layout m_layout = null; // @jve:visual-info decl-index=0 visual-constraint="393,10" |
68 |
private boolean isAcepted = false; |
69 |
private FFrameGraphics fframegraphics = null; |
70 |
private javax.swing.JButton bAceptar = null; |
71 |
private javax.swing.JButton bCancelar = null; |
72 |
private JPRotation pRotation = null; |
73 |
|
74 |
/**
|
75 |
* Crea un nuevo FFrameGraphicsDialog.
|
76 |
*
|
77 |
* @param layout Referencia al Layout.
|
78 |
* @param fframe Referencia al fframe de gr?fico.
|
79 |
*/
|
80 |
public FFrameGraphicsDialog(Layout layout, FFrameGraphics fframe) {
|
81 |
m_layout = layout; |
82 |
fframegraphics = fframe; |
83 |
setFSymbol(fframegraphics.getFSymbol()); |
84 |
//fillCheckBox.setSelected(false);
|
85 |
|
86 |
initialize(); |
87 |
if (getFSymbol().getSymbolType()==FConstant.SHAPE_TYPE_POINT){
|
88 |
this.getJPanelPoint().setVisible(true); |
89 |
}else{
|
90 |
this.getJPanelPoint().setVisible(false); |
91 |
} |
92 |
} |
93 |
|
94 |
/**
|
95 |
* This method initializes this
|
96 |
*/
|
97 |
private void initialize() { |
98 |
this.add(getBAceptar(), null); |
99 |
this.add(getBCancelar(), null); |
100 |
this.setSize(582, 373); |
101 |
this.add(getPRotation(), null); |
102 |
getPRotation().setRotation(fframegraphics.getRotation()); |
103 |
} |
104 |
|
105 |
/**
|
106 |
* @see com.iver.mdiApp.ui.MDIManager.SingletonWindow#getWindowModel()
|
107 |
*/
|
108 |
public Object getViewModel() { |
109 |
return "FPanelLegendDefault"; |
110 |
} |
111 |
|
112 |
/**
|
113 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
114 |
*/
|
115 |
public WindowInfo getWindowInfo() {
|
116 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
117 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_grafico")); |
118 |
|
119 |
return m_viewinfo;
|
120 |
} |
121 |
|
122 |
/**
|
123 |
* @see com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#setRectangle(java.awt.geom.Rectangle2D)
|
124 |
*/
|
125 |
public void setRectangle(Rectangle2D r) { |
126 |
rect.setRect(r); |
127 |
} |
128 |
|
129 |
/**
|
130 |
* @see com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
|
131 |
*/
|
132 |
public boolean getIsAcepted() { |
133 |
return isAcepted;
|
134 |
} |
135 |
|
136 |
/**
|
137 |
* This method initializes bAceptar
|
138 |
*
|
139 |
* @return javax.swing.JButton
|
140 |
*/
|
141 |
private javax.swing.JButton getBAceptar() {
|
142 |
if (bAceptar == null) { |
143 |
bAceptar = new javax.swing.JButton();
|
144 |
bAceptar.setBounds(85, 326, 122, 28); |
145 |
bAceptar.setText(PluginServices.getText(this, "Aceptar")); |
146 |
bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
147 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
148 |
if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT) {
|
149 |
updateControls(false); // Para que lo que haya en |
150 |
} |
151 |
|
152 |
FFrameGraphics fframeAux=(FFrameGraphics)fframegraphics.cloneFFrame(m_layout); |
153 |
fframeAux.setBoundBox(fframegraphics.getBoundBox()); |
154 |
if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
|
155 |
fframeAux.setSize(FLayoutUtilities.toSheetDistance(Integer.parseInt(getJTextField().getText()),m_layout.getAT()));
|
156 |
fframeAux.setFSymbol(getFSymbol()); |
157 |
fframeAux.setRotation(getPRotation().getRotation()); |
158 |
boolean exists=m_layout.getEFS().modifyFFrame(fframegraphics,fframeAux);
|
159 |
if (!exists) {
|
160 |
fframegraphics.setBoundBox(fframegraphics.getBoundBox()); |
161 |
if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
|
162 |
fframegraphics.setSize(FLayoutUtilities.toSheetDistance(Integer.parseInt(getJTextField().getText()),m_layout.getAT()));
|
163 |
fframegraphics.setFSymbol(getFSymbol()); |
164 |
fframegraphics.setRotation(getPRotation().getRotation()); |
165 |
} |
166 |
m_layout.updateFFrames(); |
167 |
m_layout.refresh(); |
168 |
isAcepted = true;
|
169 |
PluginServices.getMDIManager().closeWindow(FFrameGraphicsDialog.this); |
170 |
|
171 |
|
172 |
} |
173 |
}); |
174 |
} |
175 |
|
176 |
return bAceptar;
|
177 |
} |
178 |
|
179 |
/**
|
180 |
* This method initializes bCancelar
|
181 |
*
|
182 |
* @return javax.swing.JButton
|
183 |
*/
|
184 |
private javax.swing.JButton getBCancelar() {
|
185 |
if (bCancelar == null) { |
186 |
bCancelar = new javax.swing.JButton();
|
187 |
bCancelar.setBounds(292, 326, 122, 28); |
188 |
bCancelar.setText(PluginServices.getText(this, "Cancelar")); |
189 |
bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
190 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
191 |
PluginServices.getMDIManager().closeWindow(FFrameGraphicsDialog.this); |
192 |
} |
193 |
}); |
194 |
} |
195 |
|
196 |
return bCancelar;
|
197 |
} |
198 |
|
199 |
/**
|
200 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
201 |
*/
|
202 |
public void viewActivated() { |
203 |
} |
204 |
|
205 |
/**
|
206 |
* This method initializes pRotation
|
207 |
*
|
208 |
* @return javax.swing.JPanel
|
209 |
*/
|
210 |
private JPRotation getPRotation() {
|
211 |
if (pRotation == null) { |
212 |
pRotation = new JPRotation();
|
213 |
pRotation.setBounds(415, 156, 120, 120); |
214 |
} |
215 |
return pRotation;
|
216 |
} |
217 |
} // @jve:decl-index=0:visual-constraint="10,10"
|