Revision 24759 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableRowsOperations.java

View differences:

TableRowsOperations.java
1 1
package com.iver.cit.gvsig;
2 2

  
3
import java.sql.Types;
4
import java.util.BitSet;
5
import java.util.Iterator;
3
import org.gvsig.fmap.dal.exception.DataException;
4
import org.gvsig.fmap.dal.feature.FeatureStore;
6 5

  
7
import org.gvsig.fmap.data.DataException;
8
import org.gvsig.fmap.data.ReadException;
9
import org.gvsig.fmap.data.feature.Feature;
10
import org.gvsig.fmap.data.feature.FeatureCollection;
11
import org.gvsig.fmap.data.feature.FeatureStore;
12
import org.gvsig.fmap.data.feature.MemoryFeatureCollection;
13
import org.gvsig.fmap.mapcontext.layers.FBitSet;
14

  
15 6
import com.iver.andami.PluginServices;
16 7
import com.iver.andami.messages.NotificationManager;
17 8
import com.iver.andami.plugins.Extension;
......
55 46
        if (v != null) {
56 47
            if (v.getClass() == Table.class) {
57 48
                Table table = (Table) v;
58
                if (actionCommand.compareTo("SELECTIONUP") == 0)
59
                	showsSelectedRows(table);
60
                if (actionCommand.compareTo("INVERTSELECTION") == 0)
61
                	invertSelection(table);
49
                if (actionCommand.compareTo("SELECTIONUP") == 0) {
50
					showsSelectedRows(table);
51
				}
52
                if (actionCommand.compareTo("INVERTSELECTION") == 0) {
53
					invertSelection(table);
54
				}
62 55
                table.getModel().setModified(true);
63 56
            }
64 57
        }
......
71 64
    private void invertSelection(Table table) {
72 65
    	try {
73 66
    		FeatureStore fs = table.getModel().getModel();
74
    		FeatureCollection selection=(FeatureCollection)fs.getSelection();
75
    		FeatureCollection fCollection=(FeatureCollection)fs.getDataCollection();
76
    		fCollection.removeAll(selection);
77
    		fs.setSelection(fCollection);
78
    	} catch (ReadException e) {
67
    		fs.getFeatureSelection().reverse();
68
    	} catch (DataException e) {
79 69
			e.printStackTrace();
80 70
			NotificationManager.addError(e);
81
		} catch (DataException e) {
82
			e.printStackTrace();
83
			NotificationManager.addError(e);
84 71
		}
85 72
    }
86 73

  
......
127 114
        if (v.getClass() == Table.class) {
128 115
            Table table = (Table) v;
129 116

  
130
//            try {
131
				return !table.getModel().getModel().getSelection().isEmpty();
132
//			} catch (ReadException e) {
133
//				e.printStackTrace();
134
//			}
117
            try {
118
				return !table.getModel().getModel().getFeatureSelection().isEmpty();
119
			} catch (DataException e) {
120
				NotificationManager.addError(e);
121
			}
135 122
        }
136 123

  
137 124
        return false;

Also available in: Unified diff