[PATCH 1 of 3] Fixed: strange tweak in w-diferences panel always returned staticwkms factory instead of the original one. In sinfo we need the original one though

Wald Commits scm-commit at wald.intevation.org
Thu Feb 8 18:48:33 CET 2018


# HG changeset patch
# User gernotbelger
# Date 1518111994 -3600
# Node ID 8d1df8639563da07dfd87d0d08e7765d4119abf2
# Parent  7ebe5d463740cab84c7b25a13eda955699d81844
Fixed: strange tweak in w-diferences panel always returned staticwkms factory instead of the original one. In sinfo we need the original one though.

diff -r 7ebe5d463740 -r 8d1df8639563 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractPairRecommendationPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractPairRecommendationPanel.java	Wed Feb 07 18:04:53 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractPairRecommendationPanel.java	Thu Feb 08 18:46:34 2018 +0100
@@ -8,19 +8,10 @@
 
 package org.dive4elements.river.client.client.ui;
 
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-import com.smartgwt.client.widgets.layout.VLayout;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.dive4elements.river.client.client.Config;
 import org.dive4elements.river.client.client.FLYSConstants;
@@ -39,10 +30,18 @@
 import org.dive4elements.river.client.shared.model.Recommendation.Filter;
 import org.dive4elements.river.client.shared.model.User;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
 
 // TODO Probably better to branch off AbstractUIProvider.
 // TODO Merge with other datacage-widget impls.
@@ -55,17 +54,19 @@
 
 	/**
 	 * Allows for abstraction on how to handle/serialize the recommendation and the used factories.
+	 * Basically this allows to tweak the factory that is delivered from the datacage to be replaced by a specific one...
+	 * 
 	 * @author Gernot Belger
-	 *
 	 */
 	public static interface IRecommendationInfo	{
 
-		String getFactory();
+		String getFactory(String originalFactory);
 
 		/**
 		 * Separate factory for the 'createDataString' method, because in the case of waterlevels. See HOTFIX/FIXME there.
+		 * @param recommendation 
 		 */
-		String getDataStringFactory();
+		String getDataStringFactory(Recommendation recommendation);
 
 	    /**
 	     * Set factory of recommendation such that the correct artifacts will
@@ -86,7 +87,7 @@
 
     private String dataName;
 
-    private User user;
+    private final User user;
 
     /** ListGrid that displays user-selected pairs to build differences with. */
     private ListGrid differencesList;
@@ -95,29 +96,29 @@
      * List to track previously selected but now removed pairs. (Needed to
      * be able to identify artifacts that can be removed from the collection.
      */
-    private List<RecommendationPairRecord> removedPairs =
+    private final List<RecommendationPairRecord> removedPairs =
         new ArrayList<RecommendationPairRecord>();
 
     /** Service handle to clone and add artifacts to collection. */
-    private LoadArtifactServiceAsync loadArtifactService = GWT.create(
+    private final LoadArtifactServiceAsync loadArtifactService = GWT.create(
             org.dive4elements.river.client.client.services.LoadArtifactService.class);
 
     /** Service to remove artifacts from collection. */
-    private RemoveArtifactServiceAsync removeArtifactService = GWT.create(
+    private final RemoveArtifactServiceAsync removeArtifactService = GWT.create(
             org.dive4elements.river.client.client.services.RemoveArtifactService.class);
 
-	private IRecommendationInfo leftInfo;
+	private final IRecommendationInfo leftInfo;
 
-	private IRecommendationInfo rightInfo;
+	private final IRecommendationInfo rightInfo;
 
-	private IValidator validator;
+	private final IValidator validator;
 
 	/**
 	 * @param Validates the content of this form when the user clicks 'apply'
 	 * @param leftInfo Delegate for handling the left part of the recommendation-pair
 	 * @param rightInfo Delegate for handling the right part of the recommendation-pair
 	 */
-    public AbstractPairRecommendationPanel(final User user, IValidator validator, final IRecommendationInfo leftInfo, final IRecommendationInfo rightInfo ) {
+    public AbstractPairRecommendationPanel(final User user, final IValidator validator, final IRecommendationInfo leftInfo, final IRecommendationInfo rightInfo ) {
         this.user = user;
 		this.validator = validator;
 		this.leftInfo = leftInfo;
@@ -137,12 +138,12 @@
      * @see StringUtil.unbracket
      */
     // FIXME: check if this is the same as STringUItils#unbracket
-    private static final String unbracket(String value) {
+    private static final String unbracket(final String value) {
         // null- guard.
         if (value == null) return value;
 
-        int start = value.indexOf("[");
-        int end   = value.indexOf("]");
+        final int start = value.indexOf("[");
+        final int end   = value.indexOf("]");
 
         if (start < 0 || end < 0) {
             return value;
@@ -159,17 +160,17 @@
      */
     private Recommendation createRecommendationFromString(final String from, final IRecommendationInfo info) {
         // TODO Construct "real" filter.
-        String[] parts = unbracket(from).split(";");
-        Recommendation.Filter filter = new Recommendation.Filter();
-        Recommendation.Facet  facet  = new Recommendation.Facet(
+        final String[] parts = unbracket(from).split(";");
+        final Recommendation.Filter filter = new Recommendation.Filter();
+        final Recommendation.Facet  facet  = new Recommendation.Facet(
                 parts[1],
                 parts[2]);
 
-        List<Recommendation.Facet> facets = new ArrayList<Recommendation.Facet>();
+        final List<Recommendation.Facet> facets = new ArrayList<Recommendation.Facet>();
         facets.add(facet);
         filter.add("longitudinal_section", facets);
         
-        final String factory = info.getFactory(  );
+        final String factory = info.getFactory( parts[1] );
 
         final  Recommendation r = new Recommendation(factory, parts[0], this.artifact.getUuid(), filter);
         r.setDisplayName(parts[3]);
@@ -180,18 +181,18 @@
     /**
      * Add RecomendationPairRecords from input String to the ListGrid.
      */
-    private void populateGridFromString(String from){
+    private void populateGridFromString(final String from){
         // Split this string.
         // Create according recommendations and display strings.
-        String[] recs = from.split("#");
+        final String[] recs = from.split("#");
         if (recs.length % 2 != 0) return;
         for (int i = 0; i < recs.length; i+=2) {
-            Recommendation minuend =
-                createRecommendationFromString(recs[i+0], leftInfo);
-            Recommendation subtrahend =
-                createRecommendationFromString(recs[i+1], rightInfo);
+            final Recommendation minuend =
+                createRecommendationFromString(recs[i+0], this.leftInfo);
+            final Recommendation subtrahend =
+                createRecommendationFromString(recs[i+1], this.rightInfo);
 
-            RecommendationPairRecord pr = new RecommendationPairRecord(
+            final RecommendationPairRecord pr = new RecommendationPairRecord(
                 minuend, subtrahend);
             // This Recommendation Pair comes from the data string and was thus
             // already cloned.
@@ -206,11 +207,11 @@
      * @return graphical representation and interaction widgets for data.
      */
     @Override
-    public final Canvas create(DataList dataList) {
+    public final Canvas create(final DataList dataList) {
     	
         final Canvas widget = createWidget();
     	
-    	final Canvas canvas = createChooserWidgets(widget, dataList, user, differencesList);
+    	final Canvas canvas = createChooserWidgets(widget, dataList, this.user, this.differencesList);
     	
         populateGrid(dataList);
         
@@ -222,8 +223,8 @@
      */
     protected abstract Canvas createChooserWidgets(final Canvas widget, final DataList dataList, final User auser, final ListGrid diffList);
 
-	private void populateGrid(DataList dataList) {
-        Data data     = dataList.get(0);
+	private void populateGrid(final DataList dataList) {
+        final Data data     = dataList.get(0);
         this.dataName = data.getLabel();
         for (int i = 0; i < dataList.size(); i++) {
             if (dataList.get(i) != null && dataList.get(i).getItems() != null) {
@@ -237,24 +238,24 @@
 
     @Override
     public final List<String> validate() {
-    	return validator.validate(differencesList, MSG_PROVIDER);
+    	return this.validator.validate(this.differencesList, MSG_PROVIDER);
     }
 
     /**
      * Creates layout with grid that displays selection inside.
      */
     protected final Canvas createWidget() {
-        VLayout layout  = new VLayout();
-        differencesList = new ListGrid();
+        final VLayout layout  = new VLayout();
+        this.differencesList = new ListGrid();
 
-        differencesList.setCanEdit(false);
-        differencesList.setCanSort(false);
-        differencesList.setShowHeaderContextMenu(false);
-        differencesList.setHeight(150);
-        differencesList.setShowAllRecords(true);
+        this.differencesList.setCanEdit(false);
+        this.differencesList.setCanSort(false);
+        this.differencesList.setShowHeaderContextMenu(false);
+        this.differencesList.setHeight(150);
+        this.differencesList.setShowAllRecords(true);
 
-        ListGridField nameField    = new ListGridField("first",  "Minuend");
-        ListGridField capitalField = new ListGridField("second", "Subtrahend");
+        final ListGridField nameField    = new ListGridField("first",  "Minuend");
+        final ListGridField capitalField = new ListGridField("second", "Subtrahend");
         // Track removed rows, therefore more or less reimplement
         // setCanRecomeRecords.
         final ListGridField removeField  =
@@ -269,10 +270,10 @@
                 setWidth(25);
         }};
 
-        differencesList.setFields(new ListGridField[] {nameField,
+        this.differencesList.setFields(new ListGridField[] {nameField,
            capitalField, removeField});
 
-        differencesList.addRecordClickHandler(new RecordClickHandler() {
+        this.differencesList.addRecordClickHandler(new RecordClickHandler() {
                 @Override
                 public void onRecordClick(final RecordClickEvent event) {
                     // Just handle remove-clicks
@@ -283,7 +284,7 @@
                     event.getViewer().removeData(event.getRecord());
                 }
             });
-        layout.addMember(differencesList);
+        layout.addMember(this.differencesList);
 
         return layout;
     }
@@ -292,8 +293,8 @@
     /**
      * Add record to list of removed records.
      */
-    protected final void trackRemoved(Record r) {
-        RecommendationPairRecord pr = (RecommendationPairRecord) r;
+    protected final void trackRemoved(final Record r) {
+        final RecommendationPairRecord pr = (RecommendationPairRecord) r;
         this.removedPairs.add(pr);
     }
 
@@ -302,35 +303,35 @@
      * waterlevels and add them to collection, forward the artifact.
      */
     @Override
-    public void onClick(ClickEvent e) {
+    public void onClick(final ClickEvent e) {
         GWT.log("AbstractPairRecommendationPanel.onClick");
 
-        List<String> errors = validate();
+        final List<String> errors = validate();
         if (errors != null && !errors.isEmpty()) {
             showErrors(errors);
             return;
         }
 
-        Config config = Config.getInstance();
-        String locale = config.getLocale();
+        final Config config = Config.getInstance();
+        final String locale = config.getLocale();
 
-        ListGridRecord[] records = differencesList.getRecords();
+        final ListGridRecord[] records = this.differencesList.getRecords();
 
-        List<Recommendation> ar  = new ArrayList<Recommendation>();
-        List<Recommendation> all = new ArrayList<Recommendation>();
+        final List<Recommendation> ar  = new ArrayList<Recommendation>();
+        final List<Recommendation> all = new ArrayList<Recommendation>();
 
-        for (ListGridRecord record : records) {
-            RecommendationPairRecord r =
+        for (final ListGridRecord record : records) {
+            final RecommendationPairRecord r =
                 (RecommendationPairRecord) record;
             // Do not add "old" recommendations.
             if (!r.isAlreadyLoaded()) {
                 // Check whether one of those is a dike or similar.
                 // TODO differentiate and merge: new clones, new, old.
-                Recommendation firstR = r.getFirst();
-                leftInfo.adjustRecommendation(firstR);
+                final Recommendation firstR = r.getFirst();
+                this.leftInfo.adjustRecommendation(firstR);
 
-                Recommendation secondR = r.getSecond();
-                rightInfo.adjustRecommendation(secondR);
+                final Recommendation secondR = r.getSecond();
+                this.rightInfo.adjustRecommendation(secondR);
                 ar.add(firstR);
                 ar.add(secondR);
             }
@@ -344,12 +345,12 @@
         final Recommendation[] toUse   = all.toArray(new Recommendation[all.size()]);
 
         // Find out whether "old" artifacts have to be removed.
-        List<String> artifactIdsToRemove = new ArrayList<String>();
-        for (RecommendationPairRecord rp: this.removedPairs) {
+        final List<String> artifactIdsToRemove = new ArrayList<String>();
+        for (final RecommendationPairRecord rp: this.removedPairs) {
             Recommendation first  = rp.getFirst();
             Recommendation second = rp.getSecond();
 
-            for (Recommendation recommendation: toUse) {
+            for (final Recommendation recommendation: toUse) {
                 if (first != null && first.getIDs().equals(recommendation.getIDs())) {
                     first = null;
                 }
@@ -372,24 +373,24 @@
         // Remove old artifacts, if any. Do this asychronously without much
         // feedback.
         for(final String uuid: artifactIdsToRemove) {
-            removeArtifactService.remove(this.collection,
+            this.removeArtifactService.remove(this.collection,
                 uuid,
                 locale,
                 new AsyncCallback<Collection>() {
                     @Override
-                    public void onFailure(Throwable caught) {
+                    public void onFailure(final Throwable caught) {
                         GWT.log("RemoveArtifact (" + uuid + ") failed.");
                     }
                     @Override
-                    public void onSuccess(Collection coll) {
+                    public void onSuccess(final Collection coll) {
                         GWT.log("RemoveArtifact succeeded");
                     }
                 });
         }
 
         // Clone new ones (and spawn statics), go forward.
-        parameterList.lockUI();
-        loadArtifactService.loadMany(
+        this.parameterList.lockUI();
+        this.loadArtifactService.loadMany(
             this.collection,
             toClone,
             //"staticwkms" and "waterlevel"
@@ -397,19 +398,19 @@
             locale,
             new AsyncCallback<Artifact[]>() {
                 @Override
-                public void onFailure(Throwable caught) {
+                public void onFailure(final Throwable caught) {
                 	caught.printStackTrace();
                     GWT.log("Failure of cloning with factories!");
-                    parameterList.unlockUI();
+                    AbstractPairRecommendationPanel.this.parameterList.unlockUI();
                 }
                 @Override
-                public void onSuccess(Artifact[] artifacts) {
+                public void onSuccess(final Artifact[] artifacts) {
                     GWT.log("Successfully cloned " + toClone.length +
                         " with factories.");
 
                     fireStepForwardEvent(new StepForwardEvent(
                         getData(toClone, artifacts, toUse)));
-                    parameterList.unlockUI();
+                    AbstractPairRecommendationPanel.this.parameterList.unlockUI();
                 }
             });
     }
@@ -427,45 +428,45 @@
      *         diff-pairs.
      */
     protected final Data[] getData(
-            Recommendation[] newRecommendations,
-            Artifact[] newArtifacts,
-            Recommendation[] oldRecommendations)
+            final Recommendation[] newRecommendations,
+            final Artifact[] newArtifacts,
+            final Recommendation[] oldRecommendations)
     {
         // Construct string with info about selections.
         String dataItemString = "";
         for (int i = 0; i < newRecommendations.length; i++) {
-            Recommendation r = newRecommendations[i];
-            Artifact newArtifact = newArtifacts[i];
-            String uuid = newArtifact.getUuid();
+            final Recommendation r = newRecommendations[i];
+            final Artifact newArtifact = newArtifacts[i];
+            final String uuid = newArtifact.getUuid();
             r.setMasterArtifact(uuid);
 
             if (i>0) 
             	dataItemString += "#";
 
             // REMARK: ugly, but we know that the recommandations comes in left/right pairs.
-            final IRecommendationInfo info = i % 2 == 0 ? leftInfo : rightInfo;
+            final IRecommendationInfo info = i % 2 == 0 ? this.leftInfo : this.rightInfo;
             
             dataItemString += createDataString(uuid, r, info);
         }
 
         for (int i = 0; i < oldRecommendations.length; i++) {
-            Recommendation r = oldRecommendations[i];
-            String uuid = r.getIDs();
+            final Recommendation r = oldRecommendations[i];
+            final String uuid = r.getIDs();
             
             if (dataItemString.length() > 0) 
             	dataItemString += "#";
 
             // REMARK: ugly, but we know that the recommandations comes in left/right pairs.
-            final IRecommendationInfo info = i % 2 == 0 ? leftInfo : rightInfo;
+            final IRecommendationInfo info = i % 2 == 0 ? this.leftInfo : this.rightInfo;
 
             dataItemString += createDataString(uuid, r, info);
         }
 
         // TODO some hassle could be resolved by using multiple DataItems
         // (e.g. one per pair).
-        DataItem item = new DefaultDataItem(dataName, dataName, dataItemString);
+        final DataItem item = new DefaultDataItem(this.dataName, this.dataName, dataItemString);
         return new Data[] { new DefaultData(
-            dataName, null, null, new DataItem[] {item}) };
+            this.dataName, null, null, new DataItem[] {item}) };
     }
 
     /**
@@ -474,17 +475,17 @@
      * @param info Provides the factory to encode.
      */
     protected static final String createDataString(final String artifactUuid, final Recommendation recommendation, final IRecommendationInfo info) {
-    	final String factory = info.getDataStringFactory();
+    	final String factory = info.getDataStringFactory( recommendation );
         
-    	Filter filter = recommendation.getFilter();
+    	final Filter filter = recommendation.getFilter();
 		Facet  f      = null;
 		
 		if(filter != null) {
-		    Map<String, List<Facet>>               outs = filter.getOuts();
-		    Set<Map.Entry<String, List<Facet>>> entries = outs.entrySet();
+		    final Map<String, List<Facet>>               outs = filter.getOuts();
+		    final Set<Map.Entry<String, List<Facet>>> entries = outs.entrySet();
 		
-		    for (Map.Entry<String, List<Facet>> entry: entries) {
-		        List<Facet> fs = entry.getValue();
+		    for (final Map.Entry<String, List<Facet>> entry: entries) {
+		        final List<Facet> fs = entry.getValue();
 		
 		        f = fs.get(0);
 		        if (f != null) {
diff -r 7ebe5d463740 -r 8d1df8639563 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DefaultDatacageTwinPanelInfo.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DefaultDatacageTwinPanelInfo.java	Wed Feb 07 18:04:53 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DefaultDatacageTwinPanelInfo.java	Thu Feb 08 18:46:34 2018 +0100
@@ -13,12 +13,15 @@
 import org.dive4elements.river.client.shared.model.Recommendation;
 
 /**
+ * This info implementation overwrites the real factory of the recommendation with a fixed value. 
+ * Evil, but this is how it is done in the current code.
+ * 
  * @author Gernot Belger
  */
 public final class DefaultDatacageTwinPanelInfo implements IDatacageTwinPanelInfo {
 
-	private String factory;
-	private String outs;
+	private final String factory;
+	private final String outs;
 
 	public DefaultDatacageTwinPanelInfo(final String factory, final String outs) {
 		this.factory = factory;
@@ -26,22 +29,22 @@
 	}
 	
 	@Override
-	public String getFactory() {
-		return factory;
+	public String getFactory(final String originalFactory) {
+		return this.factory;
 	}
 	
 	@Override
-	public String getDataStringFactory() {
-		return factory;
+	public String getDataStringFactory(final Recommendation recommendation) {
+		return this.factory;
 	}
 
     @Override
-	public void adjustRecommendation(Recommendation recommendation) {
-        recommendation.setFactory(factory);
+	public void adjustRecommendation(final Recommendation recommendation) {
+        recommendation.setFactory(this.factory);
     }
 
 	@Override
 	public String getOuts() {
-		return outs;
+		return this.outs;
 	}
 }
\ No newline at end of file
diff -r 7ebe5d463740 -r 8d1df8639563 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/NilDatacageTwinPanelInfo.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/NilDatacageTwinPanelInfo.java	Thu Feb 08 18:46:34 2018 +0100
@@ -0,0 +1,48 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by 
+ *  Björnsen Beratende Ingenieure GmbH 
+ *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+package org.dive4elements.river.client.client.ui;
+
+import org.dive4elements.river.client.client.ui.DatacageTwinPanel.IDatacageTwinPanelInfo;
+import org.dive4elements.river.client.shared.model.Recommendation;
+
+/**
+ * An info implementation that does NOT tweak any factories.
+ * 
+ * @author Gernot Belger
+ */
+public final class NilDatacageTwinPanelInfo implements IDatacageTwinPanelInfo {
+
+	private final String outs;
+
+	public NilDatacageTwinPanelInfo(final String outs) {
+		this.outs = outs;
+	}
+	
+	@Override
+	public String getFactory(final String originalFactory) {
+	    return originalFactory;
+	}
+
+	
+	@Override
+	public String getDataStringFactory(final Recommendation recommendation) {
+		return recommendation.getFactory();
+	}
+
+    @Override
+	public void adjustRecommendation(final Recommendation recommendation) {
+        /* does nothing */
+    }
+
+	@Override
+	public String getOuts() {
+		return this.outs;
+	}
+}
\ No newline at end of file
diff -r 7ebe5d463740 -r 8d1df8639563 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WaterlevelRecommendationInfo.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WaterlevelRecommendationInfo.java	Wed Feb 07 18:04:53 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WaterlevelRecommendationInfo.java	Thu Feb 08 18:46:34 2018 +0100
@@ -15,30 +15,36 @@
 import com.google.gwt.core.client.GWT;
 
 /**
+ * Factored out code from the old WaterlevelTwinPanel; contains some evil hacks about the involved artifact factories. See original comments below...
+ * 
  * @author Gernot Belger
  */
 public final class WaterlevelRecommendationInfo implements IDatacageTwinPanelInfo {
 
-	private String outs;
-
-	public WaterlevelRecommendationInfo(String outs ) {
+	private final String outs;
+	
+    /**
+     * @param tweakFactory See evil hack below
+     */
+	public WaterlevelRecommendationInfo(final String outs) {
 		this.outs = outs;
 	}
 	
 	@Override
-	public String getFactory() {
+	public String getFactory(final String originalFactory) {
 		// FIXME: why are the factory here and the one used in createDataString different?
 		// Probably also because of the 'throw all this code away comment'
 		return "waterlevel";
 	}
 	
 	@Override
-	public String getDataStringFactory() {
+	public String getDataStringFactory(final Recommendation recommendation) {
 		return "staticwkms";
 	}
 	
     @Override
-	public void adjustRecommendation(Recommendation recommendation) {
+	public void adjustRecommendation(final Recommendation recommendation) {
+        
         // XXX: THIS IS AN EVIL HACK TO MAKE W-DIFFERENCES WORK AGAIN!
         // TODO: Throw all this code away and do it with server side recommendations!
         recommendation.setTargetOut("w_differences");
@@ -64,6 +70,6 @@
 
 	@Override
 	public String getOuts() {
-		return outs;
+		return this.outs;
 	}
 }
\ No newline at end of file
diff -r 7ebe5d463740 -r 8d1df8639563 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/FlowDepthTwinPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/FlowDepthTwinPanel.java	Wed Feb 07 18:04:53 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/FlowDepthTwinPanel.java	Thu Feb 08 18:46:34 2018 +0100
@@ -11,7 +11,7 @@
 
 import org.dive4elements.river.client.client.ui.DatacageTwinPanel;
 import org.dive4elements.river.client.client.ui.DefaultDatacageTwinPanelInfo;
-import org.dive4elements.river.client.client.ui.WaterlevelRecommendationInfo;
+import org.dive4elements.river.client.client.ui.NilDatacageTwinPanelInfo;
 import org.dive4elements.river.client.shared.model.User;
 
 /**
@@ -20,6 +20,6 @@
 public class FlowDepthTwinPanel 
 extends DatacageTwinPanel {
 	public FlowDepthTwinPanel(final User user) {
-		super(user, new FlowDepthTwinPanelValidator(), new WaterlevelRecommendationInfo("sinfo_flowdepth_waterlevels"), new DefaultDatacageTwinPanelInfo("bedheight", "sinfo_flowdepth_minfo_heights") );
+		super(user, new FlowDepthTwinPanelValidator(), new  NilDatacageTwinPanelInfo("sinfo_flowdepth_waterlevels"), new DefaultDatacageTwinPanelInfo("bedheight", "sinfo_flowdepth_minfo_heights") );
 	}
 }
\ No newline at end of file


More information about the Dive4Elements-commits mailing list