changeset 6591:661faf99d240

issue1394: Minor refactoring.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 18 Jul 2013 12:33:06 +0200
parents 266864819f0b
children 716709cd5ba3
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageTwinPanel.java
diffstat 1 files changed, 7 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageTwinPanel.java	Thu Jul 18 12:32:14 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageTwinPanel.java	Thu Jul 18 12:33:06 2013 +0200
@@ -277,6 +277,10 @@
         this.removedPairs.add(pr);
     }
 
+    /**
+     * Set factory of recommendation such that the correct artifacts will
+     * be cloned for difference calculations.
+     */
     public void adjustRecommendation(Recommendation recommendation) {
         if (recommendation.getIDs() != null) {
             GWT.log("Setting staticwkms factory for rec with ID "
@@ -323,29 +327,10 @@
                 // Check whether one of those is a dike or similar.
                 // TODO differentiate and merge: new clones, new, old.
                 Recommendation firstR = r.getFirst();
-                if(firstR.getIDs() != null) {
-                    GWT.log("First IDs: " + firstR.getIDs() + " factory: "
-                            + firstR.getFactory());
-                }
-                if(firstR.getIDs() != null) {
-                    // These do not get cloned but loaded ("spawned").
-                    firstR.setFactory("staticwkms");
-                }
-                else {
-                    firstR.setFactory("waterlevel");
-                }
+                adjustRecommendation(firstR);
+
                 Recommendation secondR = r.getSecond();
-                if(secondR.getIDs() != null) {
-                    GWT.log("Second IDs: " + secondR.getIDs() + " factory: "
-                            + secondR.getFactory());
-                }
-                if (secondR.getIDs() != null) {
-                    // These do not get cloned but loaded ("spawned").
-                    secondR.setFactory("staticwkms");
-                }
-                else {
-                    secondR.setFactory("waterlevel");
-                }
+                adjustRecommendation(secondR);
 
                 ar.add(firstR);
                 ar.add(secondR);

http://dive4elements.wald.intevation.org