Revision 8862

View differences:

branches/v10/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSFilterPanel.java
40 40
import com.iver.andami.ui.mdiManager.IWindow;
41 41
import com.iver.andami.ui.mdiManager.IWindowListener;
42 42
import com.iver.andami.ui.mdiManager.WindowInfo;
43
import com.iver.cit.gvsig.ProjectExtension;
44
import com.iver.cit.gvsig.fmap.edition.EditableAdapter;
45
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter;
46
import com.iver.cit.gvsig.fmap.layers.FLayer;
47
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
48
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
49
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
43 50
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode;
51
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
44 52
import com.iver.cit.gvsig.gui.filter.ExpressionDataSource;
45 53
import com.iver.cit.gvsig.gui.filter.ExpressionListener;
46 54
import com.iver.cit.gvsig.gui.filter.FilterException;
47 55
import com.iver.cit.gvsig.gui.panels.attributesTree.AttributesTreeTableModel;
56
import com.iver.cit.gvsig.project.ProjectFactory;
57
import com.iver.cit.gvsig.project.documents.table.ProjectTable;
58
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory;
48 59
import com.iver.cit.gvsig.project.documents.table.gui.Table;
60
import com.iver.cit.gvsig.project.documents.view.gui.View;
49 61
import com.iver.utiles.DefaultCharSet;
50 62
import com.iver.utiles.StringUtilities;
51 63
import com.iver.utiles.exceptionHandling.ExceptionHandlingSupport;
......
262 274
							if ((pos2 >= 0) && (pos2 < featureName.length()))
263 275
								featureOfTable = featureOfTable.substring(pos2 +1, featureOfTable.length());						
264 276
						
265
						if (featureName.trim().compareTo(featureOfTable.trim()) == 0)
277
						if (featureName.trim().compareTo(featureOfTable.trim()) == 0) {				
278
							setNewDataToTable();
279
						
280
							// Refresh the table with the new data
266 281
							table.refresh();
282
						}
267 283
					}
268 284
				}
269 285
			}
270 286
		}
271 287
	}
288
	
289
	/**
290
	 * This method is a modification of the "execute" method from the "ShowTable" class 
291
	 * @see com.iver.cit.gvsig.ShowTable#execute(String)
292
	 */
293
	private void setNewDataToTable() {
294
		View vista = (View) PluginServices.getMDIManager().getActiveWindow();
295
		FLayer[] actives = vista.getModel().getMapContext().getLayers().getActives();
272 296

  
297
		try {
298
			for (int i = 0; i < actives.length; i++) {
299
				if (actives[i] instanceof AlphanumericData) {
300
					AlphanumericData co = (AlphanumericData) actives[i];
301

  
302
					//SelectableDataSource dataSource;
303
					//dataSource = co.getRecordset();
304

  
305
					ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
306

  
307
					ProjectTable projectTable = ext.getProject().getTable(co);
308
					EditableAdapter ea=null;
309
					ReadableVectorial rv=((FLyrVect)actives[i]).getSource();
310
					if (rv instanceof VectorialEditableAdapter){
311
						ea=(EditableAdapter)((FLyrVect)actives[i]).getSource();
312
					}else{
313
						ea=new EditableAdapter();
314
						SelectableDataSource sds=((FLyrVect)actives[i]).getRecordset();
315
						ea.setOriginalDataSource(sds);
316
					}
317

  
318
					if (projectTable == null) {
319
						projectTable = ProjectFactory.createTable(PluginServices.getText(this, "Tabla_de_Atributos") + ": " + actives[i].getName(),
320
								ea);
321
						projectTable.setProjectDocumentFactory(new ProjectTableFactory());
322
						projectTable.setAssociatedTable(co);
323
						ext.getProject().addDocument(projectTable);
324
					}
325
					projectTable.setModel(ea);					
326
//					Table t = new Table();
327
//					t.setModel(projectTable);
328
//					PluginServices.getMDIManager().addWindow(t);
329
				}
330
			}
331
		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
332
            NotificationManager.addError(PluginServices.getText(this,"No_se_pudo_obtener_la_tabla_de_la_capa"), e);
333
        } catch (com.iver.cit.gvsig.fmap.DriverException e) {
334
			e.printStackTrace();
335
			NotificationManager.addError(PluginServices.getText(this,"No_se_pudo_obtener_la_tabla_de_la_capa"), e);
336
        }
337
	}
338

  
273 339
	/**
274 340
	 * Sets the value of the inner attribute: 'panelAsATabForWFSLayersLoad'
275 341
	 * 

Also available in: Unified diff