root / tags / v10_RC2c / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / selectPoints / ErrorPointPanel.java @ 8745
History | View | Annotate | Download (8.87 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
package org.gvsig.georeferencing.gui.selectPoints; |
20 |
|
21 |
import java.awt.Color; |
22 |
import java.awt.FlowLayout; |
23 |
import java.awt.GridBagConstraints; |
24 |
import java.awt.GridBagLayout; |
25 |
import java.awt.Insets; |
26 |
|
27 |
import javax.swing.JLabel; |
28 |
import javax.swing.JPanel; |
29 |
import javax.swing.JTextField; |
30 |
|
31 |
import com.iver.andami.PluginServices; |
32 |
/**
|
33 |
* Panel que contiene la informaci?n de cada punto.
|
34 |
* No contiene eventos, estos deben ser manejados desde la
|
35 |
* clase que lo llame.
|
36 |
*
|
37 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
38 |
*
|
39 |
*/
|
40 |
public class ErrorPointPanel extends JPanel{ |
41 |
|
42 |
private JPanel pInfoPoint = null; |
43 |
private JPanel pX = null; |
44 |
private JPanel pY = null; |
45 |
private JPanel pRms = null; |
46 |
private JPanel pTotal = null; |
47 |
private JTextField tResX = null; |
48 |
private JLabel lX = null; |
49 |
private JLabel lY = null; |
50 |
private JTextField tResY = null; |
51 |
private JLabel lRms = null; |
52 |
private JLabel lTotal = null; |
53 |
private JTextField tTotal = null; |
54 |
private JTextField tRms = null; |
55 |
|
56 |
|
57 |
|
58 |
private JPanel pError = null; |
59 |
/**
|
60 |
* This is the default constructor
|
61 |
*/
|
62 |
public ErrorPointPanel() {
|
63 |
super();
|
64 |
initialize(); |
65 |
} |
66 |
|
67 |
/**
|
68 |
* This method initializes this
|
69 |
*
|
70 |
* @return void
|
71 |
*/
|
72 |
private void initialize() { |
73 |
GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
74 |
GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); |
75 |
gridBagConstraints6.insets = new java.awt.Insets(0,0,0,0); |
76 |
gridBagConstraints6.gridy = 1;
|
77 |
gridBagConstraints6.gridx = 0;
|
78 |
|
79 |
this.setLayout(new GridBagLayout()); |
80 |
this.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0)); |
81 |
this.setSize(new java.awt.Dimension(175,125)); |
82 |
this.setPreferredSize(new java.awt.Dimension(175,125)); |
83 |
gridBagConstraints4.gridx = 0;
|
84 |
gridBagConstraints4.gridy = 0;
|
85 |
this.add(getPTotal(), gridBagConstraints6);
|
86 |
this.add(getPError(), gridBagConstraints4);
|
87 |
} |
88 |
|
89 |
/**
|
90 |
* This method initializes pX
|
91 |
*
|
92 |
* @return javax.swing.JPanel
|
93 |
*/
|
94 |
private JPanel getPX() { |
95 |
if (pX == null) { |
96 |
lX = new JLabel(); |
97 |
lX.setText("Res X: ");
|
98 |
lX.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12)); |
99 |
FlowLayout flowLayout2 = new FlowLayout(); |
100 |
flowLayout2.setAlignment(java.awt.FlowLayout.RIGHT); |
101 |
pX = new JPanel(); |
102 |
pX.setLayout(flowLayout2); |
103 |
pX.setPreferredSize(new java.awt.Dimension(140,20)); |
104 |
flowLayout2.setHgap(0);
|
105 |
flowLayout2.setVgap(1);
|
106 |
pX.add(lX, null);
|
107 |
pX.add(getTResX(), null);
|
108 |
} |
109 |
return pX;
|
110 |
} |
111 |
|
112 |
/**
|
113 |
* This method initializes pY
|
114 |
*
|
115 |
* @return javax.swing.JPanel
|
116 |
*/
|
117 |
private JPanel getPY() { |
118 |
if (pY == null) { |
119 |
lY = new JLabel(); |
120 |
lY.setText("Res Y:");
|
121 |
lY.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12)); |
122 |
FlowLayout flowLayout1 = new FlowLayout(); |
123 |
flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT); |
124 |
pY = new JPanel(); |
125 |
pY.setLayout(flowLayout1); |
126 |
pY.setPreferredSize(new java.awt.Dimension(140,20)); |
127 |
flowLayout1.setHgap(0);
|
128 |
flowLayout1.setVgap(1);
|
129 |
pY.add(lY, null);
|
130 |
pY.add(getTResY(), null);
|
131 |
} |
132 |
return pY;
|
133 |
} |
134 |
|
135 |
/**
|
136 |
* This method initializes pLatitud
|
137 |
*
|
138 |
* @return javax.swing.JPanel
|
139 |
*/
|
140 |
private JPanel getPRms() { |
141 |
if (pRms == null) { |
142 |
lRms = new JLabel(); |
143 |
lRms.setText("RMS:");
|
144 |
lRms.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12)); |
145 |
FlowLayout flowLayout3 = new FlowLayout(); |
146 |
flowLayout3.setAlignment(java.awt.FlowLayout.RIGHT); |
147 |
pRms = new JPanel(); |
148 |
pRms.setLayout(flowLayout3); |
149 |
pRms.setPreferredSize(new java.awt.Dimension(140,20)); |
150 |
flowLayout3.setHgap(0);
|
151 |
flowLayout3.setVgap(1);
|
152 |
pRms.add(lRms, null);
|
153 |
pRms.add(getTRMS(), null);
|
154 |
} |
155 |
return pRms;
|
156 |
} |
157 |
|
158 |
/**
|
159 |
* This method initializes pLongitud
|
160 |
*
|
161 |
* @return javax.swing.JPanel
|
162 |
*/
|
163 |
private JPanel getPTotal() { |
164 |
if (pTotal == null) { |
165 |
lTotal = new JLabel(); |
166 |
lTotal.setText(PluginServices.getText(this, "total")+":"); |
167 |
FlowLayout flowLayout4 = new FlowLayout(); |
168 |
flowLayout4.setAlignment(java.awt.FlowLayout.RIGHT); |
169 |
pTotal = new JPanel(); |
170 |
pTotal.setLayout(flowLayout4); |
171 |
pTotal.setPreferredSize(new java.awt.Dimension(160,20)); |
172 |
flowLayout4.setHgap(7);
|
173 |
flowLayout4.setVgap(1);
|
174 |
pTotal.add(lTotal, null);
|
175 |
pTotal.add(getTTotal(), null);
|
176 |
} |
177 |
return pTotal;
|
178 |
} |
179 |
|
180 |
/**
|
181 |
* Este m?todo inicializa el campo de texto que tiene la coordenada en X
|
182 |
* de la vista. Controla que le sean introducidos valores numericos y
|
183 |
* salva el valor que contiene en la capa.
|
184 |
*
|
185 |
* @return javax.swing.JTextField
|
186 |
*/
|
187 |
public JTextField getTResX() { |
188 |
if (tResX == null) { |
189 |
tResX = new JTextField(); |
190 |
tResX.setPreferredSize(new java.awt.Dimension(75,18)); |
191 |
tResX.setEnabled(false);
|
192 |
} |
193 |
return tResX;
|
194 |
} |
195 |
|
196 |
/**
|
197 |
* Este m?todo inicializa el campo de texto que tiene la coordenada en Y
|
198 |
* de la vista. Controla que le sean introducidos valores numericos y
|
199 |
* salva el valor que contiene en la capa.
|
200 |
*
|
201 |
* @return javax.swing.JTextField
|
202 |
*/
|
203 |
public JTextField getTResY() { |
204 |
if (tResY == null) { |
205 |
tResY = new JTextField(); |
206 |
tResY.setPreferredSize(new java.awt.Dimension(75,18)); |
207 |
tResY.setEnabled(false);
|
208 |
} |
209 |
return tResY;
|
210 |
} |
211 |
|
212 |
/**
|
213 |
* Este m?todo inicializa el campo de texto que tiene la coordenada en Y
|
214 |
* del mundo real. Controla que le sean introducidos valores numericos y
|
215 |
* salva el valor que contiene en la capa.
|
216 |
*
|
217 |
* @return javax.swing.JTextField
|
218 |
*/
|
219 |
public JTextField getTTotal() { |
220 |
if (tTotal == null) { |
221 |
tTotal = new JTextField(); |
222 |
tTotal.setPreferredSize(new java.awt.Dimension(90,18)); |
223 |
tTotal.setEnabled(false);
|
224 |
tTotal.setHorizontalAlignment(javax.swing.JTextField.LEFT); |
225 |
} |
226 |
return tTotal;
|
227 |
} |
228 |
|
229 |
/**
|
230 |
* Este m?todo inicializa el campo de texto que tiene la coordenada en X
|
231 |
* del mundo real. Controla que le sean introducidos valores numericos y
|
232 |
* salva el valor que contiene en la capa.
|
233 |
*
|
234 |
* @return javax.swing.JTextField
|
235 |
*/
|
236 |
public JTextField getTRMS() { |
237 |
if (tRms == null) { |
238 |
tRms = new JTextField(); |
239 |
tRms.setPreferredSize(new java.awt.Dimension(75,18)); |
240 |
tRms.setEnabled(false);
|
241 |
tRms.setHorizontalAlignment(javax.swing.JTextField.LEFT); |
242 |
} |
243 |
return tRms;
|
244 |
} |
245 |
|
246 |
|
247 |
/**
|
248 |
* This method initializes jPanel
|
249 |
*
|
250 |
* @return javax.swing.JPanel
|
251 |
*/
|
252 |
private JPanel getPError() { |
253 |
if (pError == null) { |
254 |
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
255 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
256 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
257 |
pError = new JPanel(); |
258 |
pError.setLayout(new GridBagLayout()); |
259 |
gridBagConstraints1.gridx = 0;
|
260 |
gridBagConstraints1.gridy = 0;
|
261 |
gridBagConstraints1.ipadx = 0;
|
262 |
gridBagConstraints1.insets = new Insets(0, 0, 0, 0); |
263 |
gridBagConstraints1.gridwidth = 2;
|
264 |
gridBagConstraints2.gridx = 0;
|
265 |
gridBagConstraints2.gridy = 1;
|
266 |
gridBagConstraints2.weighty = 0.0D;
|
267 |
gridBagConstraints2.insets = new Insets(0, 0, 0, 0); |
268 |
gridBagConstraints3.gridx = 0;
|
269 |
gridBagConstraints3.gridy = 2;
|
270 |
gridBagConstraints3.weighty = 0.0D;
|
271 |
gridBagConstraints3.insets = new Insets(0, 0, 0, 0); |
272 |
pError.setPreferredSize(new java.awt.Dimension(175,105)); |
273 |
pError.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Error", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
274 |
pError.add(getPX(), gridBagConstraints1); |
275 |
pError.add(getPY(), gridBagConstraints2); |
276 |
pError.add(getPRms(), gridBagConstraints3); |
277 |
} |
278 |
return pError;
|
279 |
} |
280 |
|
281 |
/**
|
282 |
* Activa o desactiva este panel y todos los que lo componen
|
283 |
* @param enabled variable booleana para la activaci?n y/o desactivaci?n
|
284 |
*/
|
285 |
public void setEnabled(boolean enabled){ |
286 |
Color color = Color.WHITE; |
287 |
if(!enabled)
|
288 |
color = this.getBackground();
|
289 |
this.getTResX().setBackground(color);
|
290 |
this.getTResY().setBackground(color);
|
291 |
this.getTRMS().setBackground(color);
|
292 |
this.getTTotal().setBackground(color);
|
293 |
} |
294 |
|
295 |
/**
|
296 |
* Esta funci?n resetea los controles del panel de info de un punto.
|
297 |
*/
|
298 |
public void resetControls(String value){ |
299 |
String data = ""; |
300 |
if(value != null) |
301 |
data = value; |
302 |
getTResX().setText(data); |
303 |
getTResY().setText(data); |
304 |
getTRMS().setText(data); |
305 |
getTTotal().setText(data); |
306 |
} |
307 |
} |