svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extGeocoding / src / org / gvsig / geocoding / gui / GeocodingPanel.java @ 27140
History | View | Annotate | Download (34.9 KB)
1 | 26843 | vsanjaime | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
||
4 | * of the Valencian Government (CIT)
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 2
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | */
|
||
22 | |||
23 | /*
|
||
24 | * AUTHORS (In addition to CIT):
|
||
25 | * 2008 Prodevelop S.L. vsanjaime Programador
|
||
26 | */
|
||
27 | package org.gvsig.geocoding.gui; |
||
28 | |||
29 | import java.awt.Dimension; |
||
30 | import java.awt.GridBagConstraints; |
||
31 | import java.awt.event.MouseAdapter; |
||
32 | import java.awt.event.MouseEvent; |
||
33 | import java.awt.event.MouseListener; |
||
34 | import java.io.File; |
||
35 | import java.util.List; |
||
36 | |||
37 | import javax.swing.ButtonGroup; |
||
38 | import javax.swing.DefaultComboBoxModel; |
||
39 | import javax.swing.ImageIcon; |
||
40 | import javax.swing.JPanel; |
||
41 | import javax.swing.SwingConstants; |
||
42 | import javax.swing.table.JTableHeader; |
||
43 | import javax.swing.table.TableColumn; |
||
44 | |||
45 | import org.gvsig.geocoding.extension.GeocoController; |
||
46 | import org.gvsig.geocoding.gui.dynamic.OneStreetPanel; |
||
47 | import org.gvsig.geocoding.gui.dynamic.ThreeStreetPanel; |
||
48 | import org.gvsig.geocoding.gui.dynamic.TwoStreetPanel; |
||
49 | import org.gvsig.geocoding.gui.structure.GeocoStructurePanel; |
||
50 | import org.gvsig.geocoding.results.GeocoLocationSet; |
||
51 | import org.gvsig.geocoding.utils.GeocoUtils; |
||
52 | 26851 | vsanjaime | import org.gvsig.project.document.table.FeatureTableDocument; |
53 | 27140 | csanchez | import org.slf4j.Logger; |
54 | 26843 | vsanjaime | |
55 | import com.iver.andami.PluginServices; |
||
56 | import com.iver.andami.ui.mdiManager.IWindow; |
||
57 | import com.iver.andami.ui.mdiManager.SingletonWindow; |
||
58 | import com.iver.andami.ui.mdiManager.WindowInfo; |
||
59 | |||
60 | 26851 | vsanjaime | public class GeocodingPanel extends javax.swing.JPanel implements |
61 | SingletonWindow, MouseListener {
|
||
62 | 26843 | vsanjaime | |
63 | private static final long serialVersionUID = 1L; |
||
64 | private Logger log = PluginServices.getLogger(); |
||
65 | private GeocoController control = null; |
||
66 | private OneStreetPanel oneA = null; |
||
67 | private TwoStreetPanel twoA = null; |
||
68 | private ThreeStreetPanel threeA = null; |
||
69 | |||
70 | private static final String ROW = PluginServices.getText(null, "row") |
||
71 | + " : ";
|
||
72 | |||
73 | private ButtonGroup groupRadio; |
||
74 | private javax.swing.JButton jButExit;
|
||
75 | private javax.swing.JButton jButLoad;
|
||
76 | private javax.swing.JButton jButNew;
|
||
77 | private javax.swing.JButton jButNext;
|
||
78 | private javax.swing.JButton jButPrevious;
|
||
79 | private javax.swing.JButton jButSearch;
|
||
80 | private javax.swing.JButton jButExport;
|
||
81 | private javax.swing.JComboBox jComboTable;
|
||
82 | private javax.swing.JComboBox jComboType;
|
||
83 | private javax.swing.JLabel jLabAccuracy;
|
||
84 | private javax.swing.JLabel jLabMaxResults;
|
||
85 | private javax.swing.JLabel jLabPatternPath;
|
||
86 | private javax.swing.JLabel jLabPercent1;
|
||
87 | private javax.swing.JLabel jLabPercent2;
|
||
88 | private javax.swing.JLabel jLabQuality;
|
||
89 | private javax.swing.JLabel jLabStructure;
|
||
90 | private javax.swing.JLabel jLabType;
|
||
91 | private javax.swing.JLabel jLabRow;
|
||
92 | private javax.swing.JPanel jPanButtons;
|
||
93 | private javax.swing.JPanel jPanDynamic;
|
||
94 | private javax.swing.JPanel jPanGeocodingType;
|
||
95 | private javax.swing.JPanel jPanPattern;
|
||
96 | private javax.swing.JPanel jPanResults;
|
||
97 | private javax.swing.JPanel jPanResultsButtons;
|
||
98 | private javax.swing.JPanel jPanSettings;
|
||
99 | private javax.swing.JPanel jPanSimpleTable;
|
||
100 | private javax.swing.JPanel jPanTable;
|
||
101 | private javax.swing.JPanel jPanType;
|
||
102 | private javax.swing.JRadioButton jRadioSimple;
|
||
103 | private javax.swing.JRadioButton jRadioTable;
|
||
104 | private javax.swing.JScrollPane jScrollResults;
|
||
105 | private javax.swing.JTable jTableResults;
|
||
106 | private javax.swing.JTextField jTextAccuracy;
|
||
107 | private javax.swing.JTextField jTextMaxResults;
|
||
108 | private javax.swing.JTextField jTextPatternPath;
|
||
109 | private javax.swing.JTextField jTextQuality;
|
||
110 | |||
111 | /**
|
||
112 | * Constructor
|
||
113 | *
|
||
114 | * @param _control
|
||
115 | */
|
||
116 | public GeocodingPanel(GeocoController _control) {
|
||
117 | this.control = _control;
|
||
118 | this.initComponents();
|
||
119 | this.setMesages();
|
||
120 | this.setImages();
|
||
121 | |||
122 | /* Insert the address type dynamic panel (1 address) */
|
||
123 | oneA = new OneStreetPanel(control);
|
||
124 | twoA = new TwoStreetPanel(control);
|
||
125 | threeA = new ThreeStreetPanel(control);
|
||
126 | insertDynamicPanel(oneA); |
||
127 | this.control.getGmodel().setPattern(null); |
||
128 | |||
129 | } |
||
130 | |||
131 | private void setImages() { |
||
132 | String baseDir = PluginServices.getPluginServices(this) |
||
133 | .getClassLoader().getBaseDir(); |
||
134 | |||
135 | jButLoad |
||
136 | .setIcon(new ImageIcon(baseDir + File.separator + "images" |
||
137 | + File.separator + "icons16" + File.separator |
||
138 | + "file-open.png"));
|
||
139 | jButNew.setIcon(new ImageIcon(baseDir + File.separator + "images" |
||
140 | + File.separator + "icons16" + File.separator |
||
141 | + "document-new.png"));
|
||
142 | |||
143 | jButNext.setIcon(new ImageIcon(baseDir + File.separator + "images" |
||
144 | + File.separator + "icons16" + File.separator + "go-next.png")); |
||
145 | |||
146 | jButPrevious.setIcon(new ImageIcon(baseDir + File.separator + "images" |
||
147 | + File.separator + "icons16" + File.separator |
||
148 | + "go-previous.png"));
|
||
149 | |||
150 | jButSearch.setIcon(new ImageIcon(baseDir + File.separator + "images" |
||
151 | + File.separator + "icons16" + File.separator |
||
152 | + "system-search.png"));
|
||
153 | |||
154 | jButExit.setIcon(new ImageIcon(baseDir + File.separator + "images" |
||
155 | + File.separator + "icons16" + File.separator |
||
156 | + "system-log-out.png"));
|
||
157 | |||
158 | jButExport.setIcon(new ImageIcon(baseDir + File.separator + "images" |
||
159 | + File.separator + "icons16" + File.separator + "go-up.png")); |
||
160 | |||
161 | } |
||
162 | |||
163 | private void setMesages() { |
||
164 | PluginServices ps = PluginServices.getPluginServices(this);
|
||
165 | |||
166 | jPanPattern |
||
167 | .setBorder(GeocoUtils.getTitledBorder(ps.getText("pattern")));
|
||
168 | |||
169 | this.jButLoad.setToolTipText(ps.getText("butloadpattern")); |
||
170 | |||
171 | this.jButNew.setToolTipText(ps.getText("butnewpattern")); |
||
172 | |||
173 | this.jLabPatternPath.setText(ps.getText("patternpath")); |
||
174 | |||
175 | jPanGeocodingType.setBorder(GeocoUtils.getTitledBorder(ps |
||
176 | .getText("gtype")));
|
||
177 | |||
178 | this.jRadioSimple.setText(ps.getText("gsimple")); |
||
179 | this.jRadioSimple.setToolTipText(ps.getText("gsimpletip")); |
||
180 | |||
181 | this.jRadioTable.setText(ps.getText("gtable")); |
||
182 | this.jRadioTable.setToolTipText(ps.getText("gtabletip")); |
||
183 | |||
184 | jPanType.setBorder(GeocoUtils.getTitledBorder(ps.getText("atype")));
|
||
185 | this.jLabType.setText(ps.getText("type")); |
||
186 | |||
187 | jPanSettings.setBorder(GeocoUtils.getTitledBorder(ps |
||
188 | .getText("settings")));
|
||
189 | this.jLabAccuracy.setText(ps.getText("accuracy")); |
||
190 | this.jLabMaxResults.setText(ps.getText("maxresults")); |
||
191 | this.jLabQuality.setText(ps.getText("quality")); |
||
192 | jTextMaxResults.setToolTipText(ps.getText("maxresultstip"));
|
||
193 | jTextAccuracy.setToolTipText(ps.getText("accuracytip"));
|
||
194 | jTextQuality.setToolTipText(ps.getText("qualitytip"));
|
||
195 | |||
196 | jPanResults |
||
197 | .setBorder(GeocoUtils.getTitledBorder(ps.getText("results")));
|
||
198 | |||
199 | this.jButPrevious.setToolTipText(ps.getText("previoustip")); |
||
200 | this.jButNext.setToolTipText(ps.getText("nexttip")); |
||
201 | |||
202 | this.jButExit.setText(ps.getText("exit")); |
||
203 | this.jButSearch.setText(ps.getText("search")); |
||
204 | this.jButExport.setText(ps.getText("export")); |
||
205 | |||
206 | } |
||
207 | |||
208 | /**
|
||
209 | * Components
|
||
210 | */
|
||
211 | private void initComponents() { |
||
212 | |||
213 | this.setFocusable(true); |
||
214 | this.addMouseListener(this); |
||
215 | |||
216 | java.awt.GridBagConstraints gridBagConstraints; |
||
217 | |||
218 | groupRadio = new javax.swing.ButtonGroup();
|
||
219 | jPanPattern = new javax.swing.JPanel();
|
||
220 | jLabPatternPath = new javax.swing.JLabel();
|
||
221 | jTextPatternPath = new javax.swing.JTextField();
|
||
222 | jButLoad = new javax.swing.JButton();
|
||
223 | jButNew = new javax.swing.JButton();
|
||
224 | jLabStructure = new javax.swing.JLabel();
|
||
225 | jPanGeocodingType = new javax.swing.JPanel();
|
||
226 | jPanSimpleTable = new javax.swing.JPanel();
|
||
227 | jRadioSimple = new javax.swing.JRadioButton();
|
||
228 | jPanTable = new javax.swing.JPanel();
|
||
229 | jComboTable = new javax.swing.JComboBox();
|
||
230 | jRadioTable = new javax.swing.JRadioButton();
|
||
231 | jPanType = new javax.swing.JPanel();
|
||
232 | jComboType = new javax.swing.JComboBox();
|
||
233 | jLabType = new javax.swing.JLabel();
|
||
234 | jLabRow = new javax.swing.JLabel();
|
||
235 | jPanDynamic = new javax.swing.JPanel();
|
||
236 | jPanSettings = new javax.swing.JPanel();
|
||
237 | jLabMaxResults = new javax.swing.JLabel();
|
||
238 | jTextMaxResults = new javax.swing.JTextField();
|
||
239 | jLabQuality = new javax.swing.JLabel();
|
||
240 | jTextQuality = new javax.swing.JTextField();
|
||
241 | jLabPercent1 = new javax.swing.JLabel();
|
||
242 | jLabAccuracy = new javax.swing.JLabel();
|
||
243 | jTextAccuracy = new javax.swing.JTextField();
|
||
244 | jLabPercent2 = new javax.swing.JLabel();
|
||
245 | jPanResults = new javax.swing.JPanel();
|
||
246 | jScrollResults = new javax.swing.JScrollPane();
|
||
247 | jTableResults = new javax.swing.JTable();
|
||
248 | jPanResultsButtons = new javax.swing.JPanel();
|
||
249 | jButNext = new javax.swing.JButton();
|
||
250 | jButPrevious = new javax.swing.JButton();
|
||
251 | jPanButtons = new javax.swing.JPanel();
|
||
252 | jButExit = new javax.swing.JButton();
|
||
253 | jButSearch = new javax.swing.JButton();
|
||
254 | jButExport = new javax.swing.JButton();
|
||
255 | |||
256 | setLayout(new java.awt.GridBagLayout());
|
||
257 | |||
258 | jPanPattern.setBorder(javax.swing.BorderFactory |
||
259 | .createTitledBorder("Pattern"));
|
||
260 | jPanPattern.setLayout(new java.awt.GridBagLayout());
|
||
261 | |||
262 | jLabPatternPath.setText("Name");
|
||
263 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
264 | gridBagConstraints.gridx = 0;
|
||
265 | gridBagConstraints.gridy = 0;
|
||
266 | gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 3); |
||
267 | jPanPattern.add(jLabPatternPath, gridBagConstraints); |
||
268 | |||
269 | jTextPatternPath.setEditable(false);
|
||
270 | jTextPatternPath.setToolTipText("Pattern file");
|
||
271 | |||
272 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
273 | gridBagConstraints.gridx = 1;
|
||
274 | gridBagConstraints.gridy = 0;
|
||
275 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
276 | gridBagConstraints.weightx = 1.0;
|
||
277 | jPanPattern.add(jTextPatternPath, gridBagConstraints); |
||
278 | |||
279 | jButLoad.setText("");
|
||
280 | jButLoad.setToolTipText("Load pattern");
|
||
281 | jButLoad.setMaximumSize(new java.awt.Dimension(35, 25)); |
||
282 | jButLoad.setMinimumSize(new java.awt.Dimension(30, 25)); |
||
283 | jButLoad.setPreferredSize(new java.awt.Dimension(30, 25)); |
||
284 | jButLoad.addActionListener(new java.awt.event.ActionListener() {
|
||
285 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
||
286 | evLoadPattern(evt); |
||
287 | } |
||
288 | }); |
||
289 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
290 | gridBagConstraints.gridx = 2;
|
||
291 | gridBagConstraints.gridy = 0;
|
||
292 | gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2); |
||
293 | jPanPattern.add(jButLoad, gridBagConstraints); |
||
294 | |||
295 | jButNew.setText("");
|
||
296 | jButNew.setToolTipText("New");
|
||
297 | jButNew.setMaximumSize(new java.awt.Dimension(35, 25)); |
||
298 | jButNew.setMinimumSize(new java.awt.Dimension(30, 25)); |
||
299 | jButNew.setPreferredSize(new java.awt.Dimension(30, 25)); |
||
300 | jButNew.addActionListener(new java.awt.event.ActionListener() {
|
||
301 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
||
302 | evNewPattern(evt); |
||
303 | } |
||
304 | }); |
||
305 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
306 | gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5); |
||
307 | jPanPattern.add(jButNew, gridBagConstraints); |
||
308 | |||
309 | jLabStructure.setFont(new java.awt.Font("Tahoma", 1, 11)); |
||
310 | jLabStructure.setText("|...|");
|
||
311 | jLabStructure |
||
312 | .setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
||
313 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
314 | gridBagConstraints.gridx = 0;
|
||
315 | gridBagConstraints.gridy = 2;
|
||
316 | gridBagConstraints.gridwidth = 4;
|
||
317 | gridBagConstraints.insets = new java.awt.Insets(5, 10, 2, 10); |
||
318 | jPanPattern.add(jLabStructure, gridBagConstraints); |
||
319 | |||
320 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
321 | gridBagConstraints.gridx = 0;
|
||
322 | gridBagConstraints.gridy = 0;
|
||
323 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
324 | gridBagConstraints.weightx = 1.0;
|
||
325 | gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
||
326 | add(jPanPattern, gridBagConstraints); |
||
327 | |||
328 | jPanGeocodingType.setBorder(javax.swing.BorderFactory |
||
329 | .createTitledBorder("Geocoding type"));
|
||
330 | jPanGeocodingType.setLayout(new java.awt.GridBagLayout());
|
||
331 | jPanSimpleTable.setLayout(new java.awt.GridBagLayout());
|
||
332 | |||
333 | groupRadio.add(jRadioSimple); |
||
334 | jRadioSimple.setSelected(true);
|
||
335 | jRadioSimple.setEnabled(false);
|
||
336 | jRadioSimple.setText("Simple geocoding");
|
||
337 | jRadioSimple.setToolTipText("Simple geocoding");
|
||
338 | jRadioSimple.addActionListener(new java.awt.event.ActionListener() {
|
||
339 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
||
340 | evSimpleGeocoding(evt); |
||
341 | } |
||
342 | }); |
||
343 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
344 | gridBagConstraints.gridx = 0;
|
||
345 | gridBagConstraints.gridy = 0;
|
||
346 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
347 | gridBagConstraints.weightx = 1.0;
|
||
348 | gridBagConstraints.insets = new java.awt.Insets(0, 50, 0, 10); |
||
349 | jPanSimpleTable.add(jRadioSimple, gridBagConstraints); |
||
350 | |||
351 | jPanTable.setLayout(new java.awt.GridBagLayout());
|
||
352 | |||
353 | jComboTable.setModel(new javax.swing.DefaultComboBoxModel(
|
||
354 | new String[] { "" })); |
||
355 | jComboTable.setMinimumSize(new java.awt.Dimension(150, 18)); |
||
356 | jComboTable.setPreferredSize(new java.awt.Dimension(200, 22)); |
||
357 | |||
358 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
359 | gridBagConstraints.gridx = 1;
|
||
360 | gridBagConstraints.gridy = 0;
|
||
361 | jComboTable.setEnabled(false);
|
||
362 | jPanTable.add(jComboTable, gridBagConstraints); |
||
363 | |||
364 | groupRadio.add(jRadioTable); |
||
365 | jRadioTable.setText("Table geocoding");
|
||
366 | jRadioTable.setEnabled(false);
|
||
367 | jRadioTable.setToolTipText("Table geocoding");
|
||
368 | jRadioTable.addActionListener(new java.awt.event.ActionListener() {
|
||
369 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
||
370 | evTableGeocoding(evt); |
||
371 | } |
||
372 | }); |
||
373 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
374 | gridBagConstraints.gridx = 0;
|
||
375 | gridBagConstraints.gridy = 0;
|
||
376 | gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 2); |
||
377 | jPanTable.add(jRadioTable, gridBagConstraints); |
||
378 | |||
379 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
380 | gridBagConstraints.gridx = 1;
|
||
381 | gridBagConstraints.gridy = 0;
|
||
382 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
383 | gridBagConstraints.weightx = 1.0;
|
||
384 | jPanSimpleTable.add(jPanTable, gridBagConstraints); |
||
385 | |||
386 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
387 | gridBagConstraints.gridx = 0;
|
||
388 | gridBagConstraints.gridy = 0;
|
||
389 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
390 | gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
||
391 | jPanGeocodingType.add(jPanSimpleTable, gridBagConstraints); |
||
392 | |||
393 | jPanType.setBorder(javax.swing.BorderFactory |
||
394 | .createTitledBorder("Search Type"));
|
||
395 | jPanType.setLayout(new java.awt.GridBagLayout());
|
||
396 | |||
397 | String[] atypes = { PluginServices.getText(null, "typeA"), |
||
398 | PluginServices.getText(null, "typeB"), |
||
399 | PluginServices.getText(null, "typeC") }; |
||
400 | jComboType.setEnabled(false);
|
||
401 | jComboType.setModel(new javax.swing.DefaultComboBoxModel(atypes));
|
||
402 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
403 | gridBagConstraints.gridx = 1;
|
||
404 | gridBagConstraints.gridy = 0;
|
||
405 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
406 | gridBagConstraints.weightx = 1.0;
|
||
407 | gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 40); |
||
408 | jComboType.addActionListener(new java.awt.event.ActionListener() {
|
||
409 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
||
410 | evComboSelectType(evt); |
||
411 | } |
||
412 | }); |
||
413 | jPanType.add(jComboType, gridBagConstraints); |
||
414 | |||
415 | jLabType.setText("Type");
|
||
416 | jLabType.setEnabled(false);
|
||
417 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
418 | gridBagConstraints.gridx = 0;
|
||
419 | gridBagConstraints.gridy = 0;
|
||
420 | gridBagConstraints.insets = new java.awt.Insets(0, 40, 0, 0); |
||
421 | jPanType.add(jLabType, gridBagConstraints); |
||
422 | |||
423 | jPanDynamic.setLayout(new java.awt.GridBagLayout());
|
||
424 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
425 | gridBagConstraints.gridx = 0;
|
||
426 | gridBagConstraints.gridy = 1;
|
||
427 | gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0); |
||
428 | gridBagConstraints.gridwidth = 2;
|
||
429 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
430 | gridBagConstraints.weightx = 1.0;
|
||
431 | jPanType.add(jPanDynamic, gridBagConstraints); |
||
432 | |||
433 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
434 | gridBagConstraints.gridx = 0;
|
||
435 | gridBagConstraints.gridy = 1;
|
||
436 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
437 | gridBagConstraints.weightx = 1.0;
|
||
438 | gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); |
||
439 | jPanGeocodingType.add(jPanType, gridBagConstraints); |
||
440 | |||
441 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
442 | gridBagConstraints.gridx = 0;
|
||
443 | gridBagConstraints.gridy = 1;
|
||
444 | gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
||
445 | |||
446 | gridBagConstraints.insets = new java.awt.Insets(1, 2, 1, 2); |
||
447 | add(jPanGeocodingType, gridBagConstraints); |
||
448 | |||
449 | jPanSettings.setBorder(javax.swing.BorderFactory |
||
450 | .createTitledBorder("Settings"));
|
||
451 | jPanSettings.setLayout(new java.awt.GridBagLayout());
|
||
452 | |||
453 | jLabMaxResults.setText("Max Results");
|
||
454 | jLabMaxResults.setEnabled(false);
|
||
455 | jLabMaxResults |
||
456 | .setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
||
457 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
458 | gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); |
||
459 | jPanSettings.add(jLabMaxResults, gridBagConstraints); |
||
460 | |||
461 | jTextMaxResults.setMinimumSize(new java.awt.Dimension(40, 19)); |
||
462 | jTextMaxResults.setEnabled(false);
|
||
463 | jTextMaxResults.setPreferredSize(new java.awt.Dimension(40, 19)); |
||
464 | jTextMaxResults.addFocusListener(new java.awt.event.FocusAdapter() {
|
||
465 | public void focusLost(java.awt.event.FocusEvent evt) { |
||
466 | evChangeMaxresults(evt); |
||
467 | } |
||
468 | }); |
||
469 | jPanSettings.add(jTextMaxResults, new java.awt.GridBagConstraints());
|
||
470 | |||
471 | jLabQuality.setText("Quality");
|
||
472 | jLabQuality.setEnabled(false);
|
||
473 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
474 | gridBagConstraints.insets = new java.awt.Insets(0, 30, 0, 3); |
||
475 | jPanSettings.add(jLabQuality, gridBagConstraints); |
||
476 | |||
477 | jTextQuality.setEnabled(false);
|
||
478 | jTextQuality.setMinimumSize(new java.awt.Dimension(40, 19)); |
||
479 | jTextQuality.setPreferredSize(new java.awt.Dimension(40, 19)); |
||
480 | jTextQuality.addFocusListener(new java.awt.event.FocusAdapter() {
|
||
481 | public void focusLost(java.awt.event.FocusEvent evt) { |
||
482 | evChangeQuality(evt); |
||
483 | } |
||
484 | }); |
||
485 | jPanSettings.add(jTextQuality, new java.awt.GridBagConstraints());
|
||
486 | |||
487 | jLabPercent1.setText("%");
|
||
488 | jLabPercent1.setEnabled(false);
|
||
489 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
490 | gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 0); |
||
491 | jPanSettings.add(jLabPercent1, gridBagConstraints); |
||
492 | |||
493 | jLabAccuracy.setText("Accuracy");
|
||
494 | jLabAccuracy.setEnabled(false);
|
||
495 | ; |
||
496 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
497 | gridBagConstraints.insets = new java.awt.Insets(0, 30, 0, 3); |
||
498 | jPanSettings.add(jLabAccuracy, gridBagConstraints); |
||
499 | |||
500 | jTextAccuracy.setEnabled(false);
|
||
501 | jTextAccuracy.setMinimumSize(new java.awt.Dimension(40, 19)); |
||
502 | jTextAccuracy.setPreferredSize(new java.awt.Dimension(40, 19)); |
||
503 | jTextAccuracy.addFocusListener(new java.awt.event.FocusAdapter() {
|
||
504 | public void focusLost(java.awt.event.FocusEvent evt) { |
||
505 | evChangeAccuracy(evt); |
||
506 | } |
||
507 | }); |
||
508 | jPanSettings.add(jTextAccuracy, new java.awt.GridBagConstraints());
|
||
509 | |||
510 | jLabPercent2.setText("%");
|
||
511 | jLabPercent2.setEnabled(false);
|
||
512 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
513 | gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 0); |
||
514 | jPanSettings.add(jLabPercent2, gridBagConstraints); |
||
515 | |||
516 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
517 | gridBagConstraints.gridx = 0;
|
||
518 | gridBagConstraints.gridy = 2;
|
||
519 | gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
||
520 | gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; |
||
521 | gridBagConstraints.insets = new java.awt.Insets(1, 2, 1, 2); |
||
522 | add(jPanSettings, gridBagConstraints); |
||
523 | |||
524 | jPanResults.setBorder(javax.swing.BorderFactory |
||
525 | .createTitledBorder("Results"));
|
||
526 | jPanResults.setLayout(new java.awt.GridBagLayout());
|
||
527 | jTableResults.setEnabled(false);
|
||
528 | jTableResults.setModel(new TableResultsModel());
|
||
529 | TableColumn col0 = jTableResults.getColumnModel().getColumn(0); |
||
530 | col0.setPreferredWidth(50);
|
||
531 | TableColumn col1 = jTableResults.getColumnModel().getColumn(1); |
||
532 | col1.setPreferredWidth(50);
|
||
533 | TableColumn col2 = jTableResults.getColumnModel().getColumn(2); |
||
534 | col2.setPreferredWidth(50);
|
||
535 | jScrollResults.setViewportView(jTableResults); |
||
536 | |||
537 | JTableHeader header = jTableResults.getTableHeader();
|
||
538 | |||
539 | header.addMouseListener(new MouseAdapter() { |
||
540 | public void mouseClicked(MouseEvent e) { |
||
541 | JTableHeader h = (JTableHeader) e.getSource(); |
||
542 | int nColumn = h.columnAtPoint(e.getPoint());
|
||
543 | |||
544 | if (nColumn == 1 || nColumn == 2) { |
||
545 | ((TableResultsModel) jTableResults.getModel()) |
||
546 | .sort(nColumn); |
||
547 | jTableResults.validate(); |
||
548 | } |
||
549 | } |
||
550 | }); |
||
551 | |||
552 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
553 | gridBagConstraints.gridx = 0;
|
||
554 | gridBagConstraints.gridy = 0;
|
||
555 | gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
||
556 | gridBagConstraints.weightx = 1.0;
|
||
557 | gridBagConstraints.weighty = 1.0;
|
||
558 | jPanResults.add(jScrollResults, gridBagConstraints); |
||
559 | |||
560 | jPanResultsButtons.setLayout(new java.awt.GridBagLayout());
|
||
561 | |||
562 | jButNext.setText("");
|
||
563 | jButNext.setToolTipText("Next register");
|
||
564 | jButNext.setEnabled(false);
|
||
565 | jButNext.setPreferredSize(new Dimension(35, 25)); |
||
566 | jButNext.setMaximumSize(new Dimension(35, 25)); |
||
567 | jButNext.addActionListener(new java.awt.event.ActionListener() {
|
||
568 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
||
569 | evNextButton(evt); |
||
570 | } |
||
571 | }); |
||
572 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
573 | gridBagConstraints.gridx = 2;
|
||
574 | gridBagConstraints.gridy = 0;
|
||
575 | gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; |
||
576 | jPanResultsButtons.add(jButNext, gridBagConstraints); |
||
577 | |||
578 | jLabRow.setText("");
|
||
579 | jLabRow.setEnabled(false);
|
||
580 | jLabRow.setHorizontalAlignment(SwingConstants.CENTER);
|
||
581 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
582 | gridBagConstraints.gridx = 1;
|
||
583 | gridBagConstraints.gridy = 0;
|
||
584 | gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 5); |
||
585 | gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER; |
||
586 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
587 | gridBagConstraints.weightx = 1.0;
|
||
588 | jPanResultsButtons.add(jLabRow, gridBagConstraints); |
||
589 | |||
590 | jButPrevious.setText("");
|
||
591 | jButPrevious.setToolTipText("Previous register");
|
||
592 | jButPrevious.setEnabled(false);
|
||
593 | jButPrevious.setMaximumSize(new Dimension(35, 25)); |
||
594 | jButPrevious.setPreferredSize(new Dimension(35, 25)); |
||
595 | jButPrevious.addKeyListener(new java.awt.event.KeyAdapter() {
|
||
596 | public void keyReleased(java.awt.event.KeyEvent evt) { |
||
597 | evPreviousButton(evt); |
||
598 | } |
||
599 | }); |
||
600 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
601 | gridBagConstraints.gridx = 0;
|
||
602 | gridBagConstraints.gridy = 0;
|
||
603 | gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
||
604 | jPanResultsButtons.add(jButPrevious, gridBagConstraints); |
||
605 | |||
606 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
607 | gridBagConstraints.gridx = 0;
|
||
608 | gridBagConstraints.gridy = 1;
|
||
609 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
610 | gridBagConstraints.weightx = 1.0;
|
||
611 | gridBagConstraints.insets = new java.awt.Insets(1, 0, 0, 0); |
||
612 | jPanResults.add(jPanResultsButtons, gridBagConstraints); |
||
613 | |||
614 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
615 | gridBagConstraints.gridx = 0;
|
||
616 | gridBagConstraints.gridy = 3;
|
||
617 | gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
||
618 | gridBagConstraints.weightx = 1.0;
|
||
619 | gridBagConstraints.weighty = 1.0;
|
||
620 | gridBagConstraints.insets = new java.awt.Insets(1, 2, 1, 2); |
||
621 | add(jPanResults, gridBagConstraints); |
||
622 | |||
623 | jPanButtons.setLayout(new java.awt.GridBagLayout());
|
||
624 | |||
625 | jButExit.setText("Exit");
|
||
626 | jButExit.setToolTipText("Exit");
|
||
627 | jButExit.addActionListener(new java.awt.event.ActionListener() {
|
||
628 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
||
629 | evExit(evt); |
||
630 | } |
||
631 | }); |
||
632 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
633 | gridBagConstraints.gridx = 2;
|
||
634 | gridBagConstraints.gridy = 0;
|
||
635 | gridBagConstraints.insets = new java.awt.Insets(0, 20, 0, 0); |
||
636 | jPanButtons.add(jButExit, gridBagConstraints); |
||
637 | |||
638 | jButSearch.setText("Search");
|
||
639 | jButSearch.setToolTipText("Search");
|
||
640 | jButSearch.setEnabled(false);
|
||
641 | jButSearch.addActionListener(new java.awt.event.ActionListener() {
|
||
642 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
||
643 | evSearch(evt); |
||
644 | } |
||
645 | }); |
||
646 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
647 | gridBagConstraints.gridx = 0;
|
||
648 | gridBagConstraints.gridy = 0;
|
||
649 | jPanButtons.add(jButSearch, gridBagConstraints); |
||
650 | |||
651 | jButExport.setText("Export");
|
||
652 | jButExport.setToolTipText("Export");
|
||
653 | jButExport.setEnabled(false);
|
||
654 | jButExport.addActionListener(new java.awt.event.ActionListener() {
|
||
655 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
||
656 | evExport(evt); |
||
657 | } |
||
658 | }); |
||
659 | jPanButtons.add(jButExport, new java.awt.GridBagConstraints());
|
||
660 | |||
661 | gridBagConstraints = new java.awt.GridBagConstraints();
|
||
662 | gridBagConstraints.gridx = 0;
|
||
663 | gridBagConstraints.gridy = 4;
|
||
664 | gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
||
665 | gridBagConstraints.weightx = 1.0;
|
||
666 | gridBagConstraints.insets = new java.awt.Insets(2, 2, 4, 2); |
||
667 | add(jPanButtons, gridBagConstraints); |
||
668 | } |
||
669 | |||
670 | /**
|
||
671 | *
|
||
672 | * @param evt
|
||
673 | */
|
||
674 | private void evLoadPattern(java.awt.event.ActionEvent evt) { |
||
675 | /* load the pattern */
|
||
676 | boolean apto = control.loadPatternXML();
|
||
677 | String strpat = ""; |
||
678 | |||
679 | if (apto) {
|
||
680 | /* Pattern structure */
|
||
681 | strpat = control.showPatternStructure(); |
||
682 | jLabStructure.setText(strpat); |
||
683 | |||
684 | /* update the url of the pattern in the panel */
|
||
685 | if (control.getGmodel().getPatternFile() != null) { |
||
686 | jTextPatternPath.setText(control.getGmodel().getPatternFile() |
||
687 | .getAbsolutePath()); |
||
688 | } |
||
689 | /* update the parameters */
|
||
690 | jTextMaxResults.setText(Integer.toString(control.getPattern()
|
||
691 | .getSettings().getResults())); |
||
692 | jTextAccuracy.setText(Integer.toString(control.getPattern()
|
||
693 | .getSettings().getAccuracy())); |
||
694 | jTextQuality.setText(Integer.toString(control.getPattern()
|
||
695 | .getSettings().getQuality())); |
||
696 | |||
697 | // enable components
|
||
698 | if (control.getPattern() != null) { |
||
699 | this.enableComponents();
|
||
700 | this.getOneA().enableComponents(true); |
||
701 | } |
||
702 | } |
||
703 | } |
||
704 | |||
705 | /**
|
||
706 | *
|
||
707 | * @param evt
|
||
708 | */
|
||
709 | private void evNewPattern(java.awt.event.ActionEvent evt) { |
||
710 | control.launchNewPatternPanel(); |
||
711 | } |
||
712 | |||
713 | /**
|
||
714 | *
|
||
715 | * @param evt
|
||
716 | */
|
||
717 | private void evSimpleGeocoding(java.awt.event.ActionEvent evt) { |
||
718 | control.getGmodel().setSimple(true);
|
||
719 | activeTableFunctionaties(false);
|
||
720 | jButExport.setEnabled(false);
|
||
721 | } |
||
722 | |||
723 | /**
|
||
724 | *
|
||
725 | * @param evt
|
||
726 | */
|
||
727 | private void evTableGeocoding(java.awt.event.ActionEvent evt) { |
||
728 | /* Put the tables names availables in the combo */
|
||
729 | DefaultComboBoxModel comboModel = control.getModelgvSIGTables();
|
||
730 | if (comboModel == null) { |
||
731 | comboModel = new DefaultComboBoxModel(); |
||
732 | } |
||
733 | /* save in the model table geocoding */
|
||
734 | jComboTable.setModel(comboModel); |
||
735 | /* enable components */
|
||
736 | control.getGmodel().setSimple(false);
|
||
737 | jComboTable.setEnabled(true);
|
||
738 | jButExport.setEnabled(false);
|
||
739 | |||
740 | } |
||
741 | |||
742 | /**
|
||
743 | *
|
||
744 | * @param evt
|
||
745 | */
|
||
746 | private void evComboSelectType(java.awt.event.ActionEvent evt) { |
||
747 | int type = jComboType.getSelectedIndex();
|
||
748 | switch (type) {
|
||
749 | case 0: |
||
750 | insertDynamicPanel(oneA); |
||
751 | break;
|
||
752 | case 1: |
||
753 | insertDynamicPanel(twoA); |
||
754 | break;
|
||
755 | case 2: |
||
756 | insertDynamicPanel(threeA); |
||
757 | break;
|
||
758 | } |
||
759 | } |
||
760 | |||
761 | /**
|
||
762 | *
|
||
763 | * @param evt
|
||
764 | */
|
||
765 | private void evChangeMaxresults(java.awt.event.FocusEvent evt) { |
||
766 | String max = jTextMaxResults.getText().trim();
|
||
767 | int maxresults;
|
||
768 | try {
|
||
769 | maxresults = Integer.parseInt(max);
|
||
770 | if (maxresults < 1) { |
||
771 | maxresults = 1;
|
||
772 | jTextMaxResults.setText(Integer.toString(maxresults));
|
||
773 | } |
||
774 | } catch (Exception e) { |
||
775 | maxresults = control.getPattern().getSettings().getResults(); |
||
776 | jTextMaxResults.setText(Integer.toString(maxresults));
|
||
777 | } |
||
778 | } |
||
779 | |||
780 | /**
|
||
781 | *
|
||
782 | * @param evt
|
||
783 | */
|
||
784 | private void evChangeQuality(java.awt.event.FocusEvent evt) { |
||
785 | String qual = jTextQuality.getText().trim();
|
||
786 | int quality;
|
||
787 | try {
|
||
788 | quality = Integer.parseInt(qual);
|
||
789 | if (quality < 0) { |
||
790 | quality = 0;
|
||
791 | jTextQuality.setText(Integer.toString(quality));
|
||
792 | } |
||
793 | if (quality > 100) { |
||
794 | quality = 100;
|
||
795 | jTextQuality.setText(Integer.toString(quality));
|
||
796 | } |
||
797 | } catch (Exception e) { |
||
798 | quality = control.getPattern().getSettings().getQuality(); |
||
799 | jTextQuality.setText(Integer.toString(quality));
|
||
800 | } |
||
801 | } |
||
802 | |||
803 | /**
|
||
804 | *
|
||
805 | * @param evt
|
||
806 | */
|
||
807 | private void evChangeAccuracy(java.awt.event.FocusEvent evt) { |
||
808 | String accura = jTextAccuracy.getText().trim();
|
||
809 | int accuracy;
|
||
810 | try {
|
||
811 | accuracy = Integer.parseInt(accura);
|
||
812 | if (accuracy < 0) { |
||
813 | accuracy = 1;
|
||
814 | jTextAccuracy.setText(Integer.toString(accuracy));
|
||
815 | } |
||
816 | if (accuracy > 100) { |
||
817 | accuracy = 100;
|
||
818 | jTextAccuracy.setText(Integer.toString(accuracy));
|
||
819 | } |
||
820 | } catch (Exception e) { |
||
821 | accuracy = control.getPattern().getSettings().getAccuracy(); |
||
822 | jTextAccuracy.setText(Integer.toString(accuracy));
|
||
823 | } |
||
824 | } |
||
825 | |||
826 | /**
|
||
827 | *
|
||
828 | * @param evt
|
||
829 | */
|
||
830 | private void evNextButton(java.awt.event.ActionEvent evt) { |
||
831 | |||
832 | } |
||
833 | |||
834 | /**
|
||
835 | *
|
||
836 | * @param evt
|
||
837 | */
|
||
838 | private void evPreviousButton(java.awt.event.KeyEvent evt) { |
||
839 | |||
840 | } |
||
841 | |||
842 | /**
|
||
843 | *
|
||
844 | * @param evt
|
||
845 | */
|
||
846 | private void evSearch(java.awt.event.ActionEvent evt) { |
||
847 | |||
848 | // GEOCODING PROCESS
|
||
849 | control.geocoding(); |
||
850 | // GEOCODING PROCESS
|
||
851 | |||
852 | List<GeocoLocationSet> proof = control.getGmodel().getResults();
|
||
853 | |||
854 | if (proof != null && proof.size() > 0) { |
||
855 | |||
856 | GeocoLocationSet loc = proof.get(0);
|
||
857 | int max = Integer.parseInt(this.jTextMaxResults.getText()); |
||
858 | TableResultsModel model = (TableResultsModel) jTableResults |
||
859 | .getModel(); |
||
860 | model.setGeocoLocationSet(loc, max); |
||
861 | jTableResults.setModel(model); |
||
862 | jTableResults.validate(); |
||
863 | jTableResults.repaint(); |
||
864 | } |
||
865 | |||
866 | /* active table results functionalities */
|
||
867 | activeTableFunctionaties(true);
|
||
868 | jButExport.setEnabled(true);
|
||
869 | } |
||
870 | |||
871 | /**
|
||
872 | *
|
||
873 | * @param evt
|
||
874 | */
|
||
875 | private void evExport(java.awt.event.ActionEvent evt) { |
||
876 | |||
877 | } |
||
878 | |||
879 | /**
|
||
880 | *
|
||
881 | * @param evt
|
||
882 | */
|
||
883 | private void evExit(java.awt.event.ActionEvent evt) { |
||
884 | this.control.getGmodel().setPattern(null); |
||
885 | IWindow[] iws = PluginServices.getMDIManager().getAllWindows();
|
||
886 | for (int i = 0; i < iws.length; i++) { |
||
887 | if (iws[i] instanceof GeocodingPanel) { |
||
888 | PluginServices.getMDIManager().closeWindow(iws[i]); |
||
889 | } |
||
890 | } |
||
891 | } |
||
892 | |||
893 | /**
|
||
894 | *
|
||
895 | */
|
||
896 | public WindowInfo getWindowInfo() {
|
||
897 | // WindowInfo info = new WindowInfo(WindowInfo.MODALDIALOG
|
||
898 | // | WindowInfo.RESIZABLE);
|
||
899 | WindowInfo info = new WindowInfo(WindowInfo.RESIZABLE);
|
||
900 | |||
901 | info.setMinimumSize(this.getMinimumSize());
|
||
902 | info.setWidth(540);
|
||
903 | info.setHeight(500);
|
||
904 | info.setTitle(PluginServices.getText(this, "geocoding")); |
||
905 | |||
906 | return info;
|
||
907 | } |
||
908 | |||
909 | /**
|
||
910 | *
|
||
911 | */
|
||
912 | public Object getWindowProfile() { |
||
913 | |||
914 | return null; |
||
915 | } |
||
916 | |||
917 | /**
|
||
918 | * insert changeable panel
|
||
919 | *
|
||
920 | * @param pan
|
||
921 | */
|
||
922 | private void insertDynamicPanel(JPanel pan) { |
||
923 | |||
924 | jPanDynamic.removeAll(); |
||
925 | |||
926 | GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); |
||
927 | gridBagConstraints.gridx = 0;
|
||
928 | gridBagConstraints.gridy = 0;
|
||
929 | gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
||
930 | gridBagConstraints.weightx = 1.0;
|
||
931 | gridBagConstraints.weighty = 1.0;
|
||
932 | |||
933 | jPanDynamic.add(pan, gridBagConstraints); |
||
934 | |||
935 | this.setSize(this.getWidth() + 1, this.getHeight()); |
||
936 | jPanDynamic.validate(); |
||
937 | jPanResults.validate(); |
||
938 | jPanPattern.validate(); |
||
939 | pan.validate(); |
||
940 | this.validate();
|
||
941 | int x = this.getX(); |
||
942 | int y = this.getY(); |
||
943 | int wi = this.getWidth(); |
||
944 | int hi = this.getHeight(); |
||
945 | this.repaint(x, y, wi, hi);
|
||
946 | } |
||
947 | |||
948 | /**
|
||
949 | *
|
||
950 | * @param name1
|
||
951 | * @param typeAdr
|
||
952 | */
|
||
953 | public void setAddress1(String name1, int typeAdr) { |
||
954 | if (typeAdr == control.getGmodel().ONE) {
|
||
955 | oneA.setStreet1(name1); |
||
956 | } |
||
957 | if (typeAdr == control.getGmodel().CROSS) {
|
||
958 | twoA.setStreet1(name1); |
||
959 | } |
||
960 | if (typeAdr == control.getGmodel().THREE) {
|
||
961 | threeA.setStreet1(name1); |
||
962 | } |
||
963 | } |
||
964 | |||
965 | /**
|
||
966 | *
|
||
967 | * @param name2
|
||
968 | * @param typeAdr
|
||
969 | */
|
||
970 | public void setAddress2(String name2, int typeAdr) { |
||
971 | if (typeAdr == control.getGmodel().CROSS) {
|
||
972 | twoA.setStreet2(name2); |
||
973 | } |
||
974 | if (typeAdr == control.getGmodel().THREE) {
|
||
975 | threeA.setStreet2(name2); |
||
976 | } |
||
977 | } |
||
978 | |||
979 | /**
|
||
980 | *
|
||
981 | * @param name3
|
||
982 | * @param typeAdr
|
||
983 | */
|
||
984 | public void setAddress3(String name3, int typeAdr) { |
||
985 | if (typeAdr == control.getGmodel().THREE) {
|
||
986 | threeA.setStreet3(name3); |
||
987 | } |
||
988 | } |
||
989 | |||
990 | /**
|
||
991 | * show dynamic form
|
||
992 | *
|
||
993 | * @param position
|
||
994 | * (STREET1,STREET2,STREET3)
|
||
995 | * @param type
|
||
996 | * (ONE,CROSS,THREE)
|
||
997 | */
|
||
998 | public void showDynamicForm(int position, int type) { |
||
999 | GeocoStructurePanel dyn = new GeocoStructurePanel(control, position,
|
||
1000 | type); |
||
1001 | PluginServices.getMDIManager().addWindow(dyn); |
||
1002 | dyn.setVisible(true);
|
||
1003 | } |
||
1004 | |||
1005 | /**
|
||
1006 | *
|
||
1007 | * @param showPatternStructure
|
||
1008 | */
|
||
1009 | public void setStructurePattern(String showPatternStructure) { |
||
1010 | jLabStructure.setText(showPatternStructure); |
||
1011 | |||
1012 | } |
||
1013 | |||
1014 | /**
|
||
1015 | *
|
||
1016 | * @param results
|
||
1017 | */
|
||
1018 | public void setParamMaxresults(int results) { |
||
1019 | jTextMaxResults.setText((new Integer(results)).toString()); |
||
1020 | |||
1021 | } |
||
1022 | |||
1023 | /**
|
||
1024 | *
|
||
1025 | * @param accuracy
|
||
1026 | */
|
||
1027 | public void setParamAccuracy(int accuracy) { |
||
1028 | jTextAccuracy.setText((new Integer(accuracy)).toString()); |
||
1029 | |||
1030 | } |
||
1031 | |||
1032 | /**
|
||
1033 | *
|
||
1034 | * @param quality
|
||
1035 | */
|
||
1036 | public void setParamQuality(int quality) { |
||
1037 | jTextQuality.setText((new Integer(quality)).toString()); |
||
1038 | |||
1039 | } |
||
1040 | |||
1041 | /**
|
||
1042 | *
|
||
1043 | * @return
|
||
1044 | */
|
||
1045 | public String getJTextPatternPath() { |
||
1046 | return jTextPatternPath.getText();
|
||
1047 | } |
||
1048 | |||
1049 | /**
|
||
1050 | *
|
||
1051 | * @param path
|
||
1052 | */
|
||
1053 | public void setJTextPatternPath(String path) { |
||
1054 | this.jTextPatternPath.setText(path);
|
||
1055 | } |
||
1056 | |||
1057 | /**
|
||
1058 | * @return the oneA
|
||
1059 | */
|
||
1060 | public OneStreetPanel getOneA() {
|
||
1061 | return oneA;
|
||
1062 | } |
||
1063 | |||
1064 | /**
|
||
1065 | * @return the twoA
|
||
1066 | */
|
||
1067 | public TwoStreetPanel getTwoA() {
|
||
1068 | return twoA;
|
||
1069 | } |
||
1070 | |||
1071 | /**
|
||
1072 | * @return the threeA
|
||
1073 | */
|
||
1074 | public ThreeStreetPanel getThreeA() {
|
||
1075 | return threeA;
|
||
1076 | } |
||
1077 | |||
1078 | /**
|
||
1079 | * enable components when load a pattern
|
||
1080 | */
|
||
1081 | public void enableComponents() { |
||
1082 | jRadioSimple.setEnabled(true);
|
||
1083 | if (control.getListgvSIGTables().size() > 0) { |
||
1084 | jRadioTable.setEnabled(true);
|
||
1085 | } |
||
1086 | jLabType.setEnabled(true);
|
||
1087 | jComboType.setEnabled(true);
|
||
1088 | jLabMaxResults.setEnabled(true);
|
||
1089 | jTextMaxResults.setEnabled(true);
|
||
1090 | jLabQuality.setEnabled(true);
|
||
1091 | jTextQuality.setEnabled(true);
|
||
1092 | jLabAccuracy.setEnabled(true);
|
||
1093 | jTextAccuracy.setEnabled(true);
|
||
1094 | jLabPercent1.setEnabled(true);
|
||
1095 | jLabPercent2.setEnabled(true);
|
||
1096 | jTableResults.setEnabled(true);
|
||
1097 | |||
1098 | jButSearch.setEnabled(true);
|
||
1099 | } |
||
1100 | |||
1101 | /**
|
||
1102 | *
|
||
1103 | * @param active
|
||
1104 | */
|
||
1105 | private void activeTableFunctionaties(boolean active) { |
||
1106 | jComboTable.setEnabled(active); |
||
1107 | |||
1108 | if (!jRadioSimple.isSelected() && active) {
|
||
1109 | jButNext.setEnabled(active); |
||
1110 | jButPrevious.setEnabled(active); |
||
1111 | jLabRow.setEnabled(active); |
||
1112 | jLabRow.setText(ROW + "1");
|
||
1113 | } else {
|
||
1114 | jLabRow.setText("");
|
||
1115 | jButNext.setEnabled(false);
|
||
1116 | jButPrevious.setEnabled(false);
|
||
1117 | } |
||
1118 | } |
||
1119 | |||
1120 | /**
|
||
1121 | *
|
||
1122 | * @param row
|
||
1123 | */
|
||
1124 | private void updateRow(int row) { |
||
1125 | jLabRow.setText(ROW + row); |
||
1126 | } |
||
1127 | |||
1128 | /**
|
||
1129 | *
|
||
1130 | */
|
||
1131 | public void mouseClicked(MouseEvent e) { |
||
1132 | } |
||
1133 | |||
1134 | /**
|
||
1135 | *
|
||
1136 | */
|
||
1137 | public void mouseEntered(MouseEvent e) { |
||
1138 | if (control.getPattern() != null) { |
||
1139 | 26851 | vsanjaime | List<FeatureTableDocument> tables = control.getListgvSIGTables();
|
1140 | 26843 | vsanjaime | if (tables.size() > 0) { |
1141 | if (control.getPattern() != null) { |
||
1142 | jRadioTable.setEnabled(true);
|
||
1143 | } |
||
1144 | } else {
|
||
1145 | jRadioTable.setEnabled(false);
|
||
1146 | } |
||
1147 | } |
||
1148 | } |
||
1149 | |||
1150 | /**
|
||
1151 | *
|
||
1152 | */
|
||
1153 | public void mouseExited(MouseEvent e) { |
||
1154 | |||
1155 | } |
||
1156 | |||
1157 | /**
|
||
1158 | *
|
||
1159 | */
|
||
1160 | public void mousePressed(MouseEvent e) { |
||
1161 | |||
1162 | } |
||
1163 | |||
1164 | /**
|
||
1165 | *
|
||
1166 | */
|
||
1167 | public void mouseReleased(MouseEvent e) { |
||
1168 | |||
1169 | } |
||
1170 | |||
1171 | /**
|
||
1172 | *
|
||
1173 | * @return
|
||
1174 | */
|
||
1175 | 26851 | vsanjaime | public FeatureTableDocument getSelectedTable() {
|
1176 | 26843 | vsanjaime | |
1177 | 26851 | vsanjaime | return (FeatureTableDocument) jComboTable.getModel().getSelectedItem();
|
1178 | 26843 | vsanjaime | } |
1179 | |||
1180 | /**
|
||
1181 | *
|
||
1182 | */
|
||
1183 | public Object getWindowModel() { |
||
1184 | return this.getClass().getCanonicalName(); |
||
1185 | } |
||
1186 | |||
1187 | } |