Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java Fri Jan 27 13:12:31 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java Fri Jan 27 13:18:37 2012 +0000 @@ -228,18 +228,8 @@ } } - Element choices = ProtocolUtils.createArtNode( - creator, "choices", null, null); - - select.appendChild(choices); + appendItems(artifact, creator, name, context, select); ui.appendChild(select); - - Element[] items = createItems(creator, artifact, name, context); - if (items != null) { - for (Element item: items) { - choices.appendChild(item); - } - } } return ui; @@ -247,6 +237,34 @@ /** + * @param artifact + * @param creator + * @param name + * @param context + * @param select + */ + protected void appendItems( + Artifact artifact, + ElementCreator creator, + String name, + CallContext context, + Element select + ) { + Element choices = ProtocolUtils.createArtNode( + creator, "choices", null, null); + + select.appendChild(choices); + + Element[] items = createItems(creator, artifact, name, context); + if (items != null) { + for (Element item: items) { + choices.appendChild(item); + } + } + } + + + /** * This method creates the root node that contains the list of selectable * items. *