Revision 22477 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableRowsOperations.java
TableRowsOperations.java | ||
---|---|---|
4 | 4 |
import java.util.BitSet; |
5 | 5 |
import java.util.Iterator; |
6 | 6 |
|
7 |
import org.gvsig.fmap.data.DataException; |
|
7 | 8 |
import org.gvsig.fmap.data.ReadException; |
8 | 9 |
import org.gvsig.fmap.data.feature.Feature; |
9 | 10 |
import org.gvsig.fmap.data.feature.FeatureCollection; |
10 | 11 |
import org.gvsig.fmap.data.feature.FeatureStore; |
12 |
import org.gvsig.fmap.data.feature.MemoryFeatureCollection; |
|
11 | 13 |
import org.gvsig.fmap.mapcontext.layers.FBitSet; |
12 | 14 |
|
13 | 15 |
import com.iver.andami.PluginServices; |
... | ... | |
71 | 73 |
FeatureStore fs = table.getModel().getModelo(); |
72 | 74 |
FeatureCollection selection=(FeatureCollection)fs.getSelection(); |
73 | 75 |
FeatureCollection fCollection=(FeatureCollection)fs.getDataCollection(); |
74 |
fCollection.invalidate(selection);
|
|
76 |
fCollection.removeAll(selection);
|
|
75 | 77 |
fs.setSelection(fCollection); |
76 | 78 |
} catch (ReadException e) { |
77 | 79 |
e.printStackTrace(); |
78 | 80 |
NotificationManager.addError(e); |
81 |
} catch (DataException e) { |
|
82 |
e.printStackTrace(); |
|
83 |
NotificationManager.addError(e); |
|
79 | 84 |
} |
80 | 85 |
} |
81 | 86 |
|
82 | 87 |
private void showsSelectedRows(Table table) { |
83 | 88 |
long[] mapping=null; |
84 | 89 |
try { |
85 |
mapping = new long[table.getModel().getModelo().getRowCount()]; |
|
90 |
FeatureStore fs=table.getModel().getModelo(); |
|
91 |
mapping = new long[fs.getDataCollection().size()]; |
|
86 | 92 |
|
87 |
FBitSet selectedRows=table.getModel().getModelo().getSelection(); |
|
93 |
FeatureCollection selectedRows=(FeatureCollection)fs.getSelection(); |
|
94 |
|
|
88 | 95 |
int m=0; |
89 | 96 |
for (int i = selectedRows.nextSetBit(0); i >= 0; |
90 | 97 |
i = selectedRows.nextSetBit(i + 1)) { |
... | ... | |
129 | 136 |
return false; |
130 | 137 |
} |
131 | 138 |
|
132 |
protected boolean doIsEnabled(Table table) { |
|
133 |
try { |
|
134 |
BitSet indices = table.getSelectedFieldIndices(); |
|
139 |
// protected boolean doIsEnabled(Table table) { |
|
140 |
// try { |
|
141 |
// BitSet indices = table.getSelectedFieldIndices(); |
|
142 |
// |
|
143 |
// System.out.println("TableNumericFieldOperations.isEnabled: Tabla: " |
|
144 |
// + table.getModel().getModelo().getName()); |
|
145 |
// |
|
146 |
// if (indices.cardinality() == 1) { |
|
147 |
// int type = table.getModel().getModelo().getRecordset() |
|
148 |
// .getFieldType(indices.nextSetBit(0)); |
|
149 |
// if ((type == Types.BIGINT) || (type == Types.DECIMAL) |
|
150 |
// || (type == Types.DOUBLE) || (type == Types.FLOAT) |
|
151 |
// || (type == Types.INTEGER) || (type == Types.SMALLINT) |
|
152 |
// || (type == Types.TINYINT) || (type == Types.REAL) |
|
153 |
// || (type == Types.NUMERIC)) { |
|
154 |
// return true; |
|
155 |
// } |
|
156 |
// |
|
157 |
// } |
|
158 |
// } catch (ReadException e) { |
|
159 |
// e.printStackTrace(); |
|
160 |
// } |
|
161 |
// |
|
162 |
// return false; |
|
163 |
// } |
|
135 | 164 |
|
136 |
System.out.println("TableNumericFieldOperations.isEnabled: Tabla: " |
|
137 |
+ table.getModel().getModelo().getName()); |
|
138 |
|
|
139 |
if (indices.cardinality() == 1) { |
|
140 |
int type = table.getModel().getModelo().getRecordset() |
|
141 |
.getFieldType(indices.nextSetBit(0)); |
|
142 |
if ((type == Types.BIGINT) || (type == Types.DECIMAL) |
|
143 |
|| (type == Types.DOUBLE) || (type == Types.FLOAT) |
|
144 |
|| (type == Types.INTEGER) || (type == Types.SMALLINT) |
|
145 |
|| (type == Types.TINYINT) || (type == Types.REAL) |
|
146 |
|| (type == Types.NUMERIC)) { |
|
147 |
return true; |
|
148 |
} |
|
149 |
|
|
150 |
} |
|
151 |
} catch (ReadException e) { |
|
152 |
e.printStackTrace(); |
|
153 |
} |
|
154 |
|
|
155 |
return false; |
|
156 |
} |
|
157 |
|
|
158 | 165 |
/** |
159 | 166 |
* DOCUMENT ME! |
160 | 167 |
* |
Also available in: Unified diff