Mercurial > dive4elements > river
changeset 2719:d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
flys-artifacts/trunk@4450 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 21 May 2012 09:27:32 +0000 |
parents | 9ea3ac23bd9d |
children | a95f95e7bd4e |
files | flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/EventSelect.java |
diffstat | 3 files changed, 80 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Mon May 21 09:06:48 2012 +0000 +++ b/flys-artifacts/ChangeLog Mon May 21 09:27:32 2012 +0000 @@ -1,3 +1,12 @@ +2012-05-21 Raimund Renkert <raimund.renkert@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/states/fixation/EventSelect.java: + Implemented static data for state. + + * doc/conf/artifacts/fixanalysis.xml: + Changed transition in 'volmer' states. + + 2012-05-21 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/artifacts/states/DurationCurveState.java:
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml Mon May 21 09:06:48 2012 +0000 +++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml Mon May 21 09:27:32 2012 +0000 @@ -69,7 +69,7 @@ </transition> <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition"> - <from state="state.fix.gaugerange"/> + <from state="state.fix.eventselect"/> <to state="state.fix.volmer.function"/> <condition data="calculation.mode" value="calculation.volmer" operator="equal"/>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/EventSelect.java Mon May 21 09:06:48 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/EventSelect.java Mon May 21 09:27:32 2012 +0000 @@ -1,8 +1,24 @@ package de.intevation.flys.artifacts.states.fixation; +import java.util.List; + import org.apache.log4j.Logger; +import org.w3c.dom.Element; + +import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; + +import de.intevation.artifacts.CallContext; + import de.intevation.flys.artifacts.states.DefaultState; +import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.utils.FLYSUtils; + +import de.intevation.flys.artifacts.model.FixingsOverview; +import de.intevation.flys.artifacts.model.FixingsOverviewFactory; +import de.intevation.flys.artifacts.model.FixingsOverview.IdFilter; +import de.intevation.flys.artifacts.model.FixingsOverview.Fixing; + /** * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> @@ -23,5 +39,59 @@ protected String getUIProvider() { return "fix.event_panel"; } + + @Override + protected Element createStaticData( + FLYSArtifact flys, + ElementCreator creator, + CallContext cc, + String name, + String value, + String type + ) { + int[] array = FLYSUtils.intArrayFromString(value); + + Element dataElement = creator.create("data"); + creator.addAttr(dataElement, "name", name, true); + creator.addAttr(dataElement, "type", type, true); + + String river = FLYSUtils.getRiver(flys).getName(); + + FixingsOverview overview = FixingsOverviewFactory.getOverview(river); + + for (int i = 0; i < array.length; i++) { + Element itemElement = creator.create("item"); + creator.addAttr( + itemElement, + "value", + String.valueOf(array[i]), + true); + + creator.addAttr( + itemElement, + "label", + getLabel(cc, array[i], overview), + true); + dataElement.appendChild(itemElement); + } + return dataElement; + } + + + public static String getLabel( + CallContext cc, + int value, + FixingsOverview overview + ) { + logger.debug("Create label for value: " + value); + + IdFilter filter = new IdFilter(value); + List<Fixing.Column> columns = overview.filter(null, filter); + if (!columns.isEmpty()) { + return columns.get(0).getDescription(); + } + + return ""; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :