Mercurial > dive4elements > river
changeset 873:77a549772aa9
Query MapInfo object for correct river (was hard coded).
flys-client/trunk@2694 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 12 Sep 2011 05:40:58 +0000 |
parents | a7179e3a774e |
children | d900ab031dfe |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java |
diffstat | 3 files changed, 30 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Mon Sep 12 04:55:55 2011 +0000 +++ b/flys-client/ChangeLog Mon Sep 12 05:40:58 2011 +0000 @@ -1,3 +1,13 @@ +2011-09-12 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java: + Implemented a method getDataValue(String state, String name) that searches + for a specific state and data name and returns the string value if such + a data object exists. + + * src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java: + Find out the rivername on the fly (was hard coded before). + 2011-09-12 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/shared/model/DataList.java: Made
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java Mon Sep 12 04:55:55 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java Mon Sep 12 05:40:58 2011 +0000 @@ -24,6 +24,7 @@ import de.intevation.flys.client.shared.model.DataItem; import de.intevation.flys.client.shared.model.DataList; import de.intevation.flys.client.shared.model.Artifact; +import de.intevation.flys.client.shared.model.ArtifactDescription; /** * An abstract UIProvider that provides some basic methods. @@ -210,6 +211,23 @@ return null; } + + protected String getDataValue(String state, String name) { + ArtifactDescription desc = artifact.getArtifactDescription(); + + DataList[] old = desc.getOldData(); + + for (DataList list: old) { + Data d = getData(list.getAll(), name); + + if (d != null) { + return d.getItems()[0].getStringValue(); + } + } + + return null; + } + /** * This method greps the DataItem with name <i>name</i> from the list and * returns it.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Sep 12 04:55:55 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Sep 12 05:40:58 2011 +0000 @@ -78,8 +78,8 @@ } } - // TODO FIND CORRECT RIVER - mapInfo.getMapInfo(url, locale, "Saar", new AsyncCallback<MapInfo>() { + String river = getDataValue("state.winfo.river", "river"); + mapInfo.getMapInfo(url, locale, river, new AsyncCallback<MapInfo>() { public void onFailure(Throwable caught) { String msg = caught.getMessage();