Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/HYKFacet.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 | e1fd2dfdcb80 |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import de.intevation.artifactdatabase.state.Facet; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.DataProvider; import de.intevation.flys.artifacts.HYKArtifact; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; import de.intevation.flys.model.FastCrossSectionLine; import java.util.List; import org.apache.log4j.Logger; /** * Trival Facet for HYKs */ public class HYKFacet extends DataFacet implements FacetTypes { /** House logger. */ private static Logger logger = Logger.getLogger(HYKFacet.class); /** Trivial constructor, set (maybe localized) description. */ public HYKFacet(int idx, String description) { super(idx, HYK, description, ComputeType.FEED, null, null); } /** * Set km from cross section- master to HYKArtifact, then fire up * computation. * * @param art artifact to get data from. * @param context ignored */ @Override public Object getData(Artifact art, CallContext context) { logger.debug("HYKFacet.getData"); String dataKey = CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA; List<DataProvider> providers = context.getDataProvider(dataKey); if (providers.size() < 1) { logger.warn("Could not find Cross-Section data provider to get master cs km."); return null; } FastCrossSectionLine crossSection = (FastCrossSectionLine) providers.get(0) .provideData(dataKey, null, context); if(crossSection == null) { logger.debug("getData: crossSection is null"); return null; } double km = crossSection.getKm(); logger.debug("HYKFacet.getData: Master Cross Section is at km: " + km); // Set this km at hyk artifact to be evaluated. HYKArtifact hyk = (HYKArtifact) art; hyk.setKm(km); return hyk.compute(context, hash, stateId, type, false); } /** Do a deep copy. */ @Override public Facet deepCopy() { HYKFacet copy = new HYKFacet(this.index, this.description); copy.set(this); return copy; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :