Revision 24064 branches/v2_0_0_prep/libraries/libTools/src/org/gvsig/tools/attributes/DefaultAttributes.java
DefaultAttributes.java | ||
---|---|---|
14 | 14 |
|
15 | 15 |
private Map params; |
16 | 16 |
private Map alias; |
17 |
private boolean allowAnonimousAttributes; |
|
17 | 18 |
|
18 | 19 |
public DefaultAttributes() { |
19 | 20 |
this.params = new HashMap(); |
20 | 21 |
this.alias = new HashMap(); |
22 |
this.allowAnonimousAttributes = false; |
|
21 | 23 |
} |
22 | 24 |
|
25 |
public DefaultAttributes(boolean allowAnonimousAttributes) { |
|
26 |
this.params = new HashMap(); |
|
27 |
this.alias = new HashMap(); |
|
28 |
this.allowAnonimousAttributes = allowAnonimousAttributes; |
|
29 |
} |
|
30 |
|
|
31 |
final protected void setAllowAnonimousAttributes( |
|
32 |
boolean allowAnonimousAttributes) { |
|
33 |
this.allowAnonimousAttributes = allowAnonimousAttributes; |
|
34 |
} |
|
35 |
|
|
36 |
public boolean allowAnonimousAttributes() { |
|
37 |
return this.allowAnonimousAttributes; |
|
38 |
} |
|
39 |
|
|
23 | 40 |
public AttributeDescriptor addAttribute(String name, int dataType, |
24 | 41 |
String description, Object defaultValue) { |
25 | 42 |
AttributeDescriptor attr = new DefaultAttributeDescriptor(name, |
... | ... | |
69 | 86 |
} |
70 | 87 |
|
71 | 88 |
public void loadState(PersistentState state) throws PersistenceException { |
89 |
state.set("Attributes.allowAnonimousAttributes", |
|
90 |
allowAnonimousAttributes); |
|
72 | 91 |
Iterator it = params.values().iterator(); |
73 | 92 |
while (it.hasNext()) { |
74 | 93 |
DefaultAttributeDescriptor p = ((DefaultAttributeDescriptor) it |
... | ... | |
81 | 100 |
Iterator it = state.getNames(); |
82 | 101 |
while (it.hasNext()) { |
83 | 102 |
String name = (String) it.next(); |
84 |
try { |
|
85 |
this.setAttribute(name, state.get(name)); |
|
86 |
} catch (PersistenceValueNotFoundException e) { |
|
87 |
// Ignore |
|
103 |
if (name.equals("Attributes.allowAnonimousAttributes")) { |
|
104 |
this.allowAnonimousAttributes = state.getBoolean(name); |
|
105 |
} else { |
|
106 |
try { |
|
107 |
this.setAttribute(name, state.get(name)); |
|
108 |
} catch (PersistenceValueNotFoundException e) { |
|
109 |
// Ignore |
|
110 |
} |
|
88 | 111 |
} |
89 | 112 |
} |
90 | 113 |
} |
Also available in: Unified diff