Revision 10626 trunk/extensions/extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/core/gui/GeoProcessingOverlayPanel.java
GeoProcessingOverlayPanel.java | ||
---|---|---|
56 | 56 |
import javax.swing.JLabel; |
57 | 57 |
import javax.swing.JPanel; |
58 | 58 |
|
59 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
59 | 60 |
import com.iver.andami.PluginServices; |
60 | 61 |
import com.iver.andami.ui.mdiManager.IWindow; |
61 | 62 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
62 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
63 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
|
64 | 63 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
65 | 64 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
66 | 65 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
... | ... | |
70 | 69 |
/** |
71 | 70 |
* Panel that allows user to enter clip geoprocess params |
72 | 71 |
* (input layers, etc). |
73 |
*
|
|
72 |
* |
|
74 | 73 |
* @author jmorell, azabala |
75 | 74 |
*/ |
76 |
public class GeoProcessingOverlayPanel extends AbstractGeoprocessPanel
|
|
75 |
public class GeoProcessingOverlayPanel extends AbstractGeoprocessPanel |
|
77 | 76 |
implements OverlayPanelIF, IWindow{ |
78 |
|
|
77 |
|
|
79 | 78 |
private static final long serialVersionUID = 1L; |
80 | 79 |
private JButton openFileDialogButton = null; |
81 | 80 |
private JCheckBox selectedFirstLayerCheckBox = null; |
... | ... | |
87 | 86 |
* operation will launch this panel |
88 | 87 |
*/ |
89 | 88 |
private String titleText; |
90 |
|
|
89 |
|
|
91 | 90 |
private WindowInfo viewInfo; |
92 | 91 |
private JPanel resultLayerPanel = null; |
93 | 92 |
private JLabel jLabel7 = null; |
... | ... | |
99 | 98 |
private JLabel jLabel1 = null; |
100 | 99 |
private JLabel jLabel2 = null; |
101 | 100 |
private JLabel jLabel3 = null; |
102 |
|
|
101 |
|
|
103 | 102 |
/** |
104 | 103 |
* This constructor initializes the set of layers |
105 | 104 |
*/ |
... | ... | |
111 | 110 |
} |
112 | 111 |
/** |
113 | 112 |
* This method initializes this |
114 |
*
|
|
113 |
* |
|
115 | 114 |
* @return void |
116 | 115 |
*/ |
117 | 116 |
private void initialize() { |
... | ... | |
130 | 129 |
changeSelectedItemsNumberJLabel(); |
131 | 130 |
changeSelectedItemsNumberJLabel1(); |
132 | 131 |
} |
133 |
|
|
132 |
|
|
134 | 133 |
private void changeSelectedItemsJCheckBox() { |
135 | 134 |
FLyrVect inputSelectable = (FLyrVect)(layers.getLayer((String)layersComboBox.getSelectedItem())); |
136 | 135 |
FBitSet fBitSet = null; |
137 | 136 |
try { |
138 | 137 |
fBitSet = inputSelectable.getRecordset().getSelection(); |
139 |
} catch (DriverException e) { |
|
138 |
} catch (ReadDriverException e) {
|
|
140 | 139 |
// TODO Auto-generated catch block |
141 | 140 |
e.printStackTrace(); |
142 | 141 |
} |
... | ... | |
153 | 152 |
FBitSet fBitSet = null; |
154 | 153 |
try { |
155 | 154 |
fBitSet = inputSelectable.getRecordset().getSelection(); |
156 |
} catch (DriverException e) { |
|
155 |
} catch (ReadDriverException e) {
|
|
157 | 156 |
// TODO Auto-generated catch block |
158 | 157 |
e.printStackTrace(); |
159 | 158 |
} |
... | ... | |
171 | 170 |
FBitSet fBitSet = null; |
172 | 171 |
try { |
173 | 172 |
fBitSet = inputSelectable.getRecordset().getSelection(); |
174 |
} catch (DriverException e) { |
|
173 |
} catch (ReadDriverException e) {
|
|
175 | 174 |
// TODO Auto-generated catch block |
176 | 175 |
e.printStackTrace(); |
177 | 176 |
} |
... | ... | |
183 | 182 |
getSource(); |
184 | 183 |
try { |
185 | 184 |
jLabel3.setText(new Integer(va.getShapeCount()).toString()); |
186 |
} catch (DriverIOException e) {
|
|
187 |
// TODO Auto-generated catch block
|
|
188 |
e.printStackTrace();
|
|
189 |
}
|
|
185 |
} catch (ReadDriverException e) {
|
|
186 |
// TODO Auto-generated catch block
|
|
187 |
e.printStackTrace();
|
|
188 |
}
|
|
190 | 189 |
} |
191 | 190 |
} |
192 | 191 |
private void changeSelectedItemsNumberJLabel1() { |
... | ... | |
195 | 194 |
FBitSet fBitSet = null; |
196 | 195 |
try { |
197 | 196 |
fBitSet = inputSelectable.getRecordset().getSelection(); |
198 |
} catch (DriverException e) { |
|
197 |
} catch (ReadDriverException e) {
|
|
199 | 198 |
// TODO Auto-generated catch block |
200 | 199 |
e.printStackTrace(); |
201 | 200 |
} |
... | ... | |
206 | 205 |
.getSource(); |
207 | 206 |
try { |
208 | 207 |
jLabel6.setText(new Integer(va.getShapeCount()).toString()); |
209 |
} catch (DriverIOException e) {
|
|
210 |
// TODO Auto-generated catch block
|
|
211 |
e.printStackTrace();
|
|
212 |
}
|
|
208 |
} catch (ReadDriverException e) {
|
|
209 |
// TODO Auto-generated catch block
|
|
210 |
e.printStackTrace();
|
|
211 |
}
|
|
213 | 212 |
} |
214 | 213 |
} |
215 |
|
|
214 |
|
|
216 | 215 |
/** |
217 |
*
|
|
216 |
* |
|
218 | 217 |
* TODO |
219 | 218 |
* El panel de seleccion de escritura esta metido a pelo en todas |
220 | 219 |
* las pantallas. Hacer que sea generico, y vinculado a los IWriters |
221 | 220 |
* cargados en el sistema. |
222 |
*
|
|
223 |
*
|
|
224 |
*/
|
|
221 |
* |
|
222 |
* |
|
223 |
*/ |
|
225 | 224 |
private JButton getOpenFileDialogButton() { |
226 | 225 |
if (openFileDialogButton == null) { |
227 | 226 |
openFileDialogButton = new JButton(); |
228 | 227 |
openFileDialogButton.setText(PluginServices.getText(this,"Abrir")); |
229 |
openFileDialogButton.addActionListener(new java.awt.event.ActionListener() {
|
|
230 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
228 |
openFileDialogButton.addActionListener(new java.awt.event.ActionListener() { |
|
229 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
231 | 230 |
openResultFileDialog(); |
232 | 231 |
} |
233 | 232 |
}); |
234 | 233 |
} |
235 | 234 |
return openFileDialogButton; |
236 | 235 |
} |
237 |
|
|
236 |
|
|
238 | 237 |
/** |
239 |
* This method initializes selectedFirstLayerCheckBox
|
|
240 |
*
|
|
241 |
* @return javax.swing.JCheckBox
|
|
242 |
*/
|
|
238 |
* This method initializes selectedFirstLayerCheckBox |
|
239 |
* |
|
240 |
* @return javax.swing.JCheckBox |
|
241 |
*/ |
|
243 | 242 |
private JCheckBox getOnlyFirstLayerSelectedCheckBox() { |
244 | 243 |
if (selectedFirstLayerCheckBox == null) { |
245 | 244 |
selectedFirstLayerCheckBox = new JCheckBox(); |
246 | 245 |
selectedFirstLayerCheckBox.setText(PluginServices.getText(this,"Usar_solamente_los_elementos_seleccionados")); |
247 |
selectedFirstLayerCheckBox.addItemListener(new java.awt.event.ItemListener() {
|
|
248 |
public void itemStateChanged(java.awt.event.ItemEvent e) {
|
|
246 |
selectedFirstLayerCheckBox.addItemListener(new java.awt.event.ItemListener() { |
|
247 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
249 | 248 |
changeSelectedItemsNumberJLabel(); |
250 | 249 |
} |
251 | 250 |
}); |
... | ... | |
253 | 252 |
return selectedFirstLayerCheckBox; |
254 | 253 |
} |
255 | 254 |
/** |
256 |
* This method initializes secondLayerComboBox
|
|
257 |
*
|
|
258 |
* @return javax.swing.JComboBox
|
|
259 |
*/
|
|
255 |
* This method initializes secondLayerComboBox |
|
256 |
* |
|
257 |
* @return javax.swing.JComboBox |
|
258 |
*/ |
|
260 | 259 |
private JComboBox getSecondLayerComboBox() { |
261 | 260 |
if (secondLayerComboBox == null) { |
262 | 261 |
secondLayerComboBox = new JComboBox(); |
263 | 262 |
DefaultComboBoxModel defaultModel = new DefaultComboBoxModel(getLayerNames()); |
264 | 263 |
secondLayerComboBox.setModel(defaultModel); |
265 |
secondLayerComboBox.addItemListener(new java.awt.event.ItemListener() {
|
|
266 |
public void itemStateChanged(java.awt.event.ItemEvent e) {
|
|
264 |
secondLayerComboBox.addItemListener(new java.awt.event.ItemListener() { |
|
265 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
267 | 266 |
changeSelectedItemsJCheckBox1(); |
268 | 267 |
changeSelectedItemsNumberJLabel1(); |
269 | 268 |
} |
... | ... | |
272 | 271 |
return secondLayerComboBox; |
273 | 272 |
} |
274 | 273 |
/** |
275 |
* This method initializes secondLayerSelectedCheckBox
|
|
276 |
*
|
|
277 |
* @return javax.swing.JCheckBox
|
|
278 |
*/
|
|
274 |
* This method initializes secondLayerSelectedCheckBox |
|
275 |
* |
|
276 |
* @return javax.swing.JCheckBox |
|
277 |
*/ |
|
279 | 278 |
private JCheckBox getOnlySecondLayerSelectedCheckBox() { |
280 | 279 |
if (secondLayerSelectedCheckBox == null) { |
281 | 280 |
secondLayerSelectedCheckBox = new JCheckBox(); |
282 | 281 |
secondLayerSelectedCheckBox.setText(PluginServices.getText(this,"Usar_solamente_los_elementos_seleccionados")); |
283 |
secondLayerSelectedCheckBox.addItemListener(new java.awt.event.ItemListener() {
|
|
284 |
public void itemStateChanged(java.awt.event.ItemEvent e) {
|
|
282 |
secondLayerSelectedCheckBox.addItemListener(new java.awt.event.ItemListener() { |
|
283 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
285 | 284 |
changeSelectedItemsNumberJLabel1(); |
286 | 285 |
} |
287 | 286 |
}); |
288 | 287 |
} |
289 | 288 |
return secondLayerSelectedCheckBox; |
290 | 289 |
} |
291 |
|
|
290 |
|
|
292 | 291 |
public FLyrVect getSecondLayer() { |
293 |
String clippingLayer =
|
|
292 |
String clippingLayer = |
|
294 | 293 |
(String) secondLayerComboBox.getSelectedItem(); |
295 | 294 |
try { |
296 | 295 |
return (FLyrVect) layers.getLayer(clippingLayer); |
297 | 296 |
} catch (Exception e) { |
298 | 297 |
return null; |
299 |
}
|
|
298 |
} |
|
300 | 299 |
} |
301 |
|
|
300 |
|
|
302 | 301 |
public boolean onlyFirstLayerSelected() { |
303 | 302 |
return selectedFirstLayerCheckBox.isSelected(); |
304 | 303 |
} |
305 |
|
|
304 |
|
|
306 | 305 |
public boolean onlySecondLayerSelected() { |
307 | 306 |
return secondLayerSelectedCheckBox.isSelected(); |
308 | 307 |
} |
309 |
|
|
310 |
|
|
308 |
|
|
309 |
|
|
311 | 310 |
//TODO Sustituir esto para que pueda trabajar |
312 | 311 |
//con los IWriter que est?n registrados en el sistema |
313 | 312 |
public void openResultFileDialog() { |
... | ... | |
320 | 319 |
file = new File(file.getPath()+".shp"); |
321 | 320 |
} |
322 | 321 |
} |
323 |
if (jfc.getSelectedFile()!=null)
|
|
322 |
if (jfc.getSelectedFile()!=null) |
|
324 | 323 |
getFileNameResultTextField().setText(jfc.getSelectedFile().getAbsolutePath()); |
325 | 324 |
} |
326 |
|
|
325 |
|
|
327 | 326 |
//TODO Rehacer esto |
328 | 327 |
public void firstLayerSelectionChecked(boolean checked) { |
329 | 328 |
changeSelectedItemsJCheckBox(); |
... | ... | |
333 | 332 |
changeSelectedItemsJCheckBox1(); |
334 | 333 |
changeSelectedItemsNumberJLabel1(); |
335 | 334 |
} |
336 |
|
|
335 |
|
|
337 | 336 |
public WindowInfo getWindowInfo() { |
338 | 337 |
if (viewInfo == null) { |
339 | 338 |
viewInfo = new WindowInfo(WindowInfo.MODALDIALOG); |
... | ... | |
343 | 342 |
return viewInfo; |
344 | 343 |
} |
345 | 344 |
/** |
346 |
* This method initializes resultLayerPanel
|
|
347 |
*
|
|
348 |
* @return javax.swing.JPanel
|
|
345 |
* This method initializes resultLayerPanel |
|
346 |
* |
|
347 |
* @return javax.swing.JPanel |
|
349 | 348 |
*/ |
350 | 349 |
private JPanel getResultLayerPanel() { |
351 | 350 |
if (resultLayerPanel == null) { |
... | ... | |
381 | 380 |
return resultLayerPanel; |
382 | 381 |
} |
383 | 382 |
/** |
384 |
* This method initializes clipLayerjPanel
|
|
385 |
*
|
|
386 |
* @return javax.swing.JPanel
|
|
383 |
* This method initializes clipLayerjPanel |
|
384 |
* |
|
385 |
* @return javax.swing.JPanel |
|
387 | 386 |
*/ |
388 | 387 |
private JPanel getClipLayerjPanel() { |
389 | 388 |
if (clipLayerjPanel == null) { |
... | ... | |
438 | 437 |
return clipLayerjPanel; |
439 | 438 |
} |
440 | 439 |
/** |
441 |
* This method initializes inputLayerPanel
|
|
442 |
*
|
|
443 |
* @return javax.swing.JPanel
|
|
440 |
* This method initializes inputLayerPanel |
|
441 |
* |
|
442 |
* @return javax.swing.JPanel |
|
444 | 443 |
*/ |
445 | 444 |
private JPanel getInputLayerPanel() { |
446 | 445 |
if (inputLayerPanel == null) { |
... | ... | |
494 | 493 |
} |
495 | 494 |
return inputLayerPanel; |
496 | 495 |
} |
497 |
|
|
496 |
|
|
498 | 497 |
/** |
499 |
* This method initializes inputLayerComboBox
|
|
500 |
*
|
|
501 |
* @return javax.swing.JComboBox
|
|
498 |
* This method initializes inputLayerComboBox |
|
499 |
* |
|
500 |
* @return javax.swing.JComboBox |
|
502 | 501 |
*/ |
503 | 502 |
private JComboBox getInputLayerComboBox() { |
504 | 503 |
if (layersComboBox == null) { |
505 | 504 |
layersComboBox = new JComboBox(); |
506 | 505 |
DefaultComboBoxModel defaultModel = new DefaultComboBoxModel(getLayerNames()); |
507 | 506 |
layersComboBox.setModel(defaultModel); |
508 |
layersComboBox.addItemListener(new java.awt.event.ItemListener() {
|
|
509 |
public void itemStateChanged(java.awt.event.ItemEvent e) {
|
|
507 |
layersComboBox.addItemListener(new java.awt.event.ItemListener() { |
|
508 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
510 | 509 |
changeSelectedItemsJCheckBox(); |
511 | 510 |
changeSelectedItemsNumberJLabel(); |
512 | 511 |
} |
Also available in: Unified diff