Revision 10608

View differences:

trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSParamsPanel.java
67 67
 *
68 68
 * $Id$
69 69
 * $Log$
70
 * Revision 1.37  2007-03-01 13:12:09  ppiqueras
70
 * Revision 1.38  2007-03-05 13:49:42  ppiqueras
71
 * Si una capa WFS no tiene campos (y por tanto no tiene un campo obligatorio de tipo geometr?a), que avise al usuario y no permita que se intente cargar dicha capa.
72
 *
73
 * Revision 1.37  2007/03/01 13:12:09  ppiqueras
71 74
 * Mejorado el filtrado por ?rea.
72 75
 *
73 76
 * Revision 1.36  2007/02/22 12:30:59  ppiqueras
......
447 450
	 * Selected feature
448 451
	 */
449 452
	public void refreshData(WFSLayerNode feature){
453
		boolean refreshed = false;
454
		
450 455
		if (feature != null){
451 456
			feature = (WFSLayerNode)data.getFeatureInfo(feature.getName(),feature.getNameSpace());
452
			jTabbedPane.setEnabledAt(indFields,true);
453
			jTabbedPane.setEnabledAt(indFilter,true);
454
			jTabbedPane.setEnabledAt(indArea,true);
455
			fieldsPanel.refresh(feature);
456
			optionsPanel.refresh(feature);
457
			filterPanel.refresh(feature);
457
			
458
			refreshed = filterPanel.refresh(feature);
459
		
460
			if (refreshed) {
461
				jTabbedPane.setEnabledAt(indFields,true);
462
				jTabbedPane.setEnabledAt(indFilter,true);
463
				jTabbedPane.setEnabledAt(indArea,true);
464
				fieldsPanel.refresh(feature);
465
				optionsPanel.refresh(feature);
466
			}
467
			else {
468
				featurePanel.unselectAllFeatures();
469
			}
458 470
		}
459
		listenerSupport.callStateChanged(isCorretlyConfigured());
471
		
472
		if (refreshed)
473
			listenerSupport.callStateChanged(isCorretlyConfigured());
460 474

  
461 475
	}
462 476

  
......
716 730
				this.advanceCurrentTab();
717 731
		}
718 732
	}
719
	
733

  
720 734
	/**
721 735
	 * Selects the next tab
722 736
	 */
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSFilterPanel.java
454 454
	/**
455 455
	 * Refresh all information about fields
456 456
	 * 
457
	 * @param feature
457
	 * @param feature The layer to refresh
458
	 * 
459
	 * @return True if can refresh, False if not
458 460
	 */
459
	public void refresh(WFSLayerNode feature) {
461
	public boolean refresh(WFSLayerNode feature) {
460 462
		featureName = feature.getTitle();
461
		setFields(feature);
463
		return setFields(feature);
462 464
	}
463 465
	
464 466
	///// END GUI METHODS /////
......
1052 1054
	 * Sets Fields
1053 1055
	 *
1054 1056
	 * @param feature A Layer node with fields information
1057
	 * 
1058
	 * @return True if can refresh, False if not
1055 1059
	 */
1056
	private void setFields(WFSLayerNode feature) {
1060
	private boolean setFields(WFSLayerNode feature) {
1057 1061
		Vector fields = feature.getFields();
1058 1062
				
1059 1063
		this.resetFieldsAndValuesData();
......
1075 1079
							break;
1076 1080
						case IXMLType.COMPLEX: case IXMLType.SIMPLE: // Add branch / field
1077 1081
							fieldBranches.add(field);
1078
							
1079 1082
							break;
1080 1083
					}
1081 1084
				}
1082 1085
			}
1083 1086
			
1084
			fieldsTreeTableModel = new FieldsTreeTableModel(fieldBranches.get(0));
1085
			fieldsJTree.setModel(new FieldsTreeTableModel(fieldBranches.get(0), false));
1086
			
1087
			// Stores the name of all leafs (fields) of treeTableModel			
1088
			Object root = fieldsTreeTableModel.getRoot();
1089
			
1090
			if (root != null) {
1091
				Vector fieldsNames = fieldsTreeTableModel.getLeafsFromNodeBranch(root);
1087
			if (fieldBranches.size() > 0) {
1088
				Object obj = fieldBranches.get(0);
1092 1089
				
1093
				for (int j = 0; j < fieldsNames.size(); j++) {
1094
					Object field = fieldsNames.get(j);
1090
				fieldsTreeTableModel = new FieldsTreeTableModel(obj);
1091
				fieldsJTree.setModel(new FieldsTreeTableModel(obj, false));
1092

  
1093
				// Stores the name of all leafs (fields) of treeTableModel			
1094
				Object root = fieldsTreeTableModel.getRoot();
1095
				
1096
				if (root != null) {
1097
					Vector fieldsNames = fieldsTreeTableModel.getLeafsFromNodeBranch(root);
1095 1098
					
1096
					// Avoid errors
1097
					if ( (! (field instanceof XMLElement)) || (field == null) )
1098
						continue;
1099
					
1100
					// Don't load a geometry field					
1101
					if (((XMLElement)field).getEntityType() != null){
1102
						if ( ((XMLElement)field).getEntityType().getType() == IXMLType.GML_GEOMETRY ){
1099
					for (int j = 0; j < fieldsNames.size(); j++) {
1100
						Object field = fieldsNames.get(j);
1101
						
1102
						// Avoid errors
1103
						if ( (! (field instanceof XMLElement)) || (field == null) )
1103 1104
							continue;
1105
						
1106
						// Don't load a geometry field					
1107
						if (((XMLElement)field).getEntityType() != null){
1108
							if ( ((XMLElement)field).getEntityType().getType() == IXMLType.GML_GEOMETRY ){
1109
								continue;
1110
							}
1104 1111
						}
1112
						
1113
						String completeFieldPath = this.getPathOfLeafWithoutRoot(field);
1114
						
1115
						if (! allFieldsAndValuesKnownOfCurrentLayer.containsKey(completeFieldPath) ) {
1116
							allFieldsAndValuesKnownOfCurrentLayer.put(completeFieldPath, new HashMap());
1117
						}
1105 1118
					}
1106
					
1107
					String completeFieldPath = this.getPathOfLeafWithoutRoot(field);
1108
					
1109
					if (! allFieldsAndValuesKnownOfCurrentLayer.containsKey(completeFieldPath) ) {
1110
						allFieldsAndValuesKnownOfCurrentLayer.put(completeFieldPath, new HashMap());
1111
					}
1112 1119
				}
1113 1120
			}
1121
			else {
1122
				// If there is no geometry field (that is the root) -> don't load the layer
1123
				JOptionPane.showMessageDialog(null, PluginServices.getText(null, "gvSIG_cant_load_the_layer_because_hasnt_geometry"), PluginServices.getText(null, "error"), JOptionPane.ERROR_MESSAGE);
1124
					
1125
				return false;
1126
			}
1114 1127
		}
1128

  
1129
		return true;
1115 1130
	}
1116 1131

  
1117 1132
	/**
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSSelectFeaturePanel.java
59 59
 *
60 60
 * $Id$
61 61
 * $Log$
62
 * Revision 1.16  2007-02-22 12:25:09  ppiqueras
62
 * Revision 1.17  2007-03-05 13:49:42  ppiqueras
63
 * Si una capa WFS no tiene campos (y por tanto no tiene un campo obligatorio de tipo geometr?a), que avise al usuario y no permita que se intente cargar dicha capa.
64
 *
65
 * Revision 1.16  2007/02/22 12:25:09  ppiqueras
63 66
 * A?adidas tool tip text.
64 67
 *
65 68
 * Revision 1.15  2007/02/09 14:12:39  jorpiell
......
301 304

  
302 305
	/**
303 306
	 * Refresh the features list
304
	 *
305 307
	 */
306 308
	public void refreshInfo(){
309
		// Unselects all features
310
		unselectAllFeatures();
311
		
312
		// Add the new features
313
		getLstFeatures().addFeatures(data.getFeatures());
314
	}
315

  
316
	/**
317
	 * Updates the list with no feature selected
318
	 */
319
	public void unselectAllFeatures() {
307 320
		// Reset the last row selection of the features table
308 321
		int numberOfFeatures = getLstFeatures().getRowCount();
322

  
309 323
		if (numberOfFeatures > 0) {			
310 324
			ListSelectionModel model = getLstFeatures().getSelectionModel();
311 325
			model.removeSelectionInterval(0, numberOfFeatures - 1); // whatever row selection
312 326
		}
313
		
314
		// Add the new features
315
		getLstFeatures().addFeatures(data.getFeatures());
316 327
	}
317

  
328
	
318 329
	/**
319 330
	 * Refreshes the wizard components data each time a feature
320 331
	 * is selected. The describeFeatureType operation must be

Also available in: Unified diff