ingo@927: package de.intevation.flys.artifacts.states;
ingo@927: 
ingo@927: import org.w3c.dom.Element;
ingo@927: 
ingo@927: import de.intevation.artifacts.Artifact;
ingo@927: import de.intevation.artifacts.CallContext;
ingo@927: import de.intevation.artifacts.CallMeta;
ingo@927: 
ingo@927: import de.intevation.artifacts.common.utils.XMLUtils;
ingo@927: 
ingo@927: import de.intevation.artifactdatabase.ProtocolUtils;
ingo@927: 
ingo@927: import de.intevation.flys.artifacts.resources.Resources;
ingo@927: 
ingo@927: 
ingo@927: /**
ingo@927:  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
ingo@927:  */
ingo@927: public class FloodplainChoice extends DefaultState {
ingo@927: 
ingo@927:     public static final String OPTION = "floodplain.option";
ingo@927: 
ingo@927: 
ingo@927:     @Override
ingo@927:     protected String getUIProvider() {
ingo@927:         return "boolean_panel";
ingo@927:     }
ingo@927: 
ingo@927: 
ingo@927:     @Override
ingo@927:     protected Element[] createItems(
ingo@927:         XMLUtils.ElementCreator cr,
ingo@927:         Artifact    artifact,
ingo@927:         String      name,
ingo@927:         CallContext context)
ingo@927:     {
ingo@927:         CallMeta meta = context.getMeta();
ingo@927: 
ingo@927:         Element option = createItem(
ingo@927:             cr,
ingo@927:             new String[] { Resources.getMsg(meta, OPTION, OPTION), "true" });
ingo@927: 
ingo@927:         return new Element[] { option };
ingo@927:     }
ingo@927: 
ingo@927: 
ingo@927:     protected Element createItem(XMLUtils.ElementCreator cr, Object obj) {
ingo@927:         Element item  = ProtocolUtils.createArtNode(cr, "item", null, null);
ingo@927:         Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
ingo@927:         Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
ingo@927: 
ingo@927:         String[] arr = (String[]) obj;
ingo@927: 
ingo@927:         label.setTextContent(arr[0]);
ingo@927:         value.setTextContent(arr[1]);
ingo@927: 
ingo@927:         item.appendChild(label);
ingo@927:         item.appendChild(value);
ingo@927: 
ingo@927:         return item;
ingo@927:     }
ingo@927: }
ingo@927: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :