Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/RecommendationPairRecord.java @ 1298:b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
flys-client/trunk@2920 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 10 Oct 2011 10:02:16 +0000 |
parents | |
children | f4f30d758550 |
comparison
equal
deleted
inserted
replaced
1297:887eb0cd7dfc | 1298:b0ed67cb5197 |
---|---|
1 package de.intevation.flys.client.client.ui; | |
2 | |
3 import com.smartgwt.client.widgets.grid.ListGridRecord; | |
4 import de.intevation.flys.client.shared.model.Recommendation; | |
5 | |
6 | |
7 /** | |
8 * Two strings to be displayed in a GridList, derived from two | |
9 * Recommendations. | |
10 */ | |
11 public class RecommendationPairRecord extends ListGridRecord { | |
12 | |
13 /** First attribute-name for StringPairRecord. */ | |
14 protected static final String ATTRIBUTE_FIRST = "first"; | |
15 | |
16 /** Second attribute-name for StringPairRecord. */ | |
17 protected static final String ATTRIBUTE_SECOND = "second"; | |
18 | |
19 Recommendation first; | |
20 Recommendation second; | |
21 String firstName; | |
22 String secondName; | |
23 | |
24 | |
25 public RecommendationPairRecord() { | |
26 } | |
27 | |
28 | |
29 public RecommendationPairRecord(String firstName, | |
30 Recommendation first, | |
31 String secondName, | |
32 Recommendation second) | |
33 { | |
34 setFirst(first, firstName); | |
35 setSecond(second, secondName); | |
36 } | |
37 | |
38 | |
39 public void setFirst(Recommendation first, String name) { | |
40 this.first = first; | |
41 this.firstName = name; | |
42 setAttribute(ATTRIBUTE_FIRST, name); | |
43 } | |
44 | |
45 | |
46 public void setSecond(Recommendation second, String name) { | |
47 this.second = second; | |
48 this.secondName = name; | |
49 setAttribute(ATTRIBUTE_SECOND, name); | |
50 } | |
51 | |
52 | |
53 public Recommendation getFirst() { | |
54 return first; | |
55 } | |
56 | |
57 | |
58 public Recommendation getSecond() { | |
59 return second; | |
60 } | |
61 | |
62 | |
63 public String getFirstName() { | |
64 return firstName; | |
65 } | |
66 | |
67 | |
68 public String getSecondName() { | |
69 return secondName; | |
70 } | |
71 | |
72 /* | |
73 * public static Recommmendation recommendationfromString(String from, | |
74 String factory, String masterArtifactId) | |
75 { | |
76 String parts = StringUtil.unbracket(from).split(";"); | |
77 // TODO proper filter instead of null. | |
78 Recommendation r = new Recommendation(factory, parts[0], | |
79 masterArtifactId, null); | |
80 return r; | |
81 } | |
82 | |
83 public static RecommendationPairRecord[] fromString(String from, | |
84 String masterArtifactId) | |
85 { | |
86 if (from == null) { | |
87 return new RecommendationPairRecord[] {}; | |
88 } | |
89 | |
90 //List<RecommendationPairRecord> | |
91 String recs = from.split("#"); | |
92 for (int i = 0; i < recs.length; i+=2) { | |
93 Recommendation minuend = recommendationfromString(recs[i+0], "waterlevel", masterArtifactId); | |
94 Recommendation subtrahend = recommendationfromString(recs[i+0], "waterlevel", masterArtifactId); | |
95 } | |
96 return new RecommendationPairRecord[] {}; | |
97 }*/ | |
98 } |