Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeState.java @ 2199:7bac5afb9892
Skip 'inactive' points in output generation.
flys-artifacts/trunk@3815 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 30 Jan 2012 08:37:01 +0000 |
parents | f28844a57fed |
children | 66408cdca36f |
line wrap: on
line source
package de.intevation.flys.artifacts.states; import org.apache.log4j.Logger; import org.w3c.dom.Element; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactNamespaceContext; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; import de.intevation.flys.artifacts.resources.Resources; /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class HistoricalDischargeState extends DefaultState { private static final Logger logger = Logger.getLogger(HistoricalDischargeState.class); public static final String DATA_MODE = "historical_mode"; public static final String DATA_VALUES = "historical_values"; public static final int DATA_MODE_W = 0; public static final int DATA_MODE_Q = 1; @Override protected String getUIProvider() { return "wq_simple_array"; } protected void appendItems( Artifact artifact, ElementCreator creator, String name, CallContext context, Element select ) { if (name != null && name.equals(DATA_VALUES)) { select.setAttributeNS( ArtifactNamespaceContext.NAMESPACE_URI, "art:type", "intarray"); } else if (name != null && name.equals(DATA_MODE)) { select.setAttributeNS( ArtifactNamespaceContext.NAMESPACE_URI, "art:type", "intoptions"); } super.appendItems(artifact, creator, name, context, select); } @Override protected Element[] createItems( ElementCreator creator, Artifact artifact, String name, CallContext context ) { logger.debug("createItems()"); if (name != null && name.equals(DATA_MODE)) { return createModeItem(creator, artifact, name, context); } else if (name != null && name.equals(DATA_VALUES)) { return createValuesItem(creator, artifact, name, context); } logger.warn("Tried to create item for invalid data: " + name); return new Element[0]; } protected Element[] createModeItem( ElementCreator creator, Artifact artifact, String name, CallContext context ) { logger.debug("createModeItem()"); CallMeta meta = context.getMeta(); Element modeW = createItem( creator, new String[] { Resources.getMsg(meta, "historical.mode.w","historical.mode.w"), String.valueOf(DATA_MODE_W) } ); Element modeQ = createItem( creator, new String[] { Resources.getMsg(meta, "historical.mode.q","historical.mode.q"), String.valueOf(DATA_MODE_Q) } ); return new Element[] { modeW, modeQ }; } protected Element[] createValuesItem( ElementCreator creator, Artifact artifact, String name, CallContext context ) { logger.debug("createValuesItem()"); Element valuesW = createItem( creator, new String[] { "ws", "" } ); Element valuesQ = createItem( creator, new String[] { "qs", "" } ); return new Element[] { valuesW, valuesQ }; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :