Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticState.java @ 4187:21f4e4b79121
Refactor GaugeDischargeCurveFacet to be able to set a facet name
For adding another output of the GaugeDischargeCurveArtifact it is necessary to
provide to facet instances with different names. Therefore the
GaugeDischargeCurveFacet is extended to set the facet name in the constructor.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 19 Oct 2012 13:25:49 +0200 |
parents | 470a61d644cd |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.states; import java.util.List; import org.apache.log4j.Logger; import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.artifactdatabase.state.Facet; import de.intevation.artifactdatabase.state.DefaultOutput; import de.intevation.artifactdatabase.state.Output; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; /** * Yet, a non-abstract DefaultState. */ public class StaticState extends DefaultState implements FacetTypes { /** The logger that is used in this state. */ private static final Logger logger = Logger.getLogger(StaticState.class); private static String uiprovider; public StaticState() { super(); } /** * Trivial constructor, sets id and description. * @param id String used for both id and description. */ public StaticState(String id) { this(id, id); } public StaticState(String id, String description) { super(); setID(id); setDescription(description); } public void addDefaultChartOutput(String nameDesc, List<Facet> facets) { DefaultOutput output = new DefaultOutput(nameDesc, nameDesc, "image/png", facets, "chart"); getOutputs().add(output); } public static void addDefaultChartOutput( DefaultState state, String nameDesc, List<Facet> facets ) { DefaultOutput output = new DefaultOutput(nameDesc, nameDesc, "image/png", facets, "chart"); state.getOutputs().add(output); } /** * Do nothing (override to include your logic). * @param facets List of facets (to add to). */ public Object staticCompute(List<Facet> facets, FLYSArtifact artifact) { return staticCompute(facets); } public Object staticCompute(List<Facet> facets) { return null; } /** Call staticCompute to allow easy adjustments. */ @Override public Object computeAdvance( FLYSArtifact artifact, String hash, CallContext context, List<Facet> facets, Object old ) { return staticCompute(facets, artifact); } /** Call staticCompute to allow easy adjustments. */ @Override public Object computeFeed( FLYSArtifact artifact, String hash, CallContext context, List<Facet> facets, Object old ) { return staticCompute(facets, artifact); } /** Call staticCompute to allow easy adjustments. */ @Override public Object computeInit( FLYSArtifact artifact, String hash, Object context, CallMeta meta, List<Facet> facets ) { return staticCompute(facets, artifact); } public void addOutput(Output out) { super.addOutput(out); } @Override protected String getUIProvider() { return this.uiprovider; } /** * Allow to set the uiprovider for displaying the static data */ public void setUIProvider(String uiprovider) { this.uiprovider = uiprovider; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :