Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DurationCurveFacet.java @ 4198:1cdbd8a0c994
Added two new tables ClickableQDTable and ClickableWTable and made Ws and Qs clickable in historical discharge calculation.
The new tables define listener interfaces (clicked lower or upper icon) to listen to user clicks.
In addition to this, there is an enum ClickMode with NONE, SINGLE and RANGE options, which allows to
specifiy, which icons are displayed in the tables. NONE means no icon for user clicks, SINGLE has 1
icon, RANGE 2 icons for lower and upper.
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 22 Oct 2012 13:31:25 +0200 |
parents | 5642a83420f2 |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import java.util.List; import java.util.ArrayList; import org.apache.log4j.Logger; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.artifactdatabase.state.DefaultFacet; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; /** * Data of a duration curve. */ public class DurationCurveFacet extends DefaultFacet { private static Logger logger = Logger.getLogger(DurationCurveFacet.class); /** Blackboard data provider key for durationcurve (wqday) data. */ public static String BB_DURATIONCURVE = "durationcurve"; /** Blackboard data provider key for km of durationcurve. */ public static String BB_DURATIONCURVE_KM = "durationcurve.km"; public DurationCurveFacet() { } public DurationCurveFacet(String name, String description) { super(0, name, description); } /** * Expose state computation from WINFOArtifact. */ public Object getData(Artifact artifact, CallContext context) { logger.debug("Get data for duration curve data"); WINFOArtifact winfo = (WINFOArtifact)artifact; CalculationResult cr = (CalculationResult)winfo.compute( context, ComputeType.ADVANCE, false); return cr.getData(); } @Override public List getStaticDataProviderKeys(Artifact art) { List list = new ArrayList(); list.add(BB_DURATIONCURVE); list.add(BB_DURATIONCURVE_KM); return list; } /** * Can provide whatever getData returns and additionally the location. * @param key will respond on BB_DURATIONCURVE +KM * @param param ignored * @param context ignored * @return whatever getData delivers or location. */ @Override public Object provideBlackboardData(Artifact artifact, Object key, Object param, CallContext context ) { if (key.equals(BB_DURATIONCURVE)) { return getData(artifact, context); } else if (key.equals(BB_DURATIONCURVE_KM)) { return ((FLYSArtifact)artifact).getDataAsString("ld_locations"); } else { return null; } } /** Create a deep copy. */ @Override public Facet deepCopy() { DurationCurveFacet copy = new DurationCurveFacet(); copy.set(this); return copy; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :