Revision 306 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.spi/src/main/java/org/gvsig/tools/swing/spi/AbstractDynObjectComponent.java
AbstractDynObjectComponent.java | ||
---|---|---|
75 | 75 |
* |
76 | 76 |
* @param dynObject |
77 | 77 |
* the {@link DynObject} to render |
78 |
* @param writable |
|
78 | 79 |
*/ |
79 | 80 |
public AbstractDynObjectComponent(DynObject dynObject, DynObjectModel model) { |
80 | 81 |
this.dynObject = dynObject; |
... | ... | |
87 | 88 |
// TODO Auto-generated catch block |
88 | 89 |
e.printStackTrace(); |
89 | 90 |
} |
90 |
} else {
|
|
91 |
} else {
|
|
91 | 92 |
this.model = model; |
92 |
}
|
|
93 |
}
|
|
93 | 94 |
manager = ToolsSwingLocator.getDynObjectSwingManager(); |
94 | 95 |
} |
95 | 96 |
|
... | ... | |
106 | 107 |
this.getComponents().put(component, input); |
107 | 108 |
} |
108 | 109 |
|
109 |
/* |
|
110 |
* (non-Javadoc) |
|
111 |
* |
|
112 |
* @seeorg.gvsig.tools.swing.api.dynobject.JDynObjectComponent# |
|
113 |
* addValueChangedListener |
|
114 |
* (org.gvsig.tools.swing.api.dynobject.ValueChangedListener) |
|
115 |
*/ |
|
116 |
public void addValueChangedListener(ValueChangedListener listener) { |
|
117 |
Iterator<JDynFieldComponent> componentFields = |
|
118 |
this.getComponents().values().iterator(); |
|
119 |
JDynFieldComponent comp; |
|
120 |
while (componentFields.hasNext()) { |
|
121 |
comp = componentFields.next(); |
|
122 |
comp.addValueChangedListener(listener); |
|
123 |
} |
|
124 |
} |
|
125 |
|
|
126 | 110 |
/** |
127 |
* |
|
128 |
* Sets all FieldValues of this {@link JDynObjectComponent} to null. |
|
129 |
* |
|
130 |
*/ |
|
131 |
protected void emptyAll() { |
|
132 |
Map<Component, JDynFieldComponent> items = this.getComponents(); |
|
133 |
for (JDynFieldComponent item : items.values()) { |
|
134 |
item.setValue(null); |
|
135 |
} |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* Sets all FieldValues of this {@link JDynObjectComponent} to its the |
|
140 |
* current values |
|
141 |
* of the same FieldValues at the {@link DynObject} given as input. |
|
142 |
* |
|
143 |
* @param value |
|
144 |
*/ |
|
145 |
protected void fillValues(DynObject dynObject) { |
|
146 |
Map<Component, JDynFieldComponent> items = this.getComponents(); |
|
147 |
for (JDynFieldComponent item : items.values()) { |
|
148 |
item.setValue(dynObject.getDynValue(item.getDynField().getName())); |
|
149 |
} |
|
150 |
} |
|
151 |
|
|
152 |
/** |
|
153 | 111 |
* Gets the map of all graphic JDynFieldComponents of this |
154 | 112 |
* JDynObjectComponent. |
155 | 113 |
* |
... | ... | |
184 | 142 |
return dynObject; |
185 | 143 |
} |
186 | 144 |
|
187 |
// |
|
188 |
// public Object getValue() { |
|
189 |
// return this.getDynObject(); |
|
190 |
// } |
|
191 |
|
|
192 | 145 |
/** |
193 | 146 |
* |
194 | 147 |
* Returns a {@link JDynFieldComponent} that best matches with the given |
... | ... | |
246 | 199 |
} |
247 | 200 |
|
248 | 201 |
/** |
202 |
* |
|
203 |
* Sets all FieldValues of this {@link JDynObjectComponent} to null. |
|
204 |
* |
|
205 |
*/ |
|
206 |
protected void emptyAll() { |
|
207 |
Map<Component, JDynFieldComponent> items = this.getComponents(); |
|
208 |
for (JDynFieldComponent item : items.values()) |
|
209 |
item.setValue(null); |
|
210 |
} |
|
211 |
|
|
212 |
/** |
|
213 |
* Sets all FieldValues of this {@link JDynObjectComponent} to its the |
|
214 |
* current values |
|
215 |
* of the same FieldValues at the {@link DynObject} given as input. |
|
216 |
* |
|
217 |
* @param value |
|
218 |
*/ |
|
219 |
protected void fillValues(DynObject dynObject) { |
|
220 |
Map<Component, JDynFieldComponent> items = this.getComponents(); |
|
221 |
for (JDynFieldComponent item : items.values()) |
|
222 |
item.setValue(dynObject.getDynValue(item.getDynField().getName())); |
|
223 |
} |
|
224 |
|
|
225 |
/** |
|
249 | 226 |
* Walks through all JDynFieldComponents to save its current values into |
250 | 227 |
* their DynObject. |
251 | 228 |
*/ |
... | ... | |
259 | 236 |
} |
260 | 237 |
} |
261 | 238 |
|
239 |
public void addValueChangedListener(ValueChangedListener listener) { |
|
240 |
Iterator<JDynFieldComponent> componentFields = |
|
241 |
this.getComponents().values().iterator(); |
|
242 |
JDynFieldComponent comp; |
|
243 |
while (componentFields.hasNext()) { |
|
244 |
comp = componentFields.next(); |
|
245 |
comp.addValueChangedListener(listener); |
|
246 |
} |
|
247 |
} |
|
248 |
|
|
262 | 249 |
} |
Also available in: Unified diff