Revision 9151

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.14  2006-11-28 08:05:31  jorpiell
81
 * Revision 1.15  2006-12-04 08:59:47  ppiqueras
82
 * Algunos bugs corregidos. A cambio hay 2 bugs relacionados que todavía no han sido corregidos (ver PHPCollab) (los tiene asignados Jorge).
83
 *
84
 * Revision 1.14  2006/11/28 08:05:31  jorpiell
82 85
 * Se refrescan los mapas despu?s de aplicar un filtro
83 86
 *
84 87
 * Revision 1.13  2006/11/16 16:57:49  jorpiell
......
353 356
						 MapControl mapCtrl = vista.getMapControl();
354 357
				
355 358
						 mapCtrl.getMapContext().getLayers().replaceLayer(layerName, fLayer);
356
						 wfsParamsTabbedPane.updateWFSFilterFieldValues();
359
						 
357 360
						 mapCtrl.getMapContext().invalidate();
358 361
						 applied = true;
359 362
						 getBtnApply().setEnabled(!applied);
360
						 refreshLayouts();
363
						 refreshLayouts();						 
364

  
365
						 // If we load another layer, or the same but we've selected others attributes -> notify it to he WFSFilter panel
366
						 if (getWFSFilterPanelIsAsTabForWFSLayersLoad() || (wfsParamsTabbedPane.getAttributesSelectedOfSameLayerHasChanged())) {
367
							 setWFSFilterPanelIsAsTabForWFSLayersLoad(false);
368
							 wfsParamsTabbedPane.resetAttributesSelectedOfSameLayerHasChanged(); // reset that attribute
369
					 	}
370
						 
371
						 wfsParamsTabbedPane.updateWFSFilterFieldValues();
361 372
					 }
362 373
				 }
363 374
				 if (e.getActionCommand() == "OK") {
......
401 412
	 */
402 413
	public void setWFSFilterPanelIsAsTabForWFSLayersLoad(boolean b) {
403 414
		this.wfsParamsTabbedPane.setWFSFilterPanelIsAsTabForWFSLayersLoad(b);
404
	}	
415
	}
405 416
	
406 417
	/**
418
	 * @see WFSFilterPanel#getWFSFilterPanelIsAsTabForWFSLayersLoad()
419
	 */
420
	public boolean getWFSFilterPanelIsAsTabForWFSLayersLoad() {
421
		return this.wfsParamsTabbedPane.getWFSFilterPanelIsAsTabForWFSLayersLoad();
422
	}
423
	
424
	/**
407 425
	 * Refresh the layouts
408 426
	 *
409 427
	 */
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSParamsPanel.java
2 2

  
3 3
import java.awt.event.FocusEvent;
4 4
import java.awt.event.FocusListener;
5
import java.io.ObjectInputStream.GetField;
6 5
import java.util.prefs.Preferences;
7 6

  
8 7
import javax.swing.JTabbedPane;
......
63 62
 *
64 63
 * $Id$
65 64
 * $Log$
66
 * Revision 1.21  2006-11-28 08:05:13  jorpiell
65
 * Revision 1.22  2006-12-04 08:59:47  ppiqueras
66
 * Algunos bugs corregidos. A cambio hay 2 bugs relacionados que todavía no han sido corregidos (ver PHPCollab) (los tiene asignados Jorge).
67
 *
68
 * Revision 1.21  2006/11/28 08:05:13  jorpiell
67 69
 * Se escribe la query en la pesta?a del filtro
68 70
 *
69 71
 * Revision 1.20  2006/11/14 13:45:49  ppiqueras
......
136 138
	public	static Preferences fPrefs = Preferences.userRoot().node( "gvsig.wcs-wizard" );
137 139
	private WFSInfoPanel infoPanel;
138 140
	private int indFields;
139
	private int indFormat;
140 141
	private int indFilter;
141 142
	private int indArea;
142 143
	
......
580 581
	 * @see WFSFilterPanel#setWFSFilterPanelIsAsTabForWFSLayersLoad(boolean)
581 582
	 */
582 583
	public void setWFSFilterPanelIsAsTabForWFSLayersLoad(boolean b) {
583
		this.filterPanel.setWFSFilterPanelIsAsTabForWFSLayersLoad(b);
584
	}	
584
		this.getFilterPanel().setWFSFilterPanelIsAsTabForWFSLayersLoad(b);
585
	}
586
	
587
	/**
588
	 * @see WFSFilterPanel#getWFSFilterPanelIsAsTabForWFSLayersLoad()
589
	 */
590
	public boolean getWFSFilterPanelIsAsTabForWFSLayersLoad() {
591
		return this.getFilterPanel().getWFSFilterPanelIsAsTabForWFSLayersLoad();
592
	}
593
	
594
	/**
595
	 * @see WFSSelectAttributesPanel#getAttributesSelectedOfSameLayerHasChanged()
596
	 */
597
	public boolean getAttributesSelectedOfSameLayerHasChanged() {
598
		return this.getAttributesPanel().getAttributesSelectedOfSameLayerHasChanged();
599
	}
600
	
601
	/**
602
	 * @see WFSSelectAttributesPanel#resetAttributesSelectedOfSameLayerHasChanged()
603
	 */
604
	public void resetAttributesSelectedOfSameLayerHasChanged() {
605
		this.getAttributesPanel().resetAttributesSelectedOfSameLayerHasChanged();
606
	}
585 607
}
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSFilterPanel.java
49 49
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
50 50
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode;
51 51
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
52
import com.iver.cit.gvsig.gui.filter.DefaultExpressionDataSource;
52 53
import com.iver.cit.gvsig.gui.filter.ExpressionDataSource;
53 54
import com.iver.cit.gvsig.gui.filter.ExpressionListener;
54 55
import com.iver.cit.gvsig.gui.filter.FilterException;
......
155 156
	 * Adds some more listener to the components of the panel
156 157
	 */
157 158
	private void addNewListeners() {
159
		
160
		// Enable "Apply" button when user changes the filter query
158 161
		txtExpression.getDocument().addDocumentListener(new DocumentListener() {
159 162
			/*
160 163
			 *  (non-Javadoc)
......
229 232
			 * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
230 233
			 */
231 234
			public void valueChanged(TreeSelectionEvent e) {
232
				if (!panelAsATabForWFSLayersLoad) {
235
				if (!panelAsATabForWFSLayersLoad) {					
233 236
					DataReturnedOfDataLoadingFromActiveView data = DataLoadingFromActiveView.getDefaultExpressionDataSource();
234 237
		
235 238
					if ((data != null) && (data.getData() != null)) {
236
						setModel(data.getData());
239
//						setModel(data.getData());
237 240
						currentPath = e.getPath();
238 241
						fillValuesByPath(currentPath);
239 242
					}
......
246 249
	 * If there is a field selected, show its new values
247 250
	 */
248 251
	public void updateFieldValues() {
252
		
253
		// If has selected and loaded another layer -> reset previous values
254
//		if (this.panelAsATabForWFSLayersLoad) {
255
//			this.getValuesJList().removeAll();
256
//		}
257

  
258
		
249 259
		if (currentPath != null) {
260
			
250 261
			DataReturnedOfDataLoadingFromActiveView data = DataLoadingFromActiveView.getDefaultExpressionDataSource();
251
			
262
						
252 263
			if ((data != null) && (data.getData() != null)) {
253 264
				setModel(data.getData());				
254 265
				fillValuesByPath(currentPath);
255 266
				
256
				// Update all tables that their data is about the changed view
257
				IWindow[] activeNoModalWindows = PluginServices.getMDIManager().getAllWindows();
267
				// Updates all tables that their data is about the changed view
268
				this.updateTablesThatHasNewData();
269
			}
270
		}
271
	}
272
	
273
	/**
274
	 * Updates all tables that their data is about the changed view
275
	 */
276
	private void updateTablesThatHasNewData() {
277
		IWindow[] activeNoModalWindows = PluginServices.getMDIManager().getAllWindows();
278
		
279
		for (int i = 0; i < activeNoModalWindows.length; i++) {
280
			IWindow window = activeNoModalWindows[i];
281
			if (window instanceof Table) {
282
				Table table = (Table) window;
258 283
				
259
	
260
				for (int i = 0; i < activeNoModalWindows.length; i++) {
261
					IWindow window = activeNoModalWindows[i];
262
					if (window instanceof Table) {
263
						Table table = (Table) window;
264
						
265
						int pos1 = featureName.indexOf(':');
266
						
267
						if ((pos1 >= 0) && (pos1 < featureName.length()))						
268
							featureName = featureName.substring(pos1 +1, featureName.length());
269
						
270
//							String featureOfTable = ((XMLElement)currentPath.getParentPath().getLastPathComponent()).getName();
271
							String featureOfTable = table.getModel().getName();
272
							int pos2 = featureOfTable.indexOf(':');
273
														
274
							if ((pos2 >= 0) && (pos2 < featureName.length()))
275
								featureOfTable = featureOfTable.substring(pos2 +1, featureOfTable.length());						
276
						
277
						if (featureName.trim().compareTo(featureOfTable.trim()) == 0) {				
278
							setNewDataToTable();
279
						
280
							// Refresh the table with the new data
281
							table.refresh();
282
						}
283
					}
284
				int pos1 = featureName.indexOf(':');
285
				
286
				if ((pos1 >= 0) && (pos1 < featureName.length()))						
287
					featureName = featureName.substring(pos1 +1, featureName.length());
288
				
289
//					String featureOfTable = ((XMLElement)currentPath.getParentPath().getLastPathComponent()).getName();
290
					String featureOfTable = table.getModel().getName();
291
					int pos2 = featureOfTable.indexOf(':');
292
												
293
					if ((pos2 >= 0) && (pos2 < featureName.length()))
294
						featureOfTable = featureOfTable.substring(pos2 +1, featureOfTable.length());						
295
				
296
				if (featureName.trim().compareTo(featureOfTable.trim()) == 0) {				
297
					setNewDataToTable();
298
				
299
					// Refresh the table with the new data
300
					table.refresh();
284 301
				}
285 302
			}
286 303
		}
287
	}
304
	}	
288 305
	
289 306
	/**
290 307
	 * This method is a modification of the "execute" method from the "ShowTable" class 
......
350 367
			super.getValuesJList().setBackground(new Color(220, 220, 220));
351 368
		}
352 369
		else {
370
			// Unselect the selected path in the tree (if there was any selected)
371
			if (this.currentPath != null) {
372
				this.currentPath = null;
373
				this.getFieldsJTree().removeSelectionPath(this.getFieldsJTree().getSelectionPath());
374
			}
375
			
376
			// Resets data loaded
353 377
			super.getValuesJList().setEnabled(true);
354 378
			super.getValuesJList().setBackground(Color.WHITE);
379
			
380
			this.getFieldsJTree().removeAll();
381
			this.getValuesJList().removeAll();
382
			
383
			// Updates data associated to view with the new layer data
384
			this.setNewDataToTable();
385
			
386
			// If theres is any table associated to the current view -> update that table/s
387
//			this.updateTablesThatHasNewData();
388
			
389
			// Reads that new data
390
			DataReturnedOfDataLoadingFromActiveView data = DataLoadingFromActiveView.getDefaultExpressionDataSource();
391
			
392
			if ((data != null) && (data.getData() != null)) {
393
				setModel(data.getData());
394
//				currentPath = e.getPath();
395
//				fillValuesByPath(currentPath);
396
			}
355 397
		}
356 398
	}
357 399
	
358 400
	/**
359
	 * Rellena la lista con los valores del campo seleccionado
401
	 * Gets the value of the inner attribute: 'panelAsATabForWFSLayersLoad'
402
	 * 
403
	 * @return A boolean value
360 404
	 */
405
	public boolean getWFSFilterPanelIsAsTabForWFSLayersLoad() {
406
		return this.panelAsATabForWFSLayersLoad;
407
	}
408
	
409
	/** 
410
	 * FIlls list with the values of selected field
411
	 * 
412
	 * @param treePath A path in the tree
413
	 */
361 414
	private void fillValuesByPath(TreePath treePath) {
362 415
		// Duplicates are removed
363 416
		TreeSet conjunto = new TreeSet(new Comparator() {
......
597 650
        } catch (DriverException e1) {
598 651
            NotificationManager.addError(e1.getMessage(), e1);
599 652
        }
600
                
653

  
601 654
        try {
602 655
        	int numberOfFields = model.getFieldCount();
603 656

  
......
700 753
				expresion = expresion.substring(0, startIndex - 5) +
701 754
					expresion.substring(startIndex).replaceFirst(date + "\\)",
702 755
						new Long((filterButtonsJPanel.getDateFormat().parse(date)).getTime()).toString());
703
				;
756

  
704 757
			} else {
705 758
				startIndex += date.length();
706 759
			}
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSSelectAttributesPanel.java
1 1
package com.iver.cit.gvsig.gui.panels;
2 2

  
3
import java.beans.PropertyChangeEvent;
4
import java.beans.PropertyChangeListener;
3 5
import java.io.File;
4 6
import java.util.Vector;
5 7

  
......
63 65
 *
64 66
 * $Id$
65 67
 * $Log$
66
 * Revision 1.15  2006-11-01 17:29:08  jorpiell
68
 * Revision 1.16  2006-12-04 08:59:47  ppiqueras
69
 * Algunos bugs corregidos. A cambio hay 2 bugs relacionados que todavía no han sido corregidos (ver PHPCollab) (los tiene asignados Jorge).
70
 *
71
 * Revision 1.15  2006/11/01 17:29:08  jorpiell
67 72
 * Se ha elimiado el nodo virtual de la raiz. Adem?s ya se cargan los valores de un campo complejo en la pesta?a del filtro
68 73
 *
69 74
 * Revision 1.14  2006/10/31 09:39:18  jorpiell
......
133 138
	private AttributesTreeTableModel model = null;
134 139
	private WFSParamsPanel parent = null;
135 140
	private JPanel treeTablePanel = null;
141
	private boolean attributesSelectedOfSameLayerHasChanged;
136 142

  
137 143
	public WFSSelectAttributesPanel(WFSParamsPanel parent){
138 144
		super();
......
144 150
		this.setLayout(null);
145 151
		this.setBounds(10, 5, 481, 427);		
146 152
		this.add(getTreeTablePanel(), null);
153
		attributesSelectedOfSameLayerHasChanged = false;
147 154
	}
148 155

  
149 156
	/**
......
172 179
			attributesTreeTable = new AttributesTreeTable(model,this);
173 180
			attributesTreeTable.setLocation(new java.awt.Point(7,4));
174 181
			attributesTreeTable.setSize(new java.awt.Dimension(482,302));
182
			
183
			// If user has changed the attributes selection in the same layer
184
			attributesTreeTable.addPropertyChangeListener(new PropertyChangeListener() {
185
				/*
186
				 *  (non-Javadoc)
187
				 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
188
				 */
189
				public void propertyChange(PropertyChangeEvent evt) {
190
					if (evt.getPropertyName().compareTo("tableCellEditor") == 0) // If the selection of the attributes of the layer has changed
191
						attributesSelectedOfSameLayerHasChanged = true;					
192
					else if (evt.getPropertyName().compareTo("selectionModel") == 0) // If the layer has changed
193
						attributesSelectedOfSameLayerHasChanged = false;
194
				}
195
			});
175 196
		}
176 197
		return attributesTreeTable;
177 198
	}
......
224 245
	}
225 246
	
226 247
	/**
248
	 * Returns true if user has changed the selection of some attribute of the same layer; else returns false
249
	 * 
250
	 * @return A boolean value
251
	 */
252
	public boolean getAttributesSelectedOfSameLayerHasChanged() {
253
		return this.attributesSelectedOfSameLayerHasChanged;
254
	}
255
	
256
	/**
227 257
	 * @param updated The updated to set.
228 258
	 */
229 259
	public void setUpdated(boolean updated) {
230 260
		parent.isApplicable(updated);
231 261
	}
262

  
263
	/**
264
	 * Resets the value of the attribute 'attributesSelectedOfSameLayerHasChanged'
265
	 * 
266
	 * @return A boolean value
267
	 */
268
	public void resetAttributesSelectedOfSameLayerHasChanged() {
269
		this.attributesSelectedOfSameLayerHasChanged = false;
270
	}
232 271
}  //  @jve:decl-index=0:visual-constraint="10,22"
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSSelectFeaturePanel.java
8 8

  
9 9
import com.iver.andami.PluginServices;
10 10
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode;
11
import com.iver.cit.gvsig.gui.panels.LayerTable.LayerTableModel;
12 11
import com.iver.cit.gvsig.gui.wizards.WFSWizardData;
13 12

  
14 13
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
......
55 54
 *
56 55
 * $Id$
57 56
 * $Log$
58
 * Revision 1.8  2006-10-27 06:44:56  jorpiell
57
 * Revision 1.9  2006-12-04 08:59:47  ppiqueras
58
 * Algunos bugs corregidos. A cambio hay 2 bugs relacionados que todavía no han sido corregidos (ver PHPCollab) (los tiene asignados Jorge).
59
 *
60
 * Revision 1.8  2006/10/27 06:44:56  jorpiell
59 61
 * Se han cambiado algunas etiquetas de texto que sal?an recortadas
60 62
 *
61 63
 * Revision 1.7  2006/07/21 11:50:31  jaume
......
90 92
	private WFSWizardData data = null;
91 93
	private WFSParamsPanel parent = null;
92 94
	private JPanel layerNamePanel = null;
95
	
93 96

  
94 97
	/**
95 98
	 * This method initializes
......
160 163
			lstFeatures.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
161 164
				public void valueChanged(javax.swing.event.ListSelectionEvent e) {
162 165
					refreshData();
166
					
167
					// Indicate that now we are loading a new layer
168
					parent.setWFSFilterPanelIsAsTabForWFSLayersLoad(true);
163 169
				}
164 170
			});
165 171
		}
166 172
		return lstFeatures;
167 173
	}
168

  
174
	
169 175
	/**
170 176
	 * This method initializes jTextField
171 177
	 *
......
265 271
		}catch(NullPointerException e){
266 272
			getTxtName().setText(PluginServices.getText(this,"default_name"));
267 273
		}
274
		
268 275
		parent.refreshData(lyr);
269 276
	}
270 277

  

Also available in: Unified diff