Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WaterlevelRecommandationInfo.java @ 8852:8f6d6d26e96f
Refaktored the DatacageTwinPanel so it is reusable.
author | gernotbelger |
---|---|
date | Thu, 18 Jan 2018 18:32:30 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
8851:13650d8a2373 | 8852:8f6d6d26e96f |
---|---|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.client.client.ui; | |
11 | |
12 import org.dive4elements.river.client.client.ui.DatacageTwinPanel.IDatacageTwinPanelInfo; | |
13 import org.dive4elements.river.client.shared.model.Recommendation; | |
14 | |
15 import com.google.gwt.core.client.GWT; | |
16 | |
17 /** | |
18 * @author Gernot Belger | |
19 */ | |
20 public final class WaterlevelRecommandationInfo implements IDatacageTwinPanelInfo { | |
21 | |
22 private String outs; | |
23 | |
24 public WaterlevelRecommandationInfo(String outs ) { | |
25 this.outs = outs; | |
26 } | |
27 | |
28 @Override | |
29 public String getFactory() { | |
30 // FIXME: why are the factory here and the one used in createDataString different? | |
31 // Probably also because of the 'throw all this code away comment' | |
32 return "waterlevel"; | |
33 } | |
34 | |
35 @Override | |
36 public String getDataStringFactory() { | |
37 return "staticwkms"; | |
38 } | |
39 | |
40 @Override | |
41 public void adjustRecommendation(Recommendation recommendation) { | |
42 // XXX: THIS IS AN EVIL HACK TO MAKE W-DIFFERENCES WORK AGAIN! | |
43 // TODO: Throw all this code away and do it with server side recommendations! | |
44 recommendation.setTargetOut("w_differences"); | |
45 | |
46 if (recommendation.getIDs() != null) { | |
47 GWT.log("Setting staticwkms factory for rec with ID " | |
48 + recommendation.getIDs()); | |
49 recommendation.setFactory("staticwkms"); | |
50 } | |
51 /* | |
52 // So far, we do not need to rewrite the factory anymore, | |
53 // except for staticwkms; probably other cases will pop up later. | |
54 else if (recommendation.getFactory().equals("winfo")) { | |
55 GWT.log("Setting waterlevel factory for a winfo rec."); | |
56 recommendation.setFactory("waterlevel"); | |
57 } | |
58 */ | |
59 else { | |
60 GWT.log("Leave rec. id " + recommendation.getIDs() + ", factory " | |
61 + recommendation.getFactory() + " untouched."); | |
62 } | |
63 } | |
64 | |
65 @Override | |
66 public String getOuts() { | |
67 return outs; | |
68 } | |
69 } |