Revision 14476
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/layers/FLyrWFSFactory.java | ||
---|---|---|
77 | 77 |
*/ |
78 | 78 |
public class FLyrWFSFactory { |
79 | 79 |
|
80 |
public FLyrWFS getFLyrWFS(FLayer layer,
|
|
80 |
public FLyrWFS getFLyrWFS(FLayer layer, |
|
81 | 81 |
URL host, |
82 | 82 |
String onlineResource, |
83 | 83 |
FMapWFSDriver driver, |
84 |
boolean loadLayer){ |
|
84 |
boolean loadLayer, |
|
85 |
boolean firstLoad){ |
|
85 | 86 |
FLyrWFS wfsLayer = (FLyrWFS)layer; |
86 | 87 |
wfsLayer.setHost(host); |
87 | 88 |
wfsLayer.setWfsDriver(driver); |
... | ... | |
90 | 91 |
adapter.setDriver((VectorialDriver) driver); |
91 | 92 |
wfsLayer.setSource(adapter); |
92 | 93 |
wfsLayer.setOnlineResource(onlineResource); |
93 |
BaseView activeView =
|
|
94 |
BaseView activeView = |
|
94 | 95 |
(BaseView) PluginServices.getMDIManager().getActiveWindow(); |
95 | 96 |
wfsLayer.setProjection(CRSFactory.getCRS(wfsLayer.getSrs())); |
96 | 97 |
IProjection wfsProjection = CRSFactory.getCRS(wfsLayer.getSrs()); |
97 |
IProjection layerProjection = activeView.getMapControl().getProjection();
|
|
98 |
IProjection layerProjection = activeView.getMapControl().getProjection(); |
|
98 | 99 |
if (wfsProjection != null){ |
99 | 100 |
if (!(wfsProjection.equals(layerProjection))){ |
100 | 101 |
layer.setCoordTrans(wfsProjection.getCT(layerProjection)); |
... | ... | |
102 | 103 |
} |
103 | 104 |
if (loadLayer){ |
104 | 105 |
try { |
106 |
if ((wfsProjection == null) && (firstLoad)){ |
|
107 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
|
108 |
PluginServices.getText(this,"wfs_srs_unknown")); |
|
109 |
} |
|
105 | 110 |
wfsLayer.load(); |
106 | 111 |
if (wfsLayer.getNumfeatures() == wfsLayer.getWfsDriver().getRowCount()) { |
107 | 112 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
108 |
PluginServices.getText(this,"maxFeatures_aviso"));
|
|
113 |
PluginServices.getText(this,"maxFeatures_aviso")); |
|
109 | 114 |
} |
110 | 115 |
} catch (Exception e) { |
111 | 116 |
// TODO Auto-generated catch block |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/dialogs/WFSPropsDialog.java | ||
---|---|---|
214 | 214 |
*/ |
215 | 215 |
/** |
216 | 216 |
* Panel with tabs for change properties of a WFS layer |
217 |
*
|
|
217 |
* |
|
218 | 218 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
219 | 219 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
220 | 220 |
*/ |
... | ... | |
230 | 230 |
boolean applied = false; |
231 | 231 |
|
232 | 232 |
|
233 |
|
|
233 |
|
|
234 | 234 |
/** |
235 | 235 |
* Default constructor with a Layer as parameter |
236 |
*
|
|
236 |
* |
|
237 | 237 |
* @param layer A layer |
238 | 238 |
*/ |
239 | 239 |
public WFSPropsDialog(FLayer layer) { |
... | ... | |
243 | 243 |
|
244 | 244 |
/** |
245 | 245 |
* Initializes this component |
246 |
*
|
|
246 |
* |
|
247 | 247 |
* @param layer A layer |
248 | 248 |
*/ |
249 | 249 |
private void initialize(FLayer layer) { |
... | ... | |
265 | 265 |
this.add(getButtonsPanel(), null); |
266 | 266 |
} |
267 | 267 |
|
268 |
|
|
268 |
|
|
269 | 269 |
/** |
270 | 270 |
* Buttons OK, Apply, Cancel |
271 |
*
|
|
271 |
* |
|
272 | 272 |
* @return A panel with that buttons |
273 | 273 |
*/ |
274 | 274 |
public JPanel getButtonsPanel() { |
... | ... | |
330 | 330 |
toc.setVisible(true); |
331 | 331 |
toc.refreshInfo(); |
332 | 332 |
applied = false; |
333 |
return toc;
|
|
333 |
return toc; |
|
334 | 334 |
} |
335 | 335 |
return null; |
336 | 336 |
} |
337 | 337 |
|
338 | 338 |
|
339 |
|
|
339 |
|
|
340 | 340 |
/* |
341 | 341 |
* (non-Javadoc) |
342 | 342 |
* @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo() |
... | ... | |
367 | 367 |
|
368 | 368 |
/** |
369 | 369 |
* JButton OK |
370 |
*
|
|
370 |
* |
|
371 | 371 |
* @return javax.swing.JButton |
372 | 372 |
*/ |
373 | 373 |
public JButton getBtnOk() { |
... | ... | |
381 | 381 |
return btnOk; |
382 | 382 |
} |
383 | 383 |
|
384 |
|
|
384 |
|
|
385 | 385 |
/** |
386 | 386 |
* JButton Apply |
387 |
*
|
|
387 |
* |
|
388 | 388 |
* @return javax.swing.JButton |
389 | 389 |
*/ |
390 | 390 |
public JButton getBtnApply() { |
... | ... | |
399 | 399 |
return btnApply; |
400 | 400 |
} |
401 | 401 |
|
402 |
|
|
402 |
|
|
403 | 403 |
/** |
404 | 404 |
* JButton Cancel |
405 |
*
|
|
405 |
* |
|
406 | 406 |
* @return javax.swing.JButton |
407 | 407 |
*/ |
408 | 408 |
public JButton getBtnCancel() { |
... | ... | |
422 | 422 |
*/ |
423 | 423 |
public void close() { |
424 | 424 |
PluginServices.getMDIManager().closeWindow(this); |
425 |
}
|
|
426 |
|
|
425 |
} |
|
426 |
|
|
427 | 427 |
/** |
428 | 428 |
* @see ActionListener |
429 |
*
|
|
429 |
* |
|
430 | 430 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
431 | 431 |
*/ |
432 | 432 |
private class CommandListener implements ActionListener { |
433 | 433 |
/** |
434 | 434 |
* Default constructor |
435 |
*
|
|
435 |
* |
|
436 | 436 |
* @param tp |
437 | 437 |
*/ |
438 | 438 |
public CommandListener(WFSPropsDialog tp) { |
... | ... | |
465 | 465 |
applied = true; |
466 | 466 |
getBtnApply().setEnabled(!applied); |
467 | 467 |
refreshLayouts(); |
468 |
|
|
468 |
|
|
469 | 469 |
// Restores the private attribute of the area panel: hasUserDefinedAnArea |
470 | 470 |
wfsParamsTabbedPane.setUserHasntDefinedAnArea(); |
471 | 471 |
|
... | ... | |
550 | 550 |
if (fLayer != null) { |
551 | 551 |
URL host = new URL(wfsParamsTabbedPane.getData().getHost()); |
552 | 552 |
String onlineResource = wfsParamsTabbedPane.getData().getOnlineResource(); |
553 |
fLayer = new FLyrWFSFactory().getFLyrWFS(fLayer,host,onlineResource,driver,true); |
|
553 |
fLayer = new FLyrWFSFactory().getFLyrWFS(fLayer,host,onlineResource,driver,true,false);
|
|
554 | 554 |
if (fLayer != null) { |
555 | 555 |
((FLyrWFS)fLayer).setLegend(legend); |
556 |
|
|
556 |
|
|
557 | 557 |
// Update all fields and values known about the current layer loaded (and selected) |
558 | 558 |
((FLyrWFS)fLayer).setAllFieldsAndValuesKnown(wfsParamsTabbedPane.getAllFieldsAndValuesKnownOfCurrentLayer()); |
559 |
|
|
559 |
|
|
560 | 560 |
return fLayer.getName(); |
561 | 561 |
} |
562 | 562 |
} |
... | ... | |
620 | 620 |
} |
621 | 621 |
} |
622 | 622 |
} |
623 |
|
|
623 |
|
|
624 | 624 |
/** |
625 | 625 |
* @see WFSAreaPanel#updateWFSArea() |
626 | 626 |
*/ |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/wizards/WFSWizard.java | ||
---|---|---|
327 | 327 |
} |
328 | 328 |
|
329 | 329 |
cmbHost.setServerList(servers); |
330 |
|
|
330 |
|
|
331 | 331 |
// Allows that user can start the connection to the written server pressing the 'Enter' key |
332 | 332 |
cmbHost.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() { |
333 | 333 |
/* |
... | ... | |
359 | 359 |
btnConnect.setText(PluginServices.getText(this, "connect")); |
360 | 360 |
btnConnect.addActionListener(new java.awt.event.ActionListener() { |
361 | 361 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
362 |
btnConnect.setEnabled(false); // This avoids multiple contiguous actions
|
|
362 |
btnConnect.setEnabled(false); // This avoids multiple contiguous actions |
|
363 | 363 |
rellenarControles(); |
364 | 364 |
btnConnect.setEnabled(true); // This avoids multiple contiguous actions |
365 | 365 |
} |
366 | 366 |
}); |
367 |
|
|
367 |
|
|
368 | 368 |
// If user press the 'Enter' key -> advance |
369 | 369 |
btnConnect.addKeyListener(new KeyAdapter() { |
370 | 370 |
/* |
... | ... | |
377 | 377 |
btnConnect.doClick(); |
378 | 378 |
getBtnSiguiente().requestFocus(); |
379 | 379 |
} |
380 |
}
|
|
380 |
} |
|
381 | 381 |
}); |
382 | 382 |
} |
383 | 383 |
|
... | ... | |
406 | 406 |
|
407 | 407 |
return jPanel; |
408 | 408 |
} |
409 |
|
|
409 |
|
|
410 | 410 |
/** |
411 | 411 |
* This method initializes pnlName |
412 | 412 |
* |
... | ... | |
553 | 553 |
getPanelPage2().setVisible(true); |
554 | 554 |
activarVisualizarBotones(); |
555 | 555 |
} |
556 |
});
|
|
556 |
}); |
|
557 | 557 |
} |
558 | 558 |
return btnSiguiente; |
559 | 559 |
} |
... | ... | |
612 | 612 |
jPanel1.setBounds(2, 5, 477, 85); |
613 | 613 |
jPanel1.add(getTxtHost(), null); |
614 | 614 |
jPanel1.add(getBtnConnect(), null); |
615 |
jPanel1.add(getChkCaching(), null);
|
|
615 |
jPanel1.add(getChkCaching(), null); |
|
616 | 616 |
} |
617 | 617 |
|
618 | 618 |
return jPanel1; |
... | ... | |
702 | 702 |
* @see com.iver.cit.gvsig.gui.WizardPanel#getLayer() |
703 | 703 |
*/ |
704 | 704 |
public FLayer getLayer() { |
705 |
FLayer layer = wfsParamsPanel.getLayer();
|
|
705 |
FLayer layer = wfsParamsPanel.getLayer(); |
|
706 | 706 |
URL host = getHost(); |
707 | 707 |
String onlineResource = dataSource.getOnlineResource(); |
708 | 708 |
FMapWFSDriver driver = dataSource.getDriver(); |
709 |
return new FLyrWFSFactory().getFLyrWFS(layer,host,onlineResource,driver,true); |
|
709 |
return new FLyrWFSFactory().getFLyrWFS(layer,host,onlineResource,driver,true,true);
|
|
710 | 710 |
} |
711 | 711 |
|
712 | 712 |
/** |
Also available in: Unified diff