Revision 42808 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretable/FeatureTablePanel.java

View differences:

FeatureTablePanel.java
50 50
import javax.swing.table.TableModel;
51 51

  
52 52
import org.gvsig.fmap.dal.DataStoreNotification;
53
import org.gvsig.fmap.dal.feature.FeatureSelection;
54
import org.gvsig.fmap.dal.feature.FeatureStore;
53 55
import org.gvsig.fmap.dal.swing.FeatureTableModel;
54 56
import org.gvsig.fmap.dal.swing.JFeatureTable;
55 57
import org.gvsig.i18n.Messages;
......
80 82
        table = new FeatureTable(tableModel);
81 83
        this.initComonents();
82 84
        tableModel.getFeatureStore().addObserver(this);
85
        tableModel.getFeatureSelection().addObserver(this);
86
        tableModel.addChangeListener(new ActionListener() {
87
            @Override
88
            public void actionPerformed(ActionEvent e) {
89
                if( FeatureTableModel.CHANGE_SELECTION.equals(e.getActionCommand()) ) {
90
                    featureSelectionChanged();
91
                }
92
            }
93
        });        
83 94
    }
95
    
96
    private void featureSelectionChanged() {
97
        ((FeatureTableModel)table.getModel()).getFeatureSelection().addObserver(this);
98
    }
84 99

  
85 100
    private void initComonents() {
86 101
        this.setLayout(new BorderLayout());
......
246 261

  
247 262
    @Override
248 263
    public void update(Observable observable, Object notification) {
249
        // If selection changes from nothing selected to anything selected
250
        // or the reverse, update selection info
251
        if ( notification instanceof DataStoreNotification ) {
252
            String type = ((DataStoreNotification) notification).getType();
253
            if ( DataStoreNotification.SELECTION_CHANGE.equals(type) ) {
254
                selectionLabel.setText( this.getSelectionLabel() );
255
            }
256
        }
264
    	if( observable instanceof FeatureSelection ) {
265
    		// Ha cambiado la seleccion, simplemente repintamos.
266
    		repaint();
267
    		return;
268
    	}
269
    	// If selection changes from nothing selected to anything selected
270
    	// or the reverse, update selection info
271
    	if( observable instanceof FeatureStore ) {
272
    		String type = ((DataStoreNotification) notification).getType();
273
    		if ( DataStoreNotification.SELECTION_CHANGE.equals(type) ) {
274
    			selectionLabel.setText( this.getSelectionLabel() );
275
    		}
276
    	}
257 277
    }
258 278

  
259 279
    @Override

Also available in: Unified diff