# HG changeset patch # User Raimund Renkert # Date 1337592452 0 # Node ID d1d35892bbddc8dca9309fa8fb90410825e2ec2c # Parent 9ea3ac23bd9d06415294c908758c9a751a2a2094 Adjusted fixings transitions and implemented event select state. flys-artifacts/trunk@4450 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 9ea3ac23bd9d -r d1d35892bbdd flys-artifacts/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/artifacts/states/DurationCurveState.java: diff -r 9ea3ac23bd9d -r d1d35892bbdd flys-artifacts/doc/conf/artifacts/fixanalysis.xml --- 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 @@ - + diff -r 9ea3ac23bd9d -r d1d35892bbdd flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/EventSelect.java --- 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 Raimund Renkert @@ -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 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 :