Revision 38518 branches/v2_0_0_prep/extensions/extWFS2/src/org/gvsig/wfs/gui/panels/WFSSelectFeaturePanel.java

View differences:

WFSSelectFeaturePanel.java
40 40
import org.gvsig.utils.StringComparator;
41 41
import org.gvsig.wfs.gui.panels.WFSSelectFeaturePanel.LayerTable.LayerTableModel;
42 42
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeature;
43
import org.gvsig.wfs.gui.wizards.WFSWizard;
43 44

  
44 45

  
45 46
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
......
240 241

  
241 242
		return lstFeatures;
242 243
	}
244
	
245
    public int getSelectedFeaturesCount() {
243 246

  
247
        if (lstFeatures == null) {
248
            return 0;
249
        }
250
        
251
        ListSelectionModel m = lstFeatures.getSelectionModel();
252
        if (m == null || m.isSelectionEmpty()) {
253
            return 0;
254
        } else {
255
            int resp = 0;
256
            for (int i = m.getMinSelectionIndex();
257
                i <= m.getMaxSelectionIndex();
258
                i++) {
259

  
260
                if (m.isSelectedIndex(i)) {
261
                    resp++;
262
                }
263
            }
264
            return resp;
265
        }
266

  
267
    }
268

  
244 269
	/**
245 270
	 * Creates the list selection listener for the layers list
246 271
	 * 
......
268 293
			
269 294
						refreshData();
270 295
					}
296
					
297
                    // =============================================
298
                    // If zero selected, settings are invalid
299
					int n_sel = getSelectedFeaturesCount();
300
					if (n_sel == 0) {
301
	                       Object obj = getPanelGroup();
302
	                       if (obj != null && obj instanceof WFSParamsPanel) {
303
	                           obj = ((WFSParamsPanel) obj).getParent();
304
	                           if (obj instanceof WFSWizard) {
305
	                               ((WFSWizard) obj).callStateChanged(false); 
306
	                           }
307
	                       }
308
					}
309
					// =============================================
271 310
				}
272 311
			};	
273 312
		}

Also available in: Unified diff