Revision 9756
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.192/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.busquedacatastral.swing.impl.DefaultBusquedaCatastralSwingLibrary |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.192/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.impl/src/main/java/org/gvsig/busquedacatastral/swing/impl/TipoViaCellRenderer.java | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2015 DiSiD Technologies S.L.L. All rights reserved. |
|
3 |
* |
|
4 |
* Project : DiSiD org.gvsig.lrs.swing.impl |
|
5 |
* SVN Id : $Id$ |
|
6 |
*/ |
|
7 |
package org.gvsig.busquedacatastral.swing.impl; |
|
8 |
|
|
9 |
import java.awt.Component; |
|
10 |
|
|
11 |
import javax.swing.DefaultListCellRenderer; |
|
12 |
import javax.swing.JLabel; |
|
13 |
import javax.swing.JList; |
|
14 |
import javax.swing.ListCellRenderer; |
|
15 |
|
|
16 |
import org.gvsig.busquedacatastral.lib.api.TipoVia; |
|
17 |
|
|
18 |
public class TipoViaCellRenderer implements ListCellRenderer<TipoVia>{ |
|
19 |
|
|
20 |
|
|
21 |
protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer(); |
|
22 |
|
|
23 |
@Override |
|
24 |
public Component getListCellRendererComponent(JList<? extends TipoVia> list, |
|
25 |
TipoVia value, int index, boolean isSelected, boolean cellHasFocus) { |
|
26 |
JLabel renderer = |
|
27 |
(JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
|
28 |
if (value!=null){ |
|
29 |
renderer.setText(value.getLabel()); |
|
30 |
}else{ |
|
31 |
renderer.setText(""); |
|
32 |
} |
|
33 |
return renderer; |
|
34 |
} |
|
35 |
|
|
36 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.192/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.impl/src/main/java/org/gvsig/busquedacatastral/swing/impl/BusquedaMunicipiosPanelView.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<object classname="com.jeta.forms.store.memento.FormPackage"> |
|
4 |
<at name="fileversion"> |
|
5 |
<object classname="com.jeta.forms.store.memento.FormsVersion2"> |
|
6 |
<at name="major">2</at> |
|
7 |
<at name="minor">0</at> |
|
8 |
<at name="sub">0</at> |
|
9 |
</object> |
|
10 |
</at> |
|
11 |
<at name="form"> |
|
12 |
<object classname="com.jeta.forms.store.memento.FormMemento"> |
|
13 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
14 |
<at name="cellconstraints"> |
|
15 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
16 |
<at name="column">1</at> |
|
17 |
<at name="row">1</at> |
|
18 |
<at name="colspan">1</at> |
|
19 |
<at name="rowspan">1</at> |
|
20 |
<at name="halign">default</at> |
|
21 |
<at name="valign">default</at> |
|
22 |
<at name="insets" object="insets">0,0,0,0</at> |
|
23 |
</object> |
|
24 |
</at> |
|
25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
|
26 |
</super> |
|
27 |
<at name="id">/home/daniel/projects/svn/desig-lote1-gvsig.desig-lote1_gvsig/fuentes/ENT-56322/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.impl/src/main/java/org/gvsig/busquedacatastral/swing/impl/BusquedaMunicipiosPanelView.xml</at> |
|
28 |
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:136PX:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at> |
|
29 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:216PX:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE</at> |
|
30 |
<at name="components"> |
|
31 |
<object classname="java.util.LinkedList"> |
|
32 |
<item > |
|
33 |
<at name="value"> |
|
34 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
35 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
36 |
<at name="cellconstraints"> |
|
37 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
38 |
<at name="column">2</at> |
|
39 |
<at name="row">4</at> |
|
40 |
<at name="colspan">1</at> |
|
41 |
<at name="rowspan">1</at> |
|
42 |
<at name="halign">default</at> |
|
43 |
<at name="valign">default</at> |
|
44 |
<at name="insets" object="insets">0,0,0,0</at> |
|
45 |
</object> |
|
46 |
</at> |
|
47 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
48 |
</super> |
|
49 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
50 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
51 |
<at name="beanproperties"> |
|
52 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
53 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
54 |
<at name="properties"> |
|
55 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
56 |
<at name="border"> |
|
57 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
58 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
59 |
<at name="name">border</at> |
|
60 |
</super> |
|
61 |
<at name="borders"> |
|
62 |
<object classname="java.util.LinkedList"> |
|
63 |
<item > |
|
64 |
<at name="value"> |
|
65 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
66 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
67 |
<at name="name">border</at> |
|
68 |
</super> |
|
69 |
</object> |
|
70 |
</at> |
|
71 |
</item> |
|
72 |
</object> |
|
73 |
</at> |
|
74 |
</object> |
|
75 |
</at> |
|
76 |
<at name="name">lblMunicipio</at> |
|
77 |
<at name="width">60</at> |
|
78 |
<at name="text">_municipio</at> |
|
79 |
<at name="fill"> |
|
80 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
81 |
<at name="name">fill</at> |
|
82 |
</object> |
|
83 |
</at> |
|
84 |
<at name="height">14</at> |
|
85 |
</object> |
|
86 |
</at> |
|
87 |
</object> |
|
88 |
</at> |
|
89 |
</object> |
|
90 |
</at> |
|
91 |
</item> |
|
92 |
<item > |
|
93 |
<at name="value"> |
|
94 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
95 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
96 |
<at name="cellconstraints"> |
|
97 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
98 |
<at name="column">2</at> |
|
99 |
<at name="row">2</at> |
|
100 |
<at name="colspan">1</at> |
|
101 |
<at name="rowspan">1</at> |
|
102 |
<at name="halign">default</at> |
|
103 |
<at name="valign">default</at> |
|
104 |
<at name="insets" object="insets">0,0,0,0</at> |
|
105 |
</object> |
|
106 |
</at> |
|
107 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
108 |
</super> |
|
109 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
110 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
111 |
<at name="beanproperties"> |
|
112 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
113 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
114 |
<at name="properties"> |
|
115 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
116 |
<at name="border"> |
|
117 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
118 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
119 |
<at name="name">border</at> |
|
120 |
</super> |
|
121 |
<at name="borders"> |
|
122 |
<object classname="java.util.LinkedList"> |
|
123 |
<item > |
|
124 |
<at name="value"> |
|
125 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
126 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
127 |
<at name="name">border</at> |
|
128 |
</super> |
|
129 |
</object> |
|
130 |
</at> |
|
131 |
</item> |
|
132 |
</object> |
|
133 |
</at> |
|
134 |
</object> |
|
135 |
</at> |
|
136 |
<at name="name">lblProvincia</at> |
|
137 |
<at name="width">60</at> |
|
138 |
<at name="text">_provincia</at> |
|
139 |
<at name="fill"> |
|
140 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
141 |
<at name="name">fill</at> |
|
142 |
</object> |
|
143 |
</at> |
|
144 |
<at name="height">14</at> |
|
145 |
</object> |
|
146 |
</at> |
|
147 |
</object> |
|
148 |
</at> |
|
149 |
</object> |
|
150 |
</at> |
|
151 |
</item> |
|
152 |
<item > |
|
153 |
<at name="value"> |
|
154 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
155 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
156 |
<at name="cellconstraints"> |
|
157 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
158 |
<at name="column">4</at> |
|
159 |
<at name="row">2</at> |
|
160 |
<at name="colspan">1</at> |
|
161 |
<at name="rowspan">1</at> |
|
162 |
<at name="halign">default</at> |
|
163 |
<at name="valign">default</at> |
|
164 |
<at name="insets" object="insets">0,0,0,0</at> |
|
165 |
</object> |
|
166 |
</at> |
|
167 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
168 |
</super> |
|
169 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
170 |
<at name="beanclass">javax.swing.JTextField</at> |
|
171 |
<at name="beanproperties"> |
|
172 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
173 |
<at name="classname">javax.swing.JTextField</at> |
|
174 |
<at name="properties"> |
|
175 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
176 |
<at name="border"> |
|
177 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
178 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
179 |
<at name="name">border</at> |
|
180 |
</super> |
|
181 |
<at name="borders"> |
|
182 |
<object classname="java.util.LinkedList"> |
|
183 |
<item > |
|
184 |
<at name="value"> |
|
185 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
186 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
187 |
<at name="name">border</at> |
|
188 |
</super> |
|
189 |
</object> |
|
190 |
</at> |
|
191 |
</item> |
|
192 |
</object> |
|
193 |
</at> |
|
194 |
</object> |
|
195 |
</at> |
|
196 |
<at name="name">txtProvincia</at> |
|
197 |
<at name="width">212</at> |
|
198 |
<at name="height">20</at> |
|
199 |
</object> |
|
200 |
</at> |
|
201 |
</object> |
|
202 |
</at> |
|
203 |
</object> |
|
204 |
</at> |
|
205 |
</item> |
|
206 |
<item > |
|
207 |
<at name="value"> |
|
208 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
209 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
210 |
<at name="cellconstraints"> |
|
211 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
212 |
<at name="column">4</at> |
|
213 |
<at name="row">4</at> |
|
214 |
<at name="colspan">1</at> |
|
215 |
<at name="rowspan">1</at> |
|
216 |
<at name="halign">default</at> |
|
217 |
<at name="valign">default</at> |
|
218 |
<at name="insets" object="insets">0,0,0,0</at> |
|
219 |
</object> |
|
220 |
</at> |
|
221 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
222 |
</super> |
|
223 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
224 |
<at name="beanclass">javax.swing.JTextField</at> |
|
225 |
<at name="beanproperties"> |
|
226 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
227 |
<at name="classname">javax.swing.JTextField</at> |
|
228 |
<at name="properties"> |
|
229 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
230 |
<at name="border"> |
|
231 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
232 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
233 |
<at name="name">border</at> |
|
234 |
</super> |
|
235 |
<at name="borders"> |
|
236 |
<object classname="java.util.LinkedList"> |
|
237 |
<item > |
|
238 |
<at name="value"> |
|
239 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
240 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
241 |
<at name="name">border</at> |
|
242 |
</super> |
|
243 |
</object> |
|
244 |
</at> |
|
245 |
</item> |
|
246 |
</object> |
|
247 |
</at> |
|
248 |
</object> |
|
249 |
</at> |
|
250 |
<at name="name">txtMunicipio</at> |
|
251 |
<at name="width">212</at> |
|
252 |
<at name="height">20</at> |
|
253 |
</object> |
|
254 |
</at> |
|
255 |
</object> |
|
256 |
</at> |
|
257 |
</object> |
|
258 |
</at> |
|
259 |
</item> |
|
260 |
<item > |
|
261 |
<at name="value"> |
|
262 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
263 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
264 |
<at name="cellconstraints"> |
|
265 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
266 |
<at name="column">4</at> |
|
267 |
<at name="row">6</at> |
|
268 |
<at name="colspan">6</at> |
|
269 |
<at name="rowspan">1</at> |
|
270 |
<at name="halign">default</at> |
|
271 |
<at name="valign">default</at> |
|
272 |
<at name="insets" object="insets">0,0,0,0</at> |
|
273 |
</object> |
|
274 |
</at> |
|
275 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
276 |
</super> |
|
277 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
278 |
<at name="beanclass">javax.swing.JList</at> |
|
279 |
<at name="beanproperties"> |
|
280 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
281 |
<at name="classname">javax.swing.JList</at> |
|
282 |
<at name="properties"> |
|
283 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
284 |
<at name="border"> |
|
285 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
286 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
287 |
<at name="name">border</at> |
|
288 |
</super> |
|
289 |
<at name="borders"> |
|
290 |
<object classname="java.util.LinkedList"> |
|
291 |
<item > |
|
292 |
<at name="value"> |
|
293 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
294 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
295 |
<at name="name">border</at> |
|
296 |
</super> |
|
297 |
</object> |
|
298 |
</at> |
|
299 |
</item> |
|
300 |
</object> |
|
301 |
</at> |
|
302 |
</object> |
|
303 |
</at> |
|
304 |
<at name="scrollableTracksViewportHeight">true</at> |
|
305 |
<at name="scrollableTracksViewportWidth">true</at> |
|
306 |
<at name="name">listMunicipios</at> |
|
307 |
<at name="width">415</at> |
|
308 |
<at name="items"> |
|
309 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
|
310 |
<at name="name">items</at> |
|
311 |
</object> |
|
312 |
</at> |
|
313 |
<at name="scollBars"> |
|
314 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
315 |
<at name="name">scollBars</at> |
|
316 |
<at name="verticalpolicy">20</at> |
|
317 |
<at name="horizontalpolicy">30</at> |
|
318 |
</object> |
|
319 |
</at> |
|
320 |
<at name="height">78</at> |
|
321 |
</object> |
|
322 |
</at> |
|
323 |
</object> |
|
324 |
</at> |
|
325 |
</object> |
|
326 |
</at> |
|
327 |
</item> |
|
328 |
<item > |
|
329 |
<at name="value"> |
|
330 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
331 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
332 |
<at name="cellconstraints"> |
|
333 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
334 |
<at name="column">6</at> |
|
335 |
<at name="row">8</at> |
|
336 |
<at name="colspan">1</at> |
|
337 |
<at name="rowspan">1</at> |
|
338 |
<at name="halign">default</at> |
|
339 |
<at name="valign">default</at> |
|
340 |
<at name="insets" object="insets">0,0,0,0</at> |
|
341 |
</object> |
|
342 |
</at> |
|
343 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
344 |
</super> |
|
345 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
346 |
<at name="beanclass">javax.swing.JButton</at> |
|
347 |
<at name="beanproperties"> |
|
348 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
349 |
<at name="classname">javax.swing.JButton</at> |
|
350 |
<at name="properties"> |
|
351 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
352 |
<at name="border"> |
|
353 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
354 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
355 |
<at name="name">border</at> |
|
356 |
</super> |
|
357 |
<at name="borders"> |
|
358 |
<object classname="java.util.LinkedList"> |
|
359 |
<item > |
|
360 |
<at name="value"> |
|
361 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
362 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
363 |
<at name="name">border</at> |
|
364 |
</super> |
|
365 |
</object> |
|
366 |
</at> |
|
367 |
</item> |
|
368 |
</object> |
|
369 |
</at> |
|
370 |
</object> |
|
371 |
</at> |
|
372 |
<at name="actionCommand">JButton</at> |
|
373 |
<at name="name">btnAceptar</at> |
|
374 |
<at name="width">81</at> |
|
375 |
<at name="text">_aceptar</at> |
|
376 |
<at name="height">22</at> |
|
377 |
</object> |
|
378 |
</at> |
|
379 |
</object> |
|
380 |
</at> |
|
381 |
</object> |
|
382 |
</at> |
|
383 |
</item> |
|
384 |
<item > |
|
385 |
<at name="value"> |
|
386 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
387 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
388 |
<at name="cellconstraints"> |
|
389 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
390 |
<at name="column">8</at> |
|
391 |
<at name="row">8</at> |
|
392 |
<at name="colspan">1</at> |
|
393 |
<at name="rowspan">1</at> |
|
394 |
<at name="halign">default</at> |
|
395 |
<at name="valign">default</at> |
|
396 |
<at name="insets" object="insets">0,0,0,0</at> |
|
397 |
</object> |
|
398 |
</at> |
|
399 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
400 |
</super> |
|
401 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
402 |
<at name="beanclass">javax.swing.JButton</at> |
|
403 |
<at name="beanproperties"> |
|
404 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
405 |
<at name="classname">javax.swing.JButton</at> |
|
406 |
<at name="properties"> |
|
407 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
408 |
<at name="border"> |
|
409 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
410 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
411 |
<at name="name">border</at> |
|
412 |
</super> |
|
413 |
<at name="borders"> |
|
414 |
<object classname="java.util.LinkedList"> |
|
415 |
<item > |
|
416 |
<at name="value"> |
|
417 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
418 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
419 |
<at name="name">border</at> |
|
420 |
</super> |
|
421 |
</object> |
|
422 |
</at> |
|
423 |
</item> |
|
424 |
</object> |
|
425 |
</at> |
|
426 |
</object> |
|
427 |
</at> |
|
428 |
<at name="actionCommand">JButton</at> |
|
429 |
<at name="name">btnCancelar</at> |
|
430 |
<at name="width">86</at> |
|
431 |
<at name="text">_cancelar</at> |
|
432 |
<at name="height">22</at> |
|
433 |
</object> |
|
434 |
</at> |
|
435 |
</object> |
|
436 |
</at> |
|
437 |
</object> |
|
438 |
</at> |
|
439 |
</item> |
|
440 |
</object> |
|
441 |
</at> |
|
442 |
<at name="properties"> |
|
443 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
444 |
<at name="classname">com.jeta.forms.gui.form.GridView</at> |
|
445 |
<at name="properties"> |
|
446 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
447 |
<at name="border"> |
|
448 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
449 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
450 |
<at name="name">border</at> |
|
451 |
</super> |
|
452 |
<at name="borders"> |
|
453 |
<object classname="java.util.LinkedList"/> |
|
454 |
</at> |
|
455 |
</object> |
|
456 |
</at> |
|
457 |
<at name="name"/> |
|
458 |
<at name="fill"> |
|
459 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
460 |
<at name="name">fill</at> |
|
461 |
</object> |
|
462 |
</at> |
|
463 |
<at name="scollBars"> |
|
464 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
465 |
<at name="name">scollBars</at> |
|
466 |
<at name="verticalpolicy">21</at> |
|
467 |
<at name="horizontalpolicy">31</at> |
|
468 |
<at name="border"> |
|
469 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
470 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
471 |
<at name="name">border</at> |
|
472 |
</super> |
|
473 |
<at name="borders"> |
|
474 |
<object classname="java.util.LinkedList"> |
|
475 |
<item > |
|
476 |
<at name="value"> |
|
477 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
478 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
479 |
<at name="name">border</at> |
|
480 |
</super> |
|
481 |
</object> |
|
482 |
</at> |
|
483 |
</item> |
|
484 |
</object> |
|
485 |
</at> |
|
486 |
</object> |
|
487 |
</at> |
|
488 |
</object> |
|
489 |
</at> |
|
490 |
</object> |
|
491 |
</at> |
|
492 |
</object> |
|
493 |
</at> |
|
494 |
<at name="cellpainters"> |
|
495 |
<object classname="com.jeta.forms.store.support.Matrix"> |
|
496 |
<at name="rows"> |
|
497 |
<object classname="[Ljava.lang.Object;" size="9"> |
|
498 |
<at name="item" index="0"> |
|
499 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
500 |
</at> |
|
501 |
<at name="item" index="1"> |
|
502 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
503 |
</at> |
|
504 |
<at name="item" index="2"> |
|
505 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
506 |
</at> |
|
507 |
<at name="item" index="3"> |
|
508 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
509 |
</at> |
|
510 |
<at name="item" index="4"> |
|
511 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
512 |
</at> |
|
513 |
<at name="item" index="5"> |
|
514 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
515 |
</at> |
|
516 |
<at name="item" index="6"> |
|
517 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
518 |
</at> |
|
519 |
<at name="item" index="7"> |
|
520 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
521 |
</at> |
|
522 |
<at name="item" index="8"> |
|
523 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
524 |
</at> |
|
525 |
</object> |
|
526 |
</at> |
|
527 |
</object> |
|
528 |
</at> |
|
529 |
<at name="rowgroups"> |
|
530 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
531 |
<at name="groups"> |
|
532 |
<object classname="java.util.HashMap"/> |
|
533 |
</at> |
|
534 |
</object> |
|
535 |
</at> |
|
536 |
<at name="colgroups"> |
|
537 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
538 |
<at name="groups"> |
|
539 |
<object classname="java.util.HashMap"/> |
|
540 |
</at> |
|
541 |
</object> |
|
542 |
</at> |
|
543 |
</object> |
|
544 |
</at> |
|
545 |
</object> |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.192/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.impl/src/main/java/org/gvsig/busquedacatastral/swing/impl/BusquedaNumerosPanelController.java | ||
---|---|---|
1 |
package org.gvsig.busquedacatastral.swing.impl; |
|
2 |
|
|
3 |
import java.awt.Dimension; |
|
4 |
import java.awt.Rectangle; |
|
5 |
import java.awt.event.ActionEvent; |
|
6 |
import java.awt.event.ActionListener; |
|
7 |
import java.awt.event.KeyEvent; |
|
8 |
import java.awt.event.KeyListener; |
|
9 |
import java.awt.event.MouseAdapter; |
|
10 |
import java.awt.event.MouseEvent; |
|
11 |
import java.util.List; |
|
12 |
import java.util.Locale; |
|
13 |
|
|
14 |
import javax.swing.ComboBoxModel; |
|
15 |
import javax.swing.DefaultComboBoxModel; |
|
16 |
import javax.swing.DefaultListCellRenderer; |
|
17 |
import javax.swing.JComponent; |
|
18 |
import javax.swing.JList; |
|
19 |
import javax.swing.JOptionPane; |
|
20 |
import javax.swing.ListSelectionModel; |
|
21 |
import javax.swing.event.ListSelectionEvent; |
|
22 |
import javax.swing.event.ListSelectionListener; |
|
23 |
|
|
24 |
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralLocator; |
|
25 |
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralManager; |
|
26 |
import org.gvsig.busquedacatastral.lib.api.QueryCatastral; |
|
27 |
import org.gvsig.busquedacatastral.lib.api.ReferenciaCatastral; |
|
28 |
import org.gvsig.busquedacatastral.lib.api.TipoVia; |
|
29 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException; |
|
30 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralGettingParamsException; |
|
31 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralRemoteServiceException; |
|
32 |
import org.gvsig.busquedacatastral.swing.api.BusquedaCatastralConsultaCatastralPanel.PanelAction; |
|
33 |
import org.gvsig.busquedacatastral.swing.api.exceptions.BusquedaCatastralCreatingPanelException; |
|
34 |
import org.gvsig.tools.ToolsLocator; |
|
35 |
import org.gvsig.tools.dynobject.DynObject; |
|
36 |
import org.gvsig.tools.i18n.I18nManager; |
|
37 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
|
38 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
39 |
|
|
40 |
import org.slf4j.Logger; |
|
41 |
import org.slf4j.LoggerFactory; |
|
42 |
|
|
43 |
public class BusquedaNumerosPanelController extends BusquedaNumerosPanelView{ |
|
44 |
|
|
45 |
|
|
46 |
private static final Logger logger = LoggerFactory.getLogger(BusquedaNumerosPanelController.class); |
|
47 |
|
|
48 |
private ActionListenerSupport listeners = ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport(); |
|
49 |
|
|
50 |
private String selectedNumero; |
|
51 |
|
|
52 |
private QueryCatastral query; |
|
53 |
|
|
54 |
private boolean isCanceled; |
|
55 |
|
|
56 |
public BusquedaNumerosPanelController(QueryCatastral query) throws BusquedaCatastralCreatingPanelException{ |
|
57 |
super(); |
|
58 |
this.query=query; |
|
59 |
initComponents(); |
|
60 |
translate(); |
|
61 |
} |
|
62 |
|
|
63 |
public void addActionListener(ActionListener listener) { |
|
64 |
listeners.addActionListener(listener); |
|
65 |
} |
|
66 |
|
|
67 |
public void removeActionListener(ActionListener listener) { |
|
68 |
listeners.removeActionListener(listener); |
|
69 |
} |
|
70 |
|
|
71 |
private void translate() { |
|
72 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
73 |
|
|
74 |
lblProvincia.setText(i18nManager.getTranslation(lblProvincia.getText())); |
|
75 |
lblMunicipio.setText(i18nManager.getTranslation(lblMunicipio.getText())); |
|
76 |
lblVia.setText(i18nManager.getTranslation(lblVia.getText())); |
|
77 |
lblDesde.setText(i18nManager.getTranslation(lblDesde.getText())); |
|
78 |
lblHasta.setText(i18nManager.getTranslation(lblHasta.getText())); |
|
79 |
btnAceptar.setText(i18nManager.getTranslation(btnAceptar.getText())); |
|
80 |
btnCancelar.setText(i18nManager.getTranslation(btnCancelar.getText())); |
|
81 |
btnBuscar.setText(i18nManager.getTranslation(btnBuscar.getText())); |
|
82 |
} |
|
83 |
|
|
84 |
/** |
|
85 |
* |
|
86 |
*/ |
|
87 |
public void setLocate(Locale locale) { |
|
88 |
Locale l = super.getLocale(); |
|
89 |
if (!l.equals(locale)) { |
|
90 |
translate(); |
|
91 |
} |
|
92 |
super.setLocale(locale); |
|
93 |
} |
|
94 |
|
|
95 |
private void initComponents() throws BusquedaCatastralCreatingPanelException{ |
|
96 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
97 |
if (query==null || query.getProvincia()==null){ |
|
98 |
throw new BusquedaCatastralCreatingPanelException(i18nManager.getTranslation("_provincia_vacia_en_busqueda_numeros"), null); |
|
99 |
} |
|
100 |
if (query==null || query.getMunicipio()==null){ |
|
101 |
throw new BusquedaCatastralCreatingPanelException(i18nManager.getTranslation("_municipio_vacio_en_busqueda_numeros"), null); |
|
102 |
} |
|
103 |
if (query==null || query.getVia()==null){ |
|
104 |
throw new BusquedaCatastralCreatingPanelException(i18nManager.getTranslation("_via_vacia_en_busqueda_numeros"), null); |
|
105 |
} |
|
106 |
|
|
107 |
final DynObject provincia=query.getProvincia(); |
|
108 |
txtProvincia.setText((String)provincia.getDynValue(BusquedaCatastralManager.CAMPO_PROVINCIA_ETIQUETA)); |
|
109 |
txtProvincia.setEnabled(false); |
|
110 |
final DynObject municipio=query.getMunicipio(); |
|
111 |
txtMunicipio.setText((String)municipio.getDynValue(BusquedaCatastralManager.CAMPO_MUNICIPIO_ETIQUETA)); |
|
112 |
txtMunicipio.setEnabled(false); |
|
113 |
final DynObject via=query.getVia(); |
|
114 |
txtVia.setText((String)via.getDynValue(BusquedaCatastralManager.CAMPO_VIA_ETIQUETA)); |
|
115 |
txtVia.setEnabled(false); |
|
116 |
|
|
117 |
txtDesde.setText(""); |
|
118 |
txtHasta.setText(""); |
|
119 |
|
|
120 |
//List Numeros |
|
121 |
BusquedaCatastralManager busquedaCatastralManager = BusquedaCatastralLocator.getManager(); |
|
122 |
List<String> numeros; |
|
123 |
listNumeros.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|
124 |
listNumeros.setCellRenderer(new DefaultListCellRenderer()); |
|
125 |
listNumeros.addListSelectionListener(new ListSelectionListener() { |
|
126 |
@Override |
|
127 |
public void valueChanged(ListSelectionEvent e) { |
|
128 |
if (e.getSource() instanceof JList){ |
|
129 |
selectedNumero=(String)listNumeros.getSelectedValue(); |
|
130 |
} |
|
131 |
} |
|
132 |
}); |
|
133 |
|
|
134 |
listNumeros.addMouseListener(new MouseAdapter() { |
|
135 |
public void mouseClicked(MouseEvent evt) { |
|
136 |
JList<String> list = (JList<String>)evt.getSource(); |
|
137 |
Rectangle r = list.getCellBounds(0, list.getLastVisibleIndex()); |
|
138 |
if (r != null && r.contains(evt.getPoint())) { |
|
139 |
int index=-1; |
|
140 |
if (evt.getClickCount() == 2) { |
|
141 |
// Double-click detected |
|
142 |
index = list.locationToIndex(evt.getPoint()); |
|
143 |
} else if (evt.getClickCount() == 3) { |
|
144 |
// Triple-click detected |
|
145 |
index = list.locationToIndex(evt.getPoint()); |
|
146 |
} |
|
147 |
if (list.getSelectedIndex()==index){ |
|
148 |
accept(); |
|
149 |
} |
|
150 |
} |
|
151 |
} |
|
152 |
}); |
|
153 |
|
|
154 |
if(query.getVia()!=null){ |
|
155 |
selectedNumero=query.getNumero(); |
|
156 |
listNumeros.setSelectedValue(selectedNumero, true); |
|
157 |
} |
|
158 |
|
|
159 |
this.btnAceptar.addActionListener(new ActionListener() { |
|
160 |
public void actionPerformed(ActionEvent e) { |
|
161 |
if (selectedNumero!=null){ |
|
162 |
accept(); |
|
163 |
}else{ |
|
164 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
165 |
JOptionPane.showMessageDialog( |
|
166 |
null, |
|
167 |
new StringBuilder().append(i18nManager.getTranslation("_no_hay_numero_seleccionado")), |
|
168 |
i18nManager.getTranslation("warn"), JOptionPane.WARNING_MESSAGE); |
|
169 |
} |
|
170 |
} |
|
171 |
}); |
|
172 |
|
|
173 |
this.btnCancelar.addActionListener(new ActionListener() { |
|
174 |
public void actionPerformed(ActionEvent e) { |
|
175 |
isCanceled=true; |
|
176 |
doClose(); |
|
177 |
listeners.fireActionEvent(new ActionEvent(this, 0, "cancel")); |
|
178 |
} |
|
179 |
}); |
|
180 |
|
|
181 |
this.btnBuscar.addActionListener(new ActionListener() { |
|
182 |
public void actionPerformed(ActionEvent e) { |
|
183 |
buscarNumeros(); |
|
184 |
} |
|
185 |
}); |
|
186 |
} |
|
187 |
|
|
188 |
private void accept(){ |
|
189 |
if (selectedNumero!=null){ |
|
190 |
isCanceled=false; |
|
191 |
listeners.fireActionEvent(new ActionEvent(this, 0, "accept")); |
|
192 |
doClose(); |
|
193 |
} |
|
194 |
} |
|
195 |
|
|
196 |
|
|
197 |
private void buscarNumeros(){ |
|
198 |
BusquedaCatastralManager busquedaCatastralManager = BusquedaCatastralLocator.getManager(); |
|
199 |
List<String> numeros; |
|
200 |
String inicio=txtDesde.getText(); |
|
201 |
String fin=txtHasta.getText(); |
|
202 |
try { |
|
203 |
numeros = busquedaCatastralManager.getNumeros(query, inicio, fin); |
|
204 |
if (numeros==null){ |
|
205 |
logger.warn("No se encontrado numeros"); |
|
206 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
207 |
JOptionPane.showMessageDialog( |
|
208 |
null, |
|
209 |
new StringBuilder().append(i18nManager.getTranslation("_no_se_han_encontrado_resultados_para_estos_datos")), |
|
210 |
i18nManager.getTranslation("info"), JOptionPane.INFORMATION_MESSAGE); |
|
211 |
} |
|
212 |
String[] numerosArray=numeros.toArray(new String[0]); |
|
213 |
ComboBoxModel<String> numerosModel = |
|
214 |
new DefaultComboBoxModel<String>(numerosArray); |
|
215 |
listNumeros.setModel(numerosModel); |
|
216 |
} catch (BusquedaCatastralRemoteServiceException e) { |
|
217 |
logger.error("Error getting numeros", e); |
|
218 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
219 |
JOptionPane.showMessageDialog( |
|
220 |
null, |
|
221 |
new StringBuilder().append(i18nManager.getTranslation("_error_accessing_catastrial_server")) |
|
222 |
.append(":").append(e.getLocalizedMessage()), |
|
223 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
224 |
} catch (BusquedaCatastralException e) { |
|
225 |
logger.error("Error getting numeros", e); |
|
226 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
227 |
JOptionPane.showMessageDialog( |
|
228 |
null, |
|
229 |
new StringBuilder().append(i18nManager.getTranslation("_error_getting_numeros")) |
|
230 |
.append(":").append(e.getLocalizedMessage()), |
|
231 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
232 |
} |
|
233 |
|
|
234 |
} |
|
235 |
|
|
236 |
@Override |
|
237 |
public Dimension getPreferredSize() { |
|
238 |
return new Dimension(550, 300); |
|
239 |
} |
|
240 |
|
|
241 |
private void doClose() { |
|
242 |
this.setVisible(false); |
|
243 |
} |
|
244 |
|
|
245 |
public boolean isCanceled(){ |
|
246 |
return isCanceled; |
|
247 |
} |
|
248 |
|
|
249 |
public String getSelected(){ |
|
250 |
return selectedNumero; |
|
251 |
} |
|
252 |
|
|
253 |
public JComponent asJComponent() { |
|
254 |
return this; |
|
255 |
} |
|
256 |
|
|
257 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.192/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.impl/src/main/java/org/gvsig/busquedacatastral/swing/impl/BusquedaViasPanelView.java | ||
---|---|---|
1 |
package org.gvsig.busquedacatastral.swing.impl; |
|
2 |
|
|
3 |
import com.jgoodies.forms.layout.CellConstraints; |
|
4 |
import com.jgoodies.forms.layout.FormLayout; |
|
5 |
import java.awt.BorderLayout; |
|
6 |
import java.awt.ComponentOrientation; |
|
7 |
import java.awt.Container; |
|
8 |
import java.awt.Dimension; |
|
9 |
import javax.swing.Box; |
|
10 |
import javax.swing.ImageIcon; |
|
11 |
import javax.swing.JButton; |
|
12 |
import javax.swing.JFrame; |
|
13 |
import javax.swing.JLabel; |
|
14 |
import javax.swing.JList; |
|
15 |
import javax.swing.JPanel; |
|
16 |
import javax.swing.JScrollPane; |
|
17 |
import javax.swing.JTextField; |
|
18 |
|
|
19 |
|
|
20 |
public class BusquedaViasPanelView extends JPanel |
|
21 |
{ |
|
22 |
JLabel lblMunicipio = new JLabel(); |
|
23 |
JLabel lblProvincia = new JLabel(); |
|
24 |
JTextField txtProvincia = new JTextField(); |
|
25 |
JTextField txtMunicipio = new JTextField(); |
|
26 |
JList listVias = new JList(); |
|
27 |
JButton btnAceptar = new JButton(); |
|
28 |
JButton btnCancelar = new JButton(); |
|
29 |
JLabel lblVia = new JLabel(); |
|
30 |
JTextField txtVia = new JTextField(); |
|
31 |
|
|
32 |
/** |
|
33 |
* Default constructor |
|
34 |
*/ |
|
35 |
public BusquedaViasPanelView() |
|
36 |
{ |
|
37 |
initializePanel(); |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* Adds fill components to empty cells in the first row and first column of the grid. |
|
42 |
* This ensures that the grid spacing will be the same as shown in the designer. |
|
43 |
* @param cols an array of column indices in the first row where fill components should be added. |
|
44 |
* @param rows an array of row indices in the first column where fill components should be added. |
|
45 |
*/ |
|
46 |
void addFillComponents( Container panel, int[] cols, int[] rows ) |
|
47 |
{ |
|
48 |
Dimension filler = new Dimension(10,10); |
|
49 |
|
|
50 |
boolean filled_cell_11 = false; |
|
51 |
CellConstraints cc = new CellConstraints(); |
|
52 |
if ( cols.length > 0 && rows.length > 0 ) |
|
53 |
{ |
|
54 |
if ( cols[0] == 1 && rows[0] == 1 ) |
|
55 |
{ |
|
56 |
/** add a rigid area */ |
|
57 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); |
|
58 |
filled_cell_11 = true; |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
for( int index = 0; index < cols.length; index++ ) |
|
63 |
{ |
|
64 |
if ( cols[index] == 1 && filled_cell_11 ) |
|
65 |
{ |
|
66 |
continue; |
|
67 |
} |
|
68 |
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); |
|
69 |
} |
|
70 |
|
|
71 |
for( int index = 0; index < rows.length; index++ ) |
|
72 |
{ |
|
73 |
if ( rows[index] == 1 && filled_cell_11 ) |
|
74 |
{ |
|
75 |
continue; |
|
76 |
} |
|
77 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); |
|
78 |
} |
|
79 |
|
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* Helper method to load an image file from the CLASSPATH |
|
84 |
* @param imageName the package and name of the file to load relative to the CLASSPATH |
|
85 |
* @return an ImageIcon instance with the specified image file |
|
86 |
* @throws IllegalArgumentException if the image resource cannot be loaded. |
|
87 |
*/ |
|
88 |
public ImageIcon loadImage( String imageName ) |
|
89 |
{ |
|
90 |
try |
|
91 |
{ |
|
92 |
ClassLoader classloader = getClass().getClassLoader(); |
|
93 |
java.net.URL url = classloader.getResource( imageName ); |
|
94 |
if ( url != null ) |
|
95 |
{ |
|
96 |
ImageIcon icon = new ImageIcon( url ); |
|
97 |
return icon; |
|
98 |
} |
|
99 |
} |
|
100 |
catch( Exception e ) |
|
101 |
{ |
|
102 |
e.printStackTrace(); |
|
103 |
} |
|
104 |
throw new IllegalArgumentException( "Unable to load image: " + imageName ); |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* Method for recalculating the component orientation for |
|
109 |
* right-to-left Locales. |
|
110 |
* @param orientation the component orientation to be applied |
|
111 |
*/ |
|
112 |
public void applyComponentOrientation( ComponentOrientation orientation ) |
|
113 |
{ |
|
114 |
// Not yet implemented... |
|
115 |
// I18NUtils.applyComponentOrientation(this, orientation); |
|
116 |
super.applyComponentOrientation(orientation); |
|
117 |
} |
|
118 |
|
|
119 |
public JPanel createPanel() |
|
120 |
{ |
|
121 |
JPanel jpanel1 = new JPanel(); |
|
122 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:216PX:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:136PX:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE"); |
|
123 |
CellConstraints cc = new CellConstraints(); |
|
124 |
jpanel1.setLayout(formlayout1); |
|
125 |
|
|
126 |
lblMunicipio.setName("lblMunicipio"); |
|
127 |
lblMunicipio.setText("_municipio"); |
|
128 |
jpanel1.add(lblMunicipio,cc.xy(2,4)); |
|
129 |
|
|
130 |
lblProvincia.setName("lblProvincia"); |
|
131 |
lblProvincia.setText("_provincia"); |
|
132 |
jpanel1.add(lblProvincia,cc.xy(2,2)); |
|
133 |
|
|
134 |
txtProvincia.setName("txtProvincia"); |
|
135 |
jpanel1.add(txtProvincia,cc.xy(4,2)); |
|
136 |
|
|
137 |
txtMunicipio.setName("txtMunicipio"); |
|
138 |
jpanel1.add(txtMunicipio,cc.xy(4,4)); |
|
139 |
|
|
140 |
listVias.setName("listVias"); |
|
141 |
JScrollPane jscrollpane1 = new JScrollPane(); |
|
142 |
jscrollpane1.setViewportView(listVias); |
|
143 |
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
|
144 |
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
145 |
jpanel1.add(jscrollpane1,cc.xywh(4,8,6,1)); |
|
146 |
|
|
147 |
btnAceptar.setActionCommand("JButton"); |
|
148 |
btnAceptar.setName("btnAceptar"); |
|
149 |
btnAceptar.setText("_aceptar"); |
|
150 |
jpanel1.add(btnAceptar,cc.xy(6,10)); |
|
151 |
|
|
152 |
btnCancelar.setActionCommand("JButton"); |
|
153 |
btnCancelar.setName("btnCancelar"); |
|
154 |
btnCancelar.setText("_cancelar"); |
|
155 |
jpanel1.add(btnCancelar,cc.xy(8,10)); |
|
156 |
|
|
157 |
lblVia.setName("lblVia"); |
|
158 |
lblVia.setText("_via"); |
|
159 |
jpanel1.add(lblVia,cc.xy(2,6)); |
|
160 |
|
|
161 |
txtVia.setName("txtVia"); |
|
162 |
jpanel1.add(txtVia,cc.xy(4,6)); |
|
163 |
|
|
164 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11 }); |
|
165 |
return jpanel1; |
|
166 |
} |
|
167 |
|
|
168 |
/** |
|
169 |
* Initializer |
|
170 |
*/ |
|
171 |
protected void initializePanel() |
|
172 |
{ |
|
173 |
setLayout(new BorderLayout()); |
|
174 |
add(createPanel(), BorderLayout.CENTER); |
|
175 |
} |
|
176 |
|
|
177 |
|
|
178 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.192/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.impl/src/main/java/org/gvsig/busquedacatastral/swing/impl/DynObjectCellRenderer.java | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2015 DiSiD Technologies S.L.L. All rights reserved. |
|
3 |
* |
|
4 |
* Project : DiSiD org.gvsig.lrs.swing.impl |
|
5 |
* SVN Id : $Id$ |
|
6 |
*/ |
|
7 |
package org.gvsig.busquedacatastral.swing.impl; |
|
8 |
|
|
9 |
import java.awt.Component; |
|
10 |
|
|
11 |
import javax.swing.DefaultListCellRenderer; |
|
12 |
import javax.swing.JLabel; |
|
13 |
import javax.swing.JList; |
|
14 |
import javax.swing.ListCellRenderer; |
|
15 |
|
|
16 |
import org.apache.commons.lang3.StringUtils; |
|
17 |
import org.gvsig.tools.dynobject.DynObject; |
|
18 |
import org.slf4j.Logger; |
|
19 |
import org.slf4j.LoggerFactory; |
|
20 |
|
|
21 |
public class DynObjectCellRenderer implements ListCellRenderer<DynObject>{ |
|
22 |
|
|
23 |
private String renderedField; |
|
24 |
private String[] renderedFields; |
|
25 |
private String separator; |
|
26 |
|
|
27 |
/** |
|
28 |
* Default Constructor |
|
29 |
* @param renderedField indicates which field from the DynObject must be rendered |
|
30 |
*/ |
|
31 |
public DynObjectCellRenderer(String renderedField){ |
|
32 |
this.renderedField=renderedField; |
|
33 |
} |
|
34 |
|
|
35 |
public DynObjectCellRenderer(String[] renderedFields, String separator){ |
|
36 |
this.renderedFields=renderedFields; |
|
37 |
this.separator=separator; |
|
38 |
} |
|
39 |
|
|
40 |
protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer(); |
|
41 |
private static final Logger logger = LoggerFactory.getLogger(DynObjectCellRenderer.class); |
|
42 |
|
|
43 |
@Override |
|
44 |
public Component getListCellRendererComponent( |
|
45 |
JList<? extends DynObject> list, DynObject value, int index, |
|
46 |
boolean isSelected, boolean cellHasFocus) { |
|
47 |
|
|
48 |
JLabel renderer = |
|
49 |
(JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
|
50 |
|
|
51 |
if (value!=null){ |
|
52 |
String text=getText(value); |
|
53 |
renderer.setText(text); |
|
54 |
}else{ |
|
55 |
renderer.setText(""); |
|
56 |
} |
|
57 |
|
|
58 |
return renderer; |
|
59 |
} |
|
60 |
|
|
61 |
private String getText(DynObject dynObject){ |
|
62 |
String text=""; |
|
63 |
if (StringUtils.isNotEmpty(renderedField)){ |
|
64 |
text=(String)dynObject.getDynValue(renderedField); |
|
65 |
}else if (renderedFields!=null){ |
|
66 |
for(String fieldName:renderedFields){ |
|
67 |
if (StringUtils.isNotEmpty(text)){ |
|
68 |
text+=separator; |
|
69 |
} |
|
70 |
text+=(String)dynObject.getDynValue(fieldName); |
|
71 |
} |
|
72 |
} |
|
73 |
return text; |
|
74 |
|
|
75 |
} |
|
76 |
|
|
77 |
} |
org.gvsig.busquedacatastral/tags/org.gvsig.busquedacatastral-1.0.192/org.gvsig.busquedacatastral.swing/org.gvsig.busquedacatastral.swing.impl/src/main/java/org/gvsig/busquedacatastral/swing/impl/DefaultBusquedaCatastralConsultaCatastralPanelController.java | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2015 DiSiD Technologies S.L.L. All rights reserved. |
|
3 |
* |
|
4 |
* Project : DiSiD org.gvsig.lrs.swing.impl |
|
5 |
* SVN Id : $Id$ |
|
6 |
*/ |
|
7 |
package org.gvsig.busquedacatastral.swing.impl; |
|
8 |
|
|
9 |
import java.awt.Dimension; |
|
10 |
import java.awt.event.ActionEvent; |
|
11 |
import java.awt.event.ActionListener; |
|
12 |
import java.awt.event.ItemEvent; |
|
13 |
import java.awt.event.ItemListener; |
|
14 |
import java.awt.event.KeyEvent; |
|
15 |
import java.awt.event.KeyListener; |
|
16 |
import java.io.IOException; |
|
17 |
import java.util.List; |
|
18 |
import java.util.Locale; |
|
19 |
|
|
20 |
import javax.swing.ComboBoxModel; |
|
21 |
import javax.swing.DefaultComboBoxModel; |
|
22 |
import javax.swing.DefaultListCellRenderer; |
|
23 |
import javax.swing.DefaultListModel; |
|
24 |
import javax.swing.JComponent; |
|
25 |
import javax.swing.JList; |
|
26 |
import javax.swing.JOptionPane; |
|
27 |
import javax.swing.ListCellRenderer; |
|
28 |
import javax.swing.ListSelectionModel; |
|
29 |
import javax.swing.Timer; |
|
30 |
import javax.swing.event.ListSelectionEvent; |
|
31 |
import javax.swing.event.ListSelectionListener; |
|
32 |
|
|
33 |
import org.apache.commons.lang3.StringUtils; |
|
34 |
import org.cresques.cts.ICoordTrans; |
|
35 |
import org.cresques.cts.IProjection; |
|
36 |
import org.slf4j.Logger; |
|
37 |
import org.slf4j.LoggerFactory; |
|
38 |
|
|
39 |
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralLocator; |
|
40 |
import org.gvsig.busquedacatastral.lib.api.BusquedaCatastralManager; |
|
41 |
import org.gvsig.busquedacatastral.lib.api.QueryCatastral; |
|
42 |
import org.gvsig.busquedacatastral.lib.api.QueryCatastral.TipoQuery; |
|
43 |
import org.gvsig.busquedacatastral.lib.api.ReferenciaCatastral; |
|
44 |
import org.gvsig.busquedacatastral.lib.api.SRSCatastro; |
|
45 |
import org.gvsig.busquedacatastral.lib.api.TipoVia; |
|
46 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralException; |
|
47 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralInvalidQueryException; |
|
48 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralInvalidSRSException; |
|
49 |
import org.gvsig.busquedacatastral.lib.api.exceptions.BusquedaCatastralRemoteServiceException; |
|
50 |
import org.gvsig.busquedacatastral.swing.api.BusquedaCatastralConsultaCatastralPanel; |
|
51 |
import org.gvsig.busquedacatastral.swing.api.exceptions.BusquedaCatastralCreatingPanelException; |
|
52 |
import org.gvsig.busquedacatastral.swing.api.exceptions.BusquedaCatastralObtainingDataException; |
|
53 |
import org.gvsig.busquedacatastral.swing.api.exceptions.BusquedaCatastralObtainingPointException; |
|
54 |
import org.gvsig.fmap.crs.CRSFactory; |
|
55 |
import org.gvsig.fmap.geom.primitive.Point; |
|
56 |
import org.gvsig.tools.ToolsLocator; |
|
57 |
import org.gvsig.tools.dynobject.DynObject; |
|
58 |
import org.gvsig.tools.exception.BaseException; |
|
59 |
import org.gvsig.tools.i18n.I18nManager; |
|
60 |
import org.gvsig.tools.locator.LocatorException; |
|
61 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
|
62 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
63 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
64 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
65 |
|
|
66 |
public class DefaultBusquedaCatastralConsultaCatastralPanelController extends DefaultBusquedaCatastralConsultaCatastralPanelView implements BusquedaCatastralConsultaCatastralPanel{ |
|
67 |
|
|
68 |
/** |
|
69 |
* |
|
70 |
*/ |
|
71 |
private static final long serialVersionUID = -9145489136943076981L; |
|
72 |
|
|
73 |
private static final Logger logger = LoggerFactory.getLogger(DefaultBusquedaCatastralConsultaCatastralPanelController.class); |
|
74 |
|
|
75 |
private ActionListenerSupport listeners = ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport(); |
|
76 |
|
|
77 |
private QueryCatastral queryCatastral; |
|
78 |
|
|
79 |
private PanelAction selectedPanelAction; |
|
80 |
|
|
81 |
private List<ReferenciaCatastral> referenciasCatastrales; |
|
82 |
|
|
83 |
private ReferenciaCatastral selectedReferenciaCatastral; |
|
84 |
|
|
85 |
public DefaultBusquedaCatastralConsultaCatastralPanelController() throws BusquedaCatastralException{ |
|
86 |
super(); |
|
87 |
try { |
|
88 |
initComponents(); |
|
89 |
} catch (BusquedaCatastralRemoteServiceException e) { |
|
90 |
throw e; |
|
91 |
} catch (Exception e) { |
|
92 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
93 |
throw new BusquedaCatastralCreatingPanelException(i18nManager.getTranslation("_error_creando_panel_busqueda_catastral"),e); |
|
94 |
} |
|
95 |
translate(); |
|
96 |
} |
|
97 |
|
|
98 |
public void addActionListener(ActionListener listener) { |
|
99 |
listeners.addActionListener(listener); |
|
100 |
} |
|
101 |
|
|
102 |
public void removeActionListener(ActionListener listener) { |
|
103 |
listeners.removeActionListener(listener); |
|
104 |
} |
|
105 |
|
|
106 |
private void translate() { |
|
107 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
108 |
|
|
109 |
lblReferenciaCatastral.setText(i18nManager.getTranslation(lblReferenciaCatastral.getText())); |
|
110 |
lblLocalizacion.setText(i18nManager.getTranslation(lblLocalizacion.getText())); |
|
111 |
lblProvincia.setText(i18nManager.getTranslation(lblProvincia.getText())); |
|
112 |
lblMunicipio.setText(i18nManager.getTranslation(lblMunicipio.getText())); |
|
113 |
btnMunicipios.setText(i18nManager.getTranslation(btnMunicipios.getText())); |
|
114 |
lblUrbanos.setText(i18nManager.getTranslation(lblUrbanos.getText())); |
|
115 |
lblVia.setText(i18nManager.getTranslation(lblVia.getText())); |
|
116 |
btnVias.setText(i18nManager.getTranslation(btnVias.getText())); |
|
117 |
lblNumero.setText(i18nManager.getTranslation(lblNumero.getText())); |
|
118 |
btnNumeros.setText(i18nManager.getTranslation(btnNumeros.getText())); |
|
119 |
lblBloque.setText(i18nManager.getTranslation(lblBloque.getText())); |
|
120 |
lblEscalera.setText(i18nManager.getTranslation(lblEscalera.getText())); |
|
121 |
lblPlanta.setText(i18nManager.getTranslation(lblPlanta.getText())); |
|
122 |
lblPuerta.setText(i18nManager.getTranslation(lblPuerta.getText())); |
|
123 |
lblRusticos.setText(i18nManager.getTranslation(lblRusticos.getText())); |
|
124 |
lblPoligono.setText(i18nManager.getTranslation(lblPoligono.getText())); |
|
125 |
lblParcela.setText(i18nManager.getTranslation(lblParcela.getText())); |
|
126 |
btnBorrarCache.setText(i18nManager.getTranslation(btnBorrarCache.getText())); |
|
127 |
btnBuscar.setText(i18nManager.getTranslation(btnBuscar.getText())); |
|
128 |
btnVerDatos.setText(i18nManager.getTranslation(btnVerDatos.getText())); |
|
129 |
btnLocalizar.setText(i18nManager.getTranslation(btnLocalizar.getText())); |
|
130 |
btnCancelar.setText(i18nManager.getTranslation(btnCancelar.getText())); |
|
131 |
btnBorrarPuntos.setText(i18nManager.getTranslation(btnBorrarPuntos.getText())); |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* |
|
136 |
*/ |
|
137 |
public void setLocate(Locale locale) { |
|
138 |
Locale l = super.getLocale(); |
|
139 |
if (!l.equals(locale)) { |
|
140 |
translate(); |
|
141 |
} |
|
142 |
super.setLocale(locale); |
|
143 |
} |
|
144 |
|
|
145 |
|
|
146 |
private void initComponents() throws BusquedaCatastralException{ |
|
147 |
final BusquedaCatastralManager busquedaCatastralManager = BusquedaCatastralLocator.getManager(); |
|
148 |
this.queryCatastral=busquedaCatastralManager.createQuery(); |
|
149 |
//Adds a control listener to call enable controls when a rdbtn or txt is modified. |
|
150 |
addEnableControlsListeners(); |
|
151 |
|
|
152 |
// Modelos del combo de provincias |
|
153 |
List<DynObject> provincias = busquedaCatastralManager.getProvincias(); |
|
154 |
String[] fieldNames = new String[]{BusquedaCatastralManager.CAMPO_PROVINCIA_ETIQUETA, BusquedaCatastralManager.CAMPO_PROVINCIA_CODIGO}; |
|
155 |
ComboBoxModel<DynObject> provinciasModel= new DynObjectComboBoxModel(provincias,fieldNames); |
|
156 |
|
|
157 |
// Renderer para combo de provincias |
|
158 |
ListCellRenderer<DynObject> provinciasCellRenderer = new DynObjectCellRenderer(BusquedaCatastralManager.CAMPO_PROVINCIA_ETIQUETA); |
|
159 |
// asignaci?n de renderers y modelos |
|
160 |
cmbProvincia.setRenderer(provinciasCellRenderer); |
|
161 |
cmbProvincia.setModel(provinciasModel); |
|
162 |
|
|
163 |
// listener del combo de provincias |
|
164 |
cmbProvincia.addItemListener(new ItemListener() { |
|
165 |
|
|
166 |
public void itemStateChanged(ItemEvent e) { |
|
167 |
Object item = e.getItem(); |
|
168 |
if (item instanceof DynObject) { |
|
169 |
DynObject provincia = (DynObject) item; |
|
170 |
updateProvincia(provincia); |
|
171 |
enableControls(); |
|
172 |
} |
|
173 |
} |
|
174 |
}); |
|
175 |
|
|
176 |
//ComboBox tipo Via |
|
177 |
ComboBoxModel<TipoVia> tiposViasModel = |
|
178 |
new DefaultComboBoxModel<TipoVia>(TipoVia.values()); |
|
179 |
cmbTipoVia.setModel(tiposViasModel); |
|
180 |
cmbTipoVia.setRenderer(new TipoViaCellRenderer()); |
|
181 |
cmbTipoVia.addItemListener(new ItemListener() { |
|
182 |
|
|
183 |
public void itemStateChanged(ItemEvent e) { |
|
184 |
Object item = e.getItem(); |
|
185 |
if (item instanceof TipoVia) { |
|
186 |
TipoVia tipoVia = (TipoVia) item; |
|
187 |
updateTipoVia(tipoVia); |
|
188 |
enableControls(); |
|
189 |
} |
|
190 |
} |
|
191 |
}); |
|
192 |
|
|
193 |
//Button Listeners |
|
194 |
this.btnBorrarCache.addActionListener(new ActionListener() { |
|
195 |
public void actionPerformed(ActionEvent e) { |
|
196 |
deleteCache(); |
|
197 |
} |
|
198 |
}); |
|
199 |
|
|
200 |
this.btnBuscar.addActionListener(new ActionListener() { |
|
201 |
public void actionPerformed(ActionEvent e) { |
|
202 |
buscarReferenciasCatastrales(); |
|
203 |
} |
|
204 |
}); |
|
205 |
|
|
206 |
this.btnLocalizar.addActionListener(new ActionListener() { |
|
207 |
public void actionPerformed(ActionEvent e) { |
|
208 |
selectedPanelAction=PanelAction.FOCUSTOPOINT; |
|
209 |
listeners.fireActionEvent(new ActionEvent(DefaultBusquedaCatastralConsultaCatastralPanelController.this, 0, "accept")); |
|
210 |
} |
|
211 |
}); |
|
212 |
|
|
213 |
this.btnBorrarPuntos.addActionListener(new ActionListener() { |
|
214 |
public void actionPerformed(ActionEvent e) { |
|
215 |
selectedPanelAction=PanelAction.DELETEPOINTS; |
|
216 |
listeners.fireActionEvent(new ActionEvent(DefaultBusquedaCatastralConsultaCatastralPanelController.this, 0, "accept")); |
|
217 |
} |
|
218 |
}); |
|
219 |
|
|
220 |
//this is not implemented yet |
|
221 |
this.btnVerDatos.setVisible(false); |
|
222 |
this.btnVerDatos.addActionListener(new ActionListener() { |
|
223 |
public void actionPerformed(ActionEvent e) { |
|
224 |
selectedPanelAction=PanelAction.SHOWDATA; |
|
225 |
listeners.fireActionEvent(new ActionEvent(DefaultBusquedaCatastralConsultaCatastralPanelController.this, 0, "accept")); |
|
226 |
} |
|
227 |
}); |
|
228 |
|
|
229 |
this.btnCancelar.addActionListener(new ActionListener() { |
|
230 |
public void actionPerformed(ActionEvent e) { |
|
231 |
selectedPanelAction=PanelAction.CANCEL; |
|
232 |
doClose(); |
|
233 |
listeners.fireActionEvent(new ActionEvent(DefaultBusquedaCatastralConsultaCatastralPanelController.this, 0, "cancel")); |
|
234 |
} |
|
235 |
}); |
|
236 |
|
|
237 |
listReferenciasCatastrales.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|
238 |
listReferenciasCatastrales.setModel(new ReferenciaCatastralListModel(referenciasCatastrales)); |
|
239 |
listReferenciasCatastrales.setCellRenderer(new ReferenciaCatastralCellRenderer()); |
|
240 |
listReferenciasCatastrales.addListSelectionListener(new ListSelectionListener() { |
|
241 |
@Override |
|
242 |
public void valueChanged(ListSelectionEvent e) { |
|
243 |
if (e.getSource() instanceof JList){ |
|
244 |
selectedReferenciaCatastral=(ReferenciaCatastral)listReferenciasCatastrales.getSelectedValue(); |
|
245 |
enableControls(); |
|
246 |
} |
|
247 |
} |
|
248 |
}); |
|
249 |
|
|
250 |
addBusquedasButtonListeners(); |
|
251 |
clear(); |
|
252 |
enableControls(); |
|
253 |
} |
|
254 |
|
|
255 |
private void enableControls(){ |
|
256 |
boolean referenciaCatastral=rbtnReferenciaCatastral.isSelected(); |
|
257 |
|
|
258 |
boolean provincia=rbtnLocalizacion.isSelected(); |
|
259 |
boolean municipios=provincia && cmbProvincia.getSelectedItem()!=null; |
|
260 |
boolean urbanos=rbtnLocalizacion.isSelected(); |
|
261 |
boolean rusticos=rbtnLocalizacion.isSelected(); |
|
262 |
|
|
263 |
boolean tipoVia=urbanos && rbtnUrbanos.isSelected() && municipios&&StringUtils.isNotEmpty(txtMunicipio.getText()); |
|
264 |
boolean vias=urbanos && rbtnUrbanos.isSelected()&&municipios&&StringUtils.isNotEmpty(txtMunicipio.getText()); |
|
265 |
boolean numeros=vias && StringUtils.isNotEmpty(txtVia.getText()); |
|
266 |
boolean opcionales=numeros && StringUtils.isNotEmpty(txtNumero.getText()); |
|
267 |
boolean poligono=rusticos && rbtnRusticos.isSelected() && municipios && StringUtils.isNotEmpty(txtMunicipio.getText()); |
|
268 |
|
|
269 |
txtReferenciaCatastral.setEnabled(referenciaCatastral); |
|
270 |
cmbProvincia.setEnabled(provincia); |
|
271 |
txtMunicipio.setEnabled(false); |
|
272 |
btnMunicipios.setEnabled(municipios); |
|
273 |
rbtnRusticos.setEnabled(rusticos); |
|
274 |
rbtnUrbanos.setEnabled(urbanos); |
|
275 |
cmbTipoVia.setEnabled(tipoVia); |
|
276 |
txtVia.setEnabled(false); |
|
277 |
btnVias.setEnabled(vias); |
|
278 |
txtNumero.setEnabled(numeros); |
|
279 |
btnNumeros.setEnabled(numeros); |
|
280 |
txtBloque.setEnabled(opcionales); |
|
281 |
txtEscalera.setEnabled(opcionales); |
|
282 |
txtPlanta.setEnabled(opcionales); |
|
283 |
txtPuerta.setEnabled(opcionales); |
|
284 |
txtPoligono.setEnabled(poligono); |
|
285 |
txtParcela.setEnabled(poligono); |
|
286 |
|
|
287 |
boolean buscar=( |
|
288 |
( referenciaCatastral && StringUtils.isNotEmpty(txtReferenciaCatastral.getText()) ) || |
|
289 |
( opcionales ) || |
|
290 |
( poligono && StringUtils.isNotEmpty(txtPoligono.getText()) && StringUtils.isNotEmpty(txtParcela.getText())) |
|
291 |
); |
|
292 |
btnBuscar.setEnabled(buscar); |
|
293 |
|
|
294 |
boolean rcSeleccionada=selectedReferenciaCatastral!=null; |
|
295 |
btnLocalizar.setEnabled(rcSeleccionada); |
|
296 |
btnVerDatos.setEnabled(rcSeleccionada); |
|
297 |
} |
|
298 |
|
|
299 |
private void doClose() { |
|
300 |
this.setVisible(false); |
|
301 |
} |
|
302 |
|
|
303 |
|
|
304 |
public JComponent asJComponent() { |
|
305 |
return this; |
|
306 |
} |
|
307 |
|
|
308 |
private boolean isValidQuery(QueryCatastral query){ |
|
309 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
310 |
try { |
|
311 |
queryCatastral.validateQuery(); |
|
312 |
} catch (BusquedaCatastralInvalidQueryException e) { |
|
313 |
logger.error("Error invalid query", e); |
|
314 |
JOptionPane.showMessageDialog( |
|
315 |
null, |
|
316 |
new StringBuilder().append(i18nManager.getTranslation("_error_invalid_query")) |
|
317 |
.append(":").append(e.getLocalizedMessage()), |
|
318 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
319 |
return false; |
|
320 |
} |
|
321 |
return true; |
|
322 |
} |
|
323 |
|
|
324 |
private void buscarReferenciasCatastrales(){ |
|
325 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
326 |
getDatosFormulario(); |
|
327 |
if (isValidQuery(queryCatastral)){ |
|
328 |
final SimpleTaskStatus taskStatus = |
|
329 |
ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus(i18nManager.getTranslation("progress")); |
|
330 |
Thread task = new Thread(new Runnable() { |
|
331 |
@Override |
|
332 |
public void run() { |
|
333 |
try { |
|
334 |
BusquedaCatastralManager busquedaCatastralManager = BusquedaCatastralLocator.getManager(); |
|
335 |
referenciasCatastrales = busquedaCatastralManager.getReferenciasCatastrales(queryCatastral); |
|
336 |
listReferenciasCatastrales.setCellRenderer(new ReferenciaCatastralCellRenderer()); |
|
337 |
listReferenciasCatastrales.setModel(new ReferenciaCatastralListModel((List<ReferenciaCatastral>)referenciasCatastrales)); |
|
338 |
taskStatus.terminate(); |
|
339 |
|
|
340 |
} catch (BusquedaCatastralException e) { |
|
341 |
taskStatus.abort(); |
|
342 |
logger.error("Error referencias catastrales", e); |
|
343 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
344 |
JOptionPane.showMessageDialog( |
|
345 |
null, |
|
346 |
new StringBuilder().append(i18nManager.getTranslation("_error_obtaining_data")) |
|
347 |
.append(":").append(e.getLocalizedMessage()), |
|
348 |
i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE); |
|
349 |
} |
|
350 |
} |
|
351 |
}); |
|
352 |
task.start(); |
|
353 |
|
|
354 |
final StringBuilder loadingDataStrBuilder=new StringBuilder(); |
|
355 |
loadingDataStrBuilder.append(i18nManager.getTranslation("_loading_data")); |
|
356 |
listReferenciasCatastrales.setCellRenderer(new DefaultListCellRenderer()); |
|
357 |
int delay = 1000; //milliseconds |
|
358 |
ActionListener taskPerformer = new ActionListener() { |
|
359 |
public void actionPerformed(ActionEvent evt) { |
|
360 |
if(taskStatus.isRunning()){ |
|
361 |
loadingDataStrBuilder.append("."); |
|
362 |
DefaultListModel<String> model=new DefaultListModel<String>(); |
|
363 |
model.addElement(loadingDataStrBuilder.toString()); |
|
364 |
listReferenciasCatastrales.setModel(model); |
|
365 |
} |
|
366 |
} |
|
367 |
}; |
|
368 |
new Timer(delay, taskPerformer).start(); |
|
369 |
|
|
370 |
} |
|
371 |
|
Also available in: Unified diff