Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java @ 2189:19518116a49a
Refactored some code in DefaultState to better override the base class.
flys-artifacts/trunk@3799 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 27 Jan 2012 13:18:37 +0000 |
parents | 61667c3a0003 |
children | a22e0cb6eace |
comparison
equal
deleted
inserted
replaced
2188:fd9aece97aa3 | 2189:19518116a49a |
---|---|
226 creator.addAttr(select, "defaultValue", defValue, true); | 226 creator.addAttr(select, "defaultValue", defValue, true); |
227 creator.addAttr(select, "defaultLabel", defDesc, true); | 227 creator.addAttr(select, "defaultLabel", defDesc, true); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 Element choices = ProtocolUtils.createArtNode( | 231 appendItems(artifact, creator, name, context, select); |
232 ui.appendChild(select); | |
233 } | |
234 | |
235 return ui; | |
236 } | |
237 | |
238 | |
239 /** | |
240 * @param artifact | |
241 * @param creator | |
242 * @param name | |
243 * @param context | |
244 * @param select | |
245 */ | |
246 protected void appendItems( | |
247 Artifact artifact, | |
248 ElementCreator creator, | |
249 String name, | |
250 CallContext context, | |
251 Element select | |
252 ) { | |
253 Element choices = ProtocolUtils.createArtNode( | |
232 creator, "choices", null, null); | 254 creator, "choices", null, null); |
233 | 255 |
234 select.appendChild(choices); | 256 select.appendChild(choices); |
235 ui.appendChild(select); | 257 |
236 | 258 Element[] items = createItems(creator, artifact, name, context); |
237 Element[] items = createItems(creator, artifact, name, context); | 259 if (items != null) { |
238 if (items != null) { | 260 for (Element item: items) { |
239 for (Element item: items) { | 261 choices.appendChild(item); |
240 choices.appendChild(item); | |
241 } | |
242 } | 262 } |
243 } | 263 } |
244 | |
245 return ui; | |
246 } | 264 } |
247 | 265 |
248 | 266 |
249 /** | 267 /** |
250 * This method creates the root node that contains the list of selectable | 268 * This method creates the root node that contains the list of selectable |