Revision 20419 trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/DefaultAttributeDescriptor.java
DefaultAttributeDescriptor.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
package org.gvsig.data.vectorial; |
44 | 44 |
|
45 |
import java.util.HashMap; |
|
46 | 45 |
|
47 | 46 |
|
48 | 47 |
/** |
... | ... | |
68 | 67 |
protected boolean readOnly; |
69 | 68 |
protected String expression; |
70 | 69 |
|
71 |
private boolean editing = false;
|
|
72 |
private HashMap originalValues=new HashMap();
|
|
73 |
private boolean loading = false;
|
|
70 |
protected boolean editing = false;
|
|
71 |
protected IFeatureAttributeDescriptor oldAttributeDescriptor;
|
|
72 |
protected boolean loading = false;
|
|
74 | 73 |
|
75 | 74 |
public DefaultAttributeDescriptor() { |
76 | 75 |
} |
... | ... | |
151 | 150 |
public void setName(String name) throws IsNotAttributeSettingException { |
152 | 151 |
if (!editing && !loading) |
153 | 152 |
throw new IsNotAttributeSettingException("setName"); |
154 |
if (editing) |
|
155 |
originalValues.put("name",this.name); |
|
153 |
// if (editing)
|
|
154 |
// originalValues.put("name",this.name);
|
|
156 | 155 |
this.name = name; |
157 | 156 |
} |
158 | 157 |
|
... | ... | |
166 | 165 |
public void setPrecision(int precision) throws IsNotAttributeSettingException { |
167 | 166 |
if (!editing && !loading) |
168 | 167 |
throw new IsNotAttributeSettingException("setPrecision"); |
169 |
if (editing) |
|
170 |
originalValues.put("precision",new Integer(this.precision)); |
|
168 |
// if (editing)
|
|
169 |
// originalValues.put("precision",new Integer(this.precision));
|
|
171 | 170 |
this.precision = precision; |
172 | 171 |
} |
173 | 172 |
public void setSize(int size) throws IsNotAttributeSettingException { |
174 | 173 |
if (!editing && !loading) |
175 | 174 |
throw new IsNotAttributeSettingException("setSize"); |
176 |
if (editing) |
|
177 |
originalValues.put("size",new Integer(this.size)); |
|
175 |
// if (editing)
|
|
176 |
// originalValues.put("size",new Integer(this.size));
|
|
178 | 177 |
this.size = size; |
179 | 178 |
} |
180 | 179 |
public void setType(String type) throws IsNotAttributeSettingException { |
181 | 180 |
if (!editing && !loading) |
182 | 181 |
throw new IsNotAttributeSettingException("setType"); |
183 |
if (editing) |
|
184 |
originalValues.put("type",this.type); |
|
182 |
// if (editing)
|
|
183 |
// originalValues.put("type",this.type);
|
|
185 | 184 |
this.type = type; |
186 | 185 |
} |
187 | 186 |
public String getSRS() { |
... | ... | |
190 | 189 |
public void setSRS(String srs) throws IsNotAttributeSettingException { |
191 | 190 |
if (!editing && !loading) |
192 | 191 |
throw new IsNotAttributeSettingException("setSRS"); |
193 |
if (editing) |
|
194 |
originalValues.put("srs",this.srs); |
|
192 |
// if (editing)
|
|
193 |
// originalValues.put("srs",this.srs);
|
|
195 | 194 |
this.srs=srs; |
196 | 195 |
} |
197 | 196 |
public int getGeometryType() { |
... | ... | |
200 | 199 |
public void setGeometryType(int type) throws IsNotAttributeSettingException{ |
201 | 200 |
if (!editing && !loading) |
202 | 201 |
throw new IsNotAttributeSettingException("setGeometryType"); |
203 |
if (editing) |
|
204 |
originalValues.put("geometryType",new Integer(this.geometryType)); |
|
202 |
// if (editing)
|
|
203 |
// originalValues.put("geometryType",new Integer(this.geometryType));
|
|
205 | 204 |
this.geometryType=type; |
206 | 205 |
} |
207 | 206 |
public Object getDefaultValue() { |
... | ... | |
281 | 280 |
} |
282 | 281 |
public void editing() { |
283 | 282 |
editing=true; |
284 |
|
|
283 |
oldAttributeDescriptor=this.cloneAttribute(); |
|
285 | 284 |
} |
286 | 285 |
public void cancelEditing() { |
287 | 286 |
editing=false; |
288 |
originalValues.clear();
|
|
287 |
oldAttributeDescriptor=null;
|
|
289 | 288 |
} |
290 |
public HashMap getOriginalValues() {
|
|
291 |
return (HashMap)originalValues.clone();
|
|
289 |
public IFeatureAttributeDescriptor getOldAttributeDescriptor() {
|
|
290 |
return oldAttributeDescriptor;
|
|
292 | 291 |
} |
293 |
|
|
294 |
|
|
295 | 292 |
} |
Also available in: Unified diff