Revision 9339

View differences:

trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/dialogs/WFSPropsDialog.java
78 78
 *
79 79
 * $Id$
80 80
 * $Log$
81
 * Revision 1.16  2006-12-13 14:00:24  ppiqueras
81
 * Revision 1.17  2006-12-15 13:57:08  ppiqueras
82
 * Permite que se almacenen y/o recojan todos los campos y valores conocidos de la capa actual.
83
 *
84
 * Además, control frentre a consultas de filtro erróneas, (esto a medias aún).
85
 *
86
 * Revision 1.16  2006/12/13 14:00:24  ppiqueras
82 87
 * Añadido un comentario a una línea de instrucciones
83 88
 *
84 89
 * Revision 1.15  2006/12/04 08:59:47  ppiqueras
......
132 137
 */
133 138
/**
134 139
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
140
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
135 141
 */
136 142
public class WFSPropsDialog extends JPanel implements IWindow{
137 143
	private WFSParamsPanel wfsParamsTabbedPane = null;
......
343 349
						String onlineResource = wfsParamsTabbedPane.getData().getOnlineResource();
344 350
						fLayer = new FLyrWFSFactory().getFLyrWFS(fLayer,host,onlineResource,driver,false);
345 351
						((FLyrWFS)fLayer).setLegend(legend);
352
						
353
						// Update all fields and values known about the current layer loaded (and selected)
354
						((FLyrWFS)fLayer).setAllFieldsAndValuesKnown(wfsParamsTabbedPane.getAllFieldsAndValuesKnownOfCurrentLayer());
346 355
				} catch (MalformedURLException e1) {
347 356
					// TODO Auto-generated catch block
348 357
					e1.printStackTrace();
......
352 361
				} catch (DriverException e1) {
353 362
					// TODO Auto-generated catch block
354 363
					e1.printStackTrace();
355
				} 		 
364
				}
365
				
356 366
				if (e.getActionCommand() == "APPLY"){
357
					 if (loadLayer(fLayer)){		 
358
						 View vista = (View) PluginServices.getMDIManager().getActiveWindow();
359
						 MapControl mapCtrl = vista.getMapControl();
367
					// We can't 'apply' if there is a filter query and it's incorrect
368
					if (wfsParamsTabbedPane.getFilterQuery() != null) {					
369
						 if (loadLayer(fLayer)){		 
370
							 View vista = (View) PluginServices.getMDIManager().getActiveWindow();
371
							 MapControl mapCtrl = vista.getMapControl();
372
					
373
							 mapCtrl.getMapContext().getLayers().replaceLayer(layerName, fLayer);
374
							 
375
							 mapCtrl.getMapContext().invalidate();
376
							 applied = true;
377
							 getBtnApply().setEnabled(!applied);
378
							 refreshLayouts();						 
379
	
380
							 // If we load another layer, or the same but we've selected others attributes -> notify it to he WFSFilter panel
381
							 if (getWFSFilterPanelIsAsTabForWFSLayersLoad() || (wfsParamsTabbedPane.getAttributesSelectedOfSameLayerHasChanged())) {
382
								 setWFSFilterPanelIsAsTabForWFSLayersLoad(false);
383
								 wfsParamsTabbedPane.resetAttributesSelectedOfSameLayerHasChanged(); // reset that attribute
384
						 	 }
385
							 
386
							 // Update values associated to the current selected field
387
							 wfsParamsTabbedPane.updateWFSFilterFieldValues();
388
						 }
389
					}
390
				 }
360 391
				
361
						 mapCtrl.getMapContext().getLayers().replaceLayer(layerName, fLayer);
362
						 
363
						 mapCtrl.getMapContext().invalidate();
364
						 applied = true;
365
						 getBtnApply().setEnabled(!applied);
366
						 refreshLayouts();						 
367

  
368
						 // If we load another layer, or the same but we've selected others attributes -> notify it to he WFSFilter panel
369
						 if (getWFSFilterPanelIsAsTabForWFSLayersLoad() || (wfsParamsTabbedPane.getAttributesSelectedOfSameLayerHasChanged())) {
370
							 setWFSFilterPanelIsAsTabForWFSLayersLoad(false);
371
							 wfsParamsTabbedPane.resetAttributesSelectedOfSameLayerHasChanged(); // reset that attribute
372
					 	 }
373
						 
374
						 // Update values associated to the current selected field
375
						 wfsParamsTabbedPane.updateWFSFilterFieldValues();
376
					 }
377
				 }
378 392
				 if (e.getActionCommand() == "OK") {
379
					 if (!applied) {
380
						 if (getBtnApply().isEnabled()){
381
							 if (loadLayer(fLayer)){
382
								 View vista = (View) PluginServices.getMDIManager().getActiveWindow();
383
								 MapControl mapCtrl = vista.getMapControl();
384
								 mapCtrl.getMapContext().getLayers().replaceLayer(layerName, fLayer);
385
								 mapCtrl.getMapContext().invalidate();
386
								 refreshLayouts();
393
					// We can't 'apply' if there is a filter query and it's incorrect
394
					if (wfsParamsTabbedPane.getFilterQuery() != null) {	
395
						 if (!applied) {
396
							 if (getBtnApply().isEnabled()){
397
								 if (loadLayer(fLayer)){
398
									 View vista = (View) PluginServices.getMDIManager().getActiveWindow();
399
									 MapControl mapCtrl = vista.getMapControl();
400
									 mapCtrl.getMapContext().getLayers().replaceLayer(layerName, fLayer);
401
									 mapCtrl.getMapContext().invalidate();
402
									 refreshLayouts();
403
								 }
387 404
							 }
388
						 }
389
					 }	
390
					 close();		                
405
						 }	
406
						 close();
407
						 
408
						 // Update all fields and values known about the current layer loaded (and selected)
409
						 ((FLyrWFS)fLayer).setAllFieldsAndValuesKnown(wfsParamsTabbedPane.getAllFieldsAndValuesKnownOfCurrentLayer());
410
					}
391 411
				 }
392 412
			 }
393 413
		 }
......
400 420
							 PluginServices.getText(this,"maxFeatures_aviso"));	
401 421
				 }
402 422
			 } catch (Exception e1) {
403
				 // TODO Auto-generated catch block
404 423
				 e1.printStackTrace();
405 424
				 JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),
406 425
						 PluginServices.getText(this,"cantLoad"));
......
426 445
	}
427 446
	
428 447
	/**
448
	 * Sets all fielsd and values known of current layer to WFSFilterPanel
449
	 */
450
	public void updateAllFieldsAndValuesKnownOfCurrentLayerToWFSFilterPanel() {
451
		this.wfsParamsTabbedPane.setAllFieldsAndValuesKnownOfCurrentLayer(((FLyrWFS)this.getFLayer()).getAllFieldsAndValuesKnown());
452
	}
453
	
454
	/**
429 455
	 * Refresh the layouts
430 456
	 *
431 457
	 */

Also available in: Unified diff