Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MultiIntArrayState.java @ 2697:8a6ce15ced7f
Fixed constructor in class 'Function'.
flys-artifacts/trunk@4407 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 15 May 2012 13:04:01 +0000 |
parents | 1bc35de0b786 |
children | 71f072d8b3d8 |
line wrap: on
line source
package de.intevation.flys.artifacts.states; import org.w3c.dom.Element; import org.apache.log4j.Logger; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; import de.intevation.artifacts.common.model.KVP; /** * State that holds minimun and maximum (for validation). * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public abstract class MultiIntArrayState extends DefaultState { private static final Logger logger = Logger.getLogger(MultiIntArrayState.class); @Override protected void appendItems( Artifact artifact, ElementCreator creator, String name, CallContext context, Element select ) { try { creator.addAttr(select, "type", "intoptions", true); Element choices = creator.create("choices"); for (KVP kvp: getOptions(artifact, name)) { Element item = creator.create("item"); creator.addAttr(item, "label", kvp.getValue().toString(), true); item.setTextContent(kvp.getKey().toString()); choices.appendChild(item); } select.appendChild(choices); } catch (IllegalArgumentException iae) { logger.warn("Illegal argument", iae); } } protected abstract KVP<Integer, String>[] getOptions( Artifact artifact, String parameterName ) throws IllegalArgumentException; }