comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WaterlevelRecommendationInfo.java @ 9220:e3c2ae1887e8

Allow to filter contents of datacage on client side. Allow to override column label of datacage Some code cleanup
author gernotbelger
date Wed, 04 Jul 2018 12:00:51 +0200
parents 8d1df8639563
children
comparison
equal deleted inserted replaced
9219:8642a76f22be 9220:e3c2ae1887e8
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde 1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
2 * Software engineering by 2 * Software engineering by
3 * Björnsen Beratende Ingenieure GmbH 3 * Björnsen Beratende Ingenieure GmbH
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt 4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
5 * 5 *
6 * This file is Free Software under the GNU AGPL (>=v3) 6 * This file is Free Software under the GNU AGPL (>=v3)
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the 7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
8 * documentation coming with Dive4Elements River for details. 8 * documentation coming with Dive4Elements River for details.
14 14
15 import com.google.gwt.core.client.GWT; 15 import com.google.gwt.core.client.GWT;
16 16
17 /** 17 /**
18 * Factored out code from the old WaterlevelTwinPanel; contains some evil hacks about the involved artifact factories. See original comments below... 18 * Factored out code from the old WaterlevelTwinPanel; contains some evil hacks about the involved artifact factories. See original comments below...
19 * 19 *
20 * @author Gernot Belger 20 * @author Gernot Belger
21 */ 21 */
22 public final class WaterlevelRecommendationInfo implements IDatacageTwinPanelInfo { 22 public final class WaterlevelRecommendationInfo implements IDatacageTwinPanelInfo {
23 23
24 private final String outs; 24 private final String outs;
25 25
26 /** 26 /**
27 * @param tweakFactory See evil hack below 27 * @param tweakFactory See evil hack below
28 */ 28 */
29 public WaterlevelRecommendationInfo(final String outs) { 29 public WaterlevelRecommendationInfo(final String outs) {
30 this.outs = outs; 30 this.outs = outs;
31 } 31 }
32 32
33 @Override
34 public String getFactory(final String originalFactory) {
35 // FIXME: why are the factory here and the one used in createDataString different?
36 // Probably also because of the 'throw all this code away comment'
37 return "waterlevel";
38 }
39
40 @Override
41 public String getDataStringFactory(final Recommendation recommendation) {
42 return "staticwkms";
43 }
44
45 @Override 33 @Override
46 public void adjustRecommendation(final Recommendation recommendation) { 34 public String getFactory(final String originalFactory) {
47 35 // FIXME: why are the factory here and the one used in createDataString different?
36 // Probably also because of the 'throw all this code away comment'
37 return "waterlevel";
38 }
39
40 @Override
41 public String getDataStringFactory(final Recommendation recommendation) {
42 return "staticwkms";
43 }
44
45 @Override
46 public void adjustRecommendation(final Recommendation recommendation) {
47
48 // XXX: THIS IS AN EVIL HACK TO MAKE W-DIFFERENCES WORK AGAIN! 48 // XXX: THIS IS AN EVIL HACK TO MAKE W-DIFFERENCES WORK AGAIN!
49 // TODO: Throw all this code away and do it with server side recommendations! 49 // TODO: Throw all this code away and do it with server side recommendations!
50 recommendation.setTargetOut("w_differences"); 50 recommendation.setTargetOut("w_differences");
51 51
52 if (recommendation.getIDs() != null) { 52 if (recommendation.getIDs() != null) {
53 GWT.log("Setting staticwkms factory for rec with ID " 53 GWT.log("Setting staticwkms factory for rec with ID "
54 + recommendation.getIDs()); 54 + recommendation.getIDs());
55 recommendation.setFactory("staticwkms"); 55 recommendation.setFactory("staticwkms");
56 } 56 }
57 /* 57 /*
58 // So far, we do not need to rewrite the factory anymore, 58 // So far, we do not need to rewrite the factory anymore,
59 // except for staticwkms; probably other cases will pop up later. 59 // except for staticwkms; probably other cases will pop up later.
60 else if (recommendation.getFactory().equals("winfo")) { 60 else if (recommendation.getFactory().equals("winfo")) {
61 GWT.log("Setting waterlevel factory for a winfo rec."); 61 GWT.log("Setting waterlevel factory for a winfo rec.");
62 recommendation.setFactory("waterlevel"); 62 recommendation.setFactory("waterlevel");
63 } 63 }
64 */ 64 */
65 else { 65 else {
66 GWT.log("Leave rec. id " + recommendation.getIDs() + ", factory " 66 GWT.log("Leave rec. id " + recommendation.getIDs() + ", factory "
67 + recommendation.getFactory() + " untouched."); 67 + recommendation.getFactory() + " untouched.");
68 } 68 }
69 } 69 }
70 70
71 @Override 71 @Override
72 public String getOuts() { 72 public String getOuts() {
73 return this.outs; 73 return this.outs;
74 } 74 }
75
76 @Override
77 public String getColumnLabel() {
78 return null;
79 }
75 } 80 }

http://dive4elements.wald.intevation.org