Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/BedHeightsArtifact.java @ 4641:f3325079dacc
Improve the up and down arrows in the theme navigation panel
Don't stretch the arrow icons and fit to their actual size. Also put the up
buttons on the left and the down buttons on the right.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Tue, 04 Dec 2012 16:16:43 +0100 |
parents | b838d16c629e |
children | cd44d28d0fbc |
line wrap: on
line source
package de.intevation.flys.artifacts; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import org.w3c.dom.Document; import de.intevation.artifactdatabase.state.DefaultOutput; import de.intevation.artifactdatabase.state.Facet; import de.intevation.artifactdatabase.state.FacetActivity; import de.intevation.artifacts.ArtifactFactory; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallMeta; import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.flys.artifacts.model.minfo.BedHeight; import de.intevation.flys.artifacts.model.minfo.BedHeightFacet; import de.intevation.flys.artifacts.model.minfo.BedHeightFactory; import de.intevation.flys.artifacts.states.StaticState; import de.intevation.flys.model.BedHeightSingle; import de.intevation.flys.model.BedHeightSingleValue; public class BedHeightsArtifact extends AbstractStaticStateArtifact { /** The logger for this class. */ private static Logger logger = Logger.getLogger(BedHeightsArtifact.class); private static final String NAME = "bedheights"; private static final String STATIC_FACET_NAME = "bedheight"; static { // TODO: Move to configuration. FacetActivity.Registry.getInstance() .register(NAME, FacetActivity.INACTIVE); } public static final String STATIC_STATE_NAME = "state.additional_bedheights.static"; /** Data Item name to know whether we are Heighmarks and reveive * some data slightly different. */ public static final String DATA_HEIGHT_TYPE = "height_marks"; /** * Trivial Constructor. */ public BedHeightsArtifact() { logger.debug("BedHeightsArtifact.BedHeightsArtifact"); } @Override public String getName() { return NAME; } /** * Gets called from factory, to set things up. */ @Override public void setup( String identifier, ArtifactFactory factory, Object context, CallMeta callMeta, Document data) { logger.debug("BedHeightsArtifact.setup"); if (logger.isDebugEnabled()) { logger.debug(XMLUtils.toString(data)); } String code = getDatacageIDValue(data); if (code != null) { String [] parts = code.split("-"); if (parts.length >= 4) { String name = parts[0]; String type = parts[1]; String btype = type; int hId = Integer.parseInt(parts[2]); if (name.equals("bedheight")) { addStringData("type", type); addStringData("height_id", parts[2]); addStringData("time", parts[3]); } if (type.equals("singlevalues")) { btype = "single"; } String bedHName = BedHeightFactory.getHeightName(btype, hId); Facet facet = new BedHeightFacet( STATIC_FACET_NAME, bedHName, type); ArrayList<Facet> facets = new ArrayList<Facet>(1); facets.add(facet); addFacets(STATIC_STATE_NAME, facets); } } super.setup(identifier, factory, context, callMeta, data); } /** */ public BedHeight getHeight() { return BedHeightFactory.getHeight( getDataAsString("type"), Integer.parseInt(getDataAsString("height_id")), Integer.parseInt(getDataAsString("time"))); } public List<BedHeightSingleValue> getSingleValues() { logger.debug("getSingleValues"); BedHeightSingle single = BedHeightSingle.getBedHeightSingleById( getDataAsInteger("height_id")); return BedHeightSingleValue.getBedHeightSingleValues(single, getDataAsDouble("ld_from"), getDataAsDouble("ld_to")); } @Override protected void initStaticState() { logger.debug("initStaticState " + getName() + " " + identifier()); StaticState state = new StaticState(STATIC_STATE_NAME); DefaultOutput output = new DefaultOutput( "general", "general", "image/png", "chart"); List<Facet> facets = getFacets(STATIC_STATE_NAME); output.addFacets(facets); state.addOutput(output); setStaticState(state); } @Override protected void initialize(Artifact artifact, Object context, CallMeta meta) { // do not clone facets, etc. from master artifact logger.debug("initialize"); importData((FLYSArtifact)artifact, "ld_from"); importData((FLYSArtifact)artifact, "ld_to"); logger.debug("ld_from " + getDataAsString("ld_from")); logger.debug("ld_to " + getDataAsString("ld_to")); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :