Revision 45159
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/DefaultEditableFeatureType.java | ||
---|---|---|
138 | 138 |
FeatureAttributeDescriptor other) { |
139 | 139 |
DefaultEditableFeatureAttributeDescriptor editableAttr; |
140 | 140 |
editableAttr = new DefaultEditableFeatureAttributeDescriptor( |
141 |
(DefaultFeatureAttributeDescriptor) other);
|
|
141 |
(DefaultFeatureAttributeDescriptor) other); |
|
142 | 142 |
super.add(editableAttr); |
143 |
if( !editableAttr.isComputed() ) {
|
|
143 |
if (!editableAttr.isComputed()) {
|
|
144 | 144 |
this.hasStrongChanges = true; |
145 |
}
|
|
145 |
} |
|
146 | 146 |
this.fixAll(); |
147 | 147 |
return editableAttr; |
148 | 148 |
} |
... | ... | |
174 | 174 |
|
175 | 175 |
@Override |
176 | 176 |
public void removeAll() { |
177 |
while( !super.isEmpty() ) {
|
|
177 |
while (!super.isEmpty()) {
|
|
178 | 178 |
super.remove(0); |
179 | 179 |
} |
180 | 180 |
this.fixAll(); |
... | ... | |
185 | 185 |
super.addAll(attributes); |
186 | 186 |
this.fixAll(); |
187 | 187 |
} |
188 |
|
|
188 |
|
|
189 | 189 |
private EditableFeatureAttributeDescriptor add(String name, int type, boolean strongChanges) { |
190 | 190 |
DefaultEditableFeatureAttributeDescriptor attr = new DefaultEditableFeatureAttributeDescriptor(this, strongChanges); |
191 | 191 |
Iterator iter = this.iterator(); |
... | ... | |
226 | 226 |
} |
227 | 227 |
attr.setDataType(type); |
228 | 228 |
attr.setIndex(this.size()); |
229 |
|
|
229 |
|
|
230 | 230 |
this.hasStrongChanges = this.hasStrongChanges || strongChanges; |
231 | 231 |
super.add(attr); |
232 | 232 |
this.pk = null; |
... | ... | |
255 | 255 |
} |
256 | 256 |
return this.add(name, type, false).setFeatureAttributeEmulator(emulator); |
257 | 257 |
} |
258 |
|
|
258 |
|
|
259 | 259 |
@Override |
260 | 260 |
public EditableFeatureAttributeDescriptor add(String name, String type) { |
261 |
return this.add(name,ToolsLocator.getDataTypesManager().getType(type)); |
|
261 |
return this.add(name, ToolsLocator.getDataTypesManager().getType(type));
|
|
262 | 262 |
} |
263 | 263 |
|
264 | 264 |
@Override |
265 | 265 |
public EditableFeatureAttributeDescriptor add(String name, String type, int size) { |
266 |
return this.add(name,ToolsLocator.getDataTypesManager().getType(type), size); |
|
266 |
return this.add(name, ToolsLocator.getDataTypesManager().getType(type), size);
|
|
267 | 267 |
} |
268 | 268 |
|
269 | 269 |
public Object removeAttributeDescriptor(String name) { |
... | ... | |
272 | 272 |
// a estos metodos remove, llama a los de la superclase ArrayList. |
273 | 273 |
return this.remove(name); |
274 | 274 |
} |
275 |
|
|
275 |
|
|
276 | 276 |
public boolean removeAttributeDescriptor(EditableFeatureAttributeDescriptor attribute) { |
277 | 277 |
return this.remove(attribute); |
278 | 278 |
} |
... | ... | |
280 | 280 |
@Override |
281 | 281 |
public FeatureAttributeDescriptor remove(int index) { |
282 | 282 |
FeatureAttributeDescriptor attr = (FeatureAttributeDescriptor) this.get(index); |
283 |
if ( !attr.isComputed() ) {
|
|
283 |
if (!attr.isComputed()) {
|
|
284 | 284 |
hasStrongChanges = true; |
285 | 285 |
} |
286 |
if( index == this.getDefaultGeometryAttributeIndex() ) {
|
|
287 |
this.defaultGeometryAttributeIndex = -1;
|
|
286 |
if (index == this.getDefaultGeometryAttributeIndex()) {
|
|
287 |
this.defaultGeometryAttributeIndex = -1; |
|
288 | 288 |
this.defaultGeometryAttributeName = null; |
289 |
} else if( index == this.getDefaultTimeAttributeIndex() ) {
|
|
289 |
} else if (index == this.getDefaultTimeAttributeIndex()) {
|
|
290 | 290 |
this.defaultTimeAttributeIndex = -1; |
291 | 291 |
this.defaultTimeAttributeName = null; |
292 | 292 |
} |
... | ... | |
295 | 295 |
this.fixAll(); |
296 | 296 |
return attr; |
297 | 297 |
} |
298 |
|
|
298 |
|
|
299 | 299 |
@Override |
300 | 300 |
public Object remove(String name) { |
301 | 301 |
FeatureAttributeDescriptor attr = (FeatureAttributeDescriptor) this.get(name); |
... | ... | |
350 | 350 |
@Override |
351 | 351 |
public void setDefaultGeometryType(int type, int subType) { |
352 | 352 |
EditableFeatureAttributeDescriptor descr = (EditableFeatureAttributeDescriptor) this.getDefaultGeometryAttribute(); |
353 |
if( descr == null ) {
|
|
353 |
if (descr == null) {
|
|
354 | 354 |
throw new IllegalStateException("Default geometry attribute not set."); |
355 | 355 |
} |
356 | 356 |
descr.setGeometryType(type, subType); |
... | ... | |
365 | 365 |
} |
366 | 366 |
FeatureAttributeDescriptor attr = this.getAttributeDescriptor(name); |
367 | 367 |
if (attr == null) { |
368 |
throw new IllegalArgumentException("Attribute '"+name+"' not found.");
|
|
368 |
throw new IllegalArgumentException("Attribute '" + name + "' not found.");
|
|
369 | 369 |
} |
370 | 370 |
this.defaultGeometryAttributeName = name; |
371 | 371 |
this.defaultGeometryAttributeIndex = attr.getIndex(); |
... | ... | |
435 | 435 |
protected void setAllowAutomaticValues(boolean value) { |
436 | 436 |
this.allowAtomaticValues = value; |
437 | 437 |
} |
438 |
|
|
438 |
|
|
439 | 439 |
@Override |
440 | 440 |
public void copyFrom(FeatureType other) { |
441 | 441 |
super.copyFrom(other); |
... | ... | |
448 | 448 |
this.source = (DefaultFeatureType) other; |
449 | 449 |
} |
450 | 450 |
} |
451 |
|
|
451 |
|
|
452 | 452 |
public void copyFrom(JsonObject json) { |
453 |
|
|
453 |
|
|
454 | 454 |
} |
455 | 455 |
} |
Also available in: Unified diff