Revision 45807
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeature.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
private DefaultFeature source; |
64 | 64 |
// private boolean inserted; |
65 |
private boolean modified; |
|
65 | 66 |
|
66 | 67 |
protected DefaultEditableFeature(DefaultFeature feature) { |
67 | 68 |
super(feature); |
68 | 69 |
this.source = feature; |
69 | 70 |
// this.inserted = this.source!=null; |
71 |
this.modified = false; |
|
70 | 72 |
} |
71 | 73 |
|
72 | 74 |
protected DefaultEditableFeature(DefaultEditableFeature feature) { |
73 | 75 |
super(feature); |
74 | 76 |
this.source = (DefaultFeature) feature.getSource(); |
75 | 77 |
// this.inserted = this.source!=null; |
78 |
this.modified = feature.modified; |
|
76 | 79 |
} |
77 | 80 |
|
78 | 81 |
public DefaultEditableFeature(DefaultFeatureStore store, FeatureProvider data) { |
... | ... | |
80 | 83 |
super(store, data); |
81 | 84 |
this.source = null; |
82 | 85 |
// this.inserted = this.source!=null; |
86 |
this.modified = false; |
|
83 | 87 |
} |
84 | 88 |
|
85 | 89 |
@Override |
... | ... | |
117 | 121 |
FeatureAttributeDescriptor attribute = this.getType() |
118 | 122 |
.getAttributeDescriptor( |
119 | 123 |
this.getType().getDefaultGeometryAttributeIndex()); |
124 |
modified = true; |
|
120 | 125 |
this.set(attribute, geometry); |
121 | 126 |
} |
122 | 127 |
|
... | ... | |
130 | 135 |
if ( attribute == null ) { |
131 | 136 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
132 | 137 |
} |
138 |
modified = true; |
|
133 | 139 |
this.set(attribute, value); |
134 | 140 |
} |
135 | 141 |
|
136 | 142 |
@Override |
137 | 143 |
public void set(int index, Object value) { |
138 | 144 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
145 |
modified = true; |
|
139 | 146 |
this.set(attribute, value); |
140 | 147 |
} |
141 | 148 |
|
... | ... | |
145 | 152 |
if ( attribute == null ) { |
146 | 153 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
147 | 154 |
} |
155 |
modified = true; |
|
148 | 156 |
this.set(attribute, value); |
149 | 157 |
} |
150 | 158 |
|
151 | 159 |
@Override |
152 | 160 |
public void setArray(int index, Object[] value) { |
153 | 161 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
162 |
modified = true; |
|
154 | 163 |
this.set(attribute, value); |
155 | 164 |
} |
156 |
|
|
165 |
|
|
157 | 166 |
@Override |
158 | 167 |
public void setBoolean(String name, boolean value) { |
159 | 168 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(name); |
160 | 169 |
if ( attribute == null ) { |
161 | 170 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
162 | 171 |
} |
172 |
modified = true; |
|
163 | 173 |
this.set(attribute, Boolean.valueOf(value)); |
164 | 174 |
} |
165 | 175 |
|
166 | 176 |
@Override |
167 | 177 |
public void setBoolean(int index, boolean value) { |
168 | 178 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
179 |
modified = true; |
|
169 | 180 |
this.set(attribute, value); |
170 | 181 |
} |
171 | 182 |
|
... | ... | |
175 | 186 |
if ( attribute == null ) { |
176 | 187 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
177 | 188 |
} |
189 |
modified = true; |
|
178 | 190 |
this.set(attribute, value); |
179 | 191 |
} |
180 | 192 |
|
181 | 193 |
@Override |
182 | 194 |
public void setByte(int index, byte value) { |
183 | 195 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
196 |
modified = true; |
|
184 | 197 |
this.set(attribute, value); |
185 | 198 |
} |
186 | 199 |
|
... | ... | |
190 | 203 |
if ( attribute == null ) { |
191 | 204 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
192 | 205 |
} |
206 |
modified = true; |
|
193 | 207 |
this.set(attribute, value); |
194 | 208 |
} |
195 | 209 |
|
196 | 210 |
@Override |
197 | 211 |
public void setDate(int index, Date value) { |
198 | 212 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
213 |
modified = true; |
|
199 | 214 |
this.set(attribute, value); |
200 | 215 |
} |
201 | 216 |
|
... | ... | |
205 | 220 |
if ( attribute == null ) { |
206 | 221 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
207 | 222 |
} |
223 |
modified = true; |
|
208 | 224 |
this.set(attribute, value); |
209 | 225 |
} |
210 | 226 |
|
211 | 227 |
@Override |
212 | 228 |
public void setDouble(int index, double value) { |
213 | 229 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
230 |
modified = true; |
|
214 | 231 |
this.set(attribute, value); |
215 | 232 |
} |
216 | 233 |
|
... | ... | |
220 | 237 |
if ( attribute == null ) { |
221 | 238 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
222 | 239 |
} |
240 |
modified = true; |
|
223 | 241 |
this.set(attribute, value); |
224 | 242 |
} |
225 | 243 |
|
226 | 244 |
@Override |
227 | 245 |
public void setDecimal(int index, BigDecimal value) { |
228 | 246 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
247 |
modified = true; |
|
229 | 248 |
this.set(attribute, value); |
230 | 249 |
} |
231 | 250 |
|
... | ... | |
235 | 254 |
if ( attribute == null ) { |
236 | 255 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
237 | 256 |
} |
257 |
modified = true; |
|
238 | 258 |
this.set(attribute, value); |
239 | 259 |
} |
240 | 260 |
|
241 | 261 |
@Override |
242 | 262 |
public void setFeature(int index, Feature value) { |
243 | 263 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
264 |
modified = true; |
|
244 | 265 |
this.set(attribute, value); |
245 | 266 |
} |
246 | 267 |
|
... | ... | |
250 | 271 |
if ( attribute == null ) { |
251 | 272 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
252 | 273 |
} |
274 |
modified = true; |
|
253 | 275 |
this.set(attribute, value); |
254 | 276 |
} |
255 | 277 |
|
256 | 278 |
@Override |
257 | 279 |
public void setFloat(int index, float value) { |
258 | 280 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
281 |
modified = true; |
|
259 | 282 |
this.set(attribute, value); |
260 | 283 |
} |
261 | 284 |
|
... | ... | |
265 | 288 |
if ( attribute == null ) { |
266 | 289 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
267 | 290 |
} |
291 |
modified = true; |
|
268 | 292 |
this.set(attribute, value); |
269 | 293 |
} |
270 | 294 |
|
271 | 295 |
@Override |
272 | 296 |
public void setGeometry(int index, Geometry value) { |
273 | 297 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
298 |
modified = true; |
|
274 | 299 |
this.set(attribute, value); |
275 | 300 |
} |
276 | 301 |
|
... | ... | |
280 | 305 |
if ( attribute == null ) { |
281 | 306 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
282 | 307 |
} |
308 |
modified = true; |
|
283 | 309 |
this.set(attribute, value); |
284 | 310 |
} |
285 | 311 |
|
286 | 312 |
@Override |
287 | 313 |
public void setInt(int index, int value) { |
288 | 314 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
315 |
modified = true; |
|
289 | 316 |
this.set(attribute, value); |
290 | 317 |
} |
291 | 318 |
|
... | ... | |
295 | 322 |
if ( attribute == null ) { |
296 | 323 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
297 | 324 |
} |
325 |
modified = true; |
|
298 | 326 |
this.set(attribute, value); |
299 | 327 |
} |
300 | 328 |
|
301 | 329 |
@Override |
302 | 330 |
public void setLong(int index, long value) { |
303 | 331 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
332 |
modified = true; |
|
304 | 333 |
this.set(attribute, value); |
305 | 334 |
} |
306 | 335 |
|
... | ... | |
310 | 339 |
if ( attribute == null ) { |
311 | 340 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
312 | 341 |
} |
342 |
modified = true; |
|
313 | 343 |
this.set(attribute, value); |
314 | 344 |
} |
315 | 345 |
|
316 | 346 |
@Override |
317 | 347 |
public void setString(int index, String value) { |
318 | 348 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
349 |
modified = true; |
|
319 | 350 |
this.set(attribute, value); |
320 | 351 |
} |
321 | 352 |
|
... | ... | |
506 | 537 |
if ( attribute == null ) { |
507 | 538 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
508 | 539 |
} |
540 |
modified = true; |
|
509 | 541 |
this.set(attribute, value); |
510 | 542 |
} |
511 | 543 |
|
512 | 544 |
@Override |
513 | 545 |
public void setInstant(int index, Instant value) { |
514 | 546 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
547 |
modified = true; |
|
515 | 548 |
this.set(attribute, value); |
516 | 549 |
} |
517 | 550 |
|
... | ... | |
521 | 554 |
if ( attribute == null ) { |
522 | 555 |
throw new IllegalArgumentException("Attribute '" + name + "' does not exits in the feature."); |
523 | 556 |
} |
557 |
modified = true; |
|
524 | 558 |
this.set(attribute, value); |
525 | 559 |
} |
526 | 560 |
|
527 | 561 |
@Override |
528 | 562 |
public void setInterval(int index, Interval value) { |
529 | 563 |
FeatureAttributeDescriptor attribute = this.getType().getAttributeDescriptor(index); |
564 |
modified = true; |
|
530 | 565 |
this.set(attribute, value); |
531 | 566 |
} |
532 | 567 |
|
... | ... | |
549 | 584 |
((DefaultFeatureType) this.data.getType()).validateFeature(this, check); |
550 | 585 |
} |
551 | 586 |
|
587 |
public boolean isModified() { |
|
588 |
return modified; |
|
589 |
} |
|
590 |
|
|
552 | 591 |
} |
Also available in: Unified diff