Revision 9153

View differences:

branches/v10/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
			}
......
958 1011
				}
959 1012
			}
960 1013
			
961
			if (fieldBranches.size() > 0){
962
				attributesTreeTableModel = new AttributesTreeTableModel(fieldBranches.get(0));
963
				fieldsJTree.setModel(new AttributesTreeTableModel(fieldBranches.get(0), false));
964
			}
1014
			attributesTreeTableModel = new AttributesTreeTableModel(fieldBranches.get(0));
1015
			fieldsJTree.setModel(new AttributesTreeTableModel(fieldBranches.get(0), false));
965 1016
		}
966 1017
	}
967 1018

  
branches/v10/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.7.2.3  2006-11-17 11:28:45  ppiqueras
67
 * Corregidos bugs y añadida nueva funcionalidad.
68
 * Revision 1.7.2.4  2006-12-04 09:39:34  ppiqueras
69
 * 1 Bug corregido
68 70
 *
71
 * Revision 1.16  2006/12/04 08:59:47  ppiqueras
72
 * Algunos bugs corregidos. A cambio hay 2 bugs relacionados que todavía no han sido corregidos (ver PHPCollab) (los tiene asignados Jorge).
73
 *
69 74
 * Revision 1.15  2006/11/01 17:29:08  jorpiell
70 75
 * 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
71 76
 *
......
136 141
	private AttributesTreeTableModel model = null;
137 142
	private WFSParamsPanel parent = null;
138 143
	private JPanel treeTablePanel = null;
144
	private boolean attributesSelectedOfSameLayerHasChanged;
139 145

  
140 146
	public WFSSelectAttributesPanel(WFSParamsPanel parent){
141 147
		super();
......
147 153
		this.setLayout(null);
148 154
		this.setBounds(10, 5, 481, 427);		
149 155
		this.add(getTreeTablePanel(), null);
156
		attributesSelectedOfSameLayerHasChanged = false;
150 157
	}
151 158

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

  
266
	/**
267
	 * Resets the value of the attribute 'attributesSelectedOfSameLayerHasChanged'
268
	 * 
269
	 * @return A boolean value
270
	 */
271
	public void resetAttributesSelectedOfSameLayerHasChanged() {
272
		this.attributesSelectedOfSameLayerHasChanged = false;
273
	}
235 274
}  //  @jve:decl-index=0:visual-constraint="10,22"
branches/v10/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.7.2.2  2006-11-17 11:28:45  ppiqueras
59
 * Corregidos bugs y añadida nueva funcionalidad.
57
 * Revision 1.7.2.3  2006-12-04 09:39:34  ppiqueras
58
 * 1 Bug corregido
60 59
 *
60
 * Revision 1.9  2006/12/04 08:59:47  ppiqueras
61
 * Algunos bugs corregidos. A cambio hay 2 bugs relacionados que todavía no han sido corregidos (ver PHPCollab) (los tiene asignados Jorge).
62
 *
61 63
 * Revision 1.8  2006/10/27 06:44:56  jorpiell
62 64
 * Se han cambiado algunas etiquetas de texto que sal?an recortadas
63 65
 *
......
93 95
	private WFSWizardData data = null;
94 96
	private WFSParamsPanel parent = null;
95 97
	private JPanel layerNamePanel = null;
98
	
96 99

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

  
177
	
172 178
	/**
173 179
	 * This method initializes jTextField
174 180
	 *
......
268 274
		}catch(NullPointerException e){
269 275
			getTxtName().setText(PluginServices.getText(this,"default_name"));
270 276
		}
277
		
271 278
		parent.refreshData(lyr);
272 279
	}
273 280

  

Also available in: Unified diff