Mercurial > dive4elements > river
changeset 1349:46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
flys-client/trunk@3020 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 18 Oct 2011 15:43:33 +0000 |
parents | fb224f54c643 |
children | 064fb5d181ea |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePairWidget.java flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java flys-client/src/main/java/de/intevation/flys/client/shared/model/Recommendation.java |
diffstat | 5 files changed, 114 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Tue Oct 18 15:20:24 2011 +0000 +++ b/flys-client/ChangeLog Tue Oct 18 15:43:33 2011 +0000 @@ -1,3 +1,25 @@ +2011-10-18 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Make "zus" and flood protections usable for W-Differences (with yet + many constraints, e.g. server will fail if flood protection is + subtrahend). + + * src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java: + Discern static and calculated data by pretty ugly hack, set factory + to "clone" with accordingly. + + * src/main/java/de/intevation/flys/client/client/ui/DatacagePairWidget.java: + Request the system ("static") part of datacage in wdiff-input + selection as well. + + * src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java: + Enable hack in DatacageTwinPanel, set ids to id content, such that + recommendations and toloads can be created from selected elements in + Datacage. + + * src/main/java/de/intevation/flys/client/shared/model/Recommendation.java: + (setFactory): Allow to change factory during live time. + 2011-10-18 Raimund Renkert <raimund.renkert@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePairWidget.java Tue Oct 18 15:20:24 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePairWidget.java Tue Oct 18 15:43:33 2011 +0000 @@ -53,8 +53,18 @@ this.grid = grid; HLayout hLayout = new HLayout(); - firstDatacageWidget = new DatacageWidget(artifact, user, outs, false); - secondDatacageWidget = new DatacageWidget(artifact, user, outs, false); + firstDatacageWidget = new DatacageWidget( + artifact, + user, + outs, + "load-system:true", + false); + secondDatacageWidget = new DatacageWidget( + artifact, + user, + outs, + "load-system:true", + false); firstDatacageWidget.setIsMutliSelectable(false); secondDatacageWidget.setIsMutliSelectable(false);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java Tue Oct 18 15:20:24 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java Tue Oct 18 15:43:33 2011 +0000 @@ -74,6 +74,7 @@ RemoveArtifactServiceAsync removeArtifactService = GWT.create( de.intevation.flys.client.client.services.RemoveArtifactService.class); + public DatacageTwinPanel(User user) { super(); this.user = user; @@ -221,6 +222,7 @@ differencesList.setCanEdit(false); differencesList.setCanSort(false); + differencesList.setShowHeaderContextMenu(false); differencesList.setHeight(150); differencesList.setShowAllRecords(true); @@ -231,6 +233,8 @@ final ListGridField removeField = new ListGridField("_removeRecord", "Remove Record"){{ setType(ListGridFieldType.ICON); + // TODO evaluate which icon to use (and how). + //setIcon("images/removeFeature.png"); setIcon("[SKIN]/actions/remove.png"); setCanEdit(false); setCanFilter(false); @@ -283,11 +287,14 @@ } Config config = Config.getInstance(); + String url = config.getServerUrl(); + String locale = config.getLocale(); + ListGridRecord[] records = differencesList.getRecords(); List<Recommendation> ar = new ArrayList<Recommendation>(); List<Recommendation> all = new ArrayList<Recommendation>(); - List<Recommendation> statics = new ArrayList<Recommendation>(); + for (ListGridRecord record : records) { RecommendationPairRecord r = (RecommendationPairRecord) record; @@ -295,13 +302,36 @@ if (!r.isAlreadyLoaded()) { // Check whether one of those is a dike or similar. // TODO differentiate and merge: new clones, new, old. - if(r.getFirst().getIDs() != null - && r.getFirst().getIDs().startsWith("flood_protection")) + Recommendation firstR = r.getFirst(); + if(firstR.getIDs() != null) { + GWT.log("First IDs: " + firstR.getIDs()); + } + // TODO resolve this hack, fix datacage/recommendation for this case. + if(firstR.getIDs() != null && + firstR.getIDs().startsWith("flood_protection")) { // These do not get cloned but loaded ("spawned"). + firstR.setFactory("staticwkms"); } - ar.add(r.getFirst()); - ar.add(r.getSecond()); + else { + firstR.setFactory("waterlevel"); + } + Recommendation secondR = r.getSecond(); + if(secondR.getIDs() != null) { + GWT.log("Second IDs: " + secondR.getIDs()); + } + if(secondR.getIDs() != null + && secondR.getIDs().startsWith("flood_protection")) + { + // These do not get cloned but loaded ("spawned"). + secondR.setFactory("staticwkms"); + } + else { + secondR.setFactory("waterlevel"); + } + + ar.add(firstR); + ar.add(secondR); } else { all.add(r.getFirst()); @@ -343,8 +373,8 @@ for(final String uuid: artifactIdsToRemove) { removeArtifactService.remove(this.collection, uuid, - config.getServerUrl(), - config.getLocale(), + url, + locale, new AsyncCallback<Collection>() { public void onFailure(Throwable caught) { GWT.log("RemoveArtifact (" + uuid + ") failed."); @@ -355,25 +385,26 @@ }); } - // Clone new ones, go forward. + // Clone new ones (and spawn statics), go forward. loadArtifactService.loadMany( - this.collection, - toClone, - "waterlevel", - config.getServerUrl(), - config.getLocale(), - new AsyncCallback<Artifact[]>() { + this.collection, + toClone, + //"staticwkms", + null, + url, + locale, + new AsyncCallback<Artifact[]>() { public void onFailure(Throwable caught) { - GWT.log("Failure of cloning with waterlevelfactory!"); + GWT.log("Failure of cloning with factories!"); } public void onSuccess(Artifact[] artifacts) { GWT.log("Successfully cloned " + toClone.length + - " with watelevelfactory."); + " with factories."); fireStepForwardEvent(new StepForwardEvent( getData(toClone, artifacts, toUse))); } - } ); + }); } @@ -426,19 +457,26 @@ protected String createDataString(String artifact, Filter filter) { Facet f = null; - Map<String, List<Facet>> outs = filter.getOuts(); - Set<Map.Entry<String, List<Facet>>> entries = outs.entrySet(); + if(filter != null) { + Map<String, List<Facet>> outs = filter.getOuts(); + Set<Map.Entry<String, List<Facet>>> entries = outs.entrySet(); - for (Map.Entry<String, List<Facet>> entry: entries) { - List<Facet> fs = entry.getValue(); + for (Map.Entry<String, List<Facet>> entry: entries) { + List<Facet> fs = entry.getValue(); - f = fs.get(0); - if (f != null) { - break; + f = fs.get(0); + if (f != null) { + break; + } } + + return "[" + artifact + ";" + f.getName() + ";" + f.getIndex() + "]"; + } + else { + return "[" + artifact + ";staticwkms;0]"; } - return "[" + artifact + ";" + f.getName() + ";" + f.getIndex() + "]"; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Tue Oct 18 15:20:24 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Tue Oct 18 15:43:33 2011 +0000 @@ -312,6 +312,11 @@ } + /** + * Adds to toLoad, from info in node. + * Afterwards, add all children of node to stack to parse (next time + * collectToLoads is called). + */ protected void collectToLoads(TreeNode node) { Stack<TreeNode> stack = new Stack<TreeNode>(); @@ -325,6 +330,14 @@ String out = node.getAttribute("out"); String name = node.getAttribute("facet"); String ids = node.getAttribute("ids"); + String debugAttributeValues = ""; + for (String attr: node.getAttributes()) { + debugAttributeValues += ("[" + attr +": " + + node.getAttributeAsString(attr) + "] "); + } + GWT.log("DatacageWidget.collectToLoad, attributes are " + + debugAttributeValues); + if(ids == null) ids = node.getAttribute("id"); toLoad.add(artifact, factory, out, name, ids); }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/Recommendation.java Tue Oct 18 15:20:24 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/Recommendation.java Tue Oct 18 15:43:33 2011 +0000 @@ -125,6 +125,10 @@ return factory; } + public void setFactory(String factory) { + this.factory = factory; + } + public String getIDs() { return ids; }