Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/RecommendationPairRecord.java Mon Oct 10 10:02:16 2011 +0000 @@ -0,0 +1,98 @@ +package de.intevation.flys.client.client.ui; + +import com.smartgwt.client.widgets.grid.ListGridRecord; +import de.intevation.flys.client.shared.model.Recommendation; + + +/** + * Two strings to be displayed in a GridList, derived from two + * Recommendations. + */ +public class RecommendationPairRecord extends ListGridRecord { + + /** First attribute-name for StringPairRecord. */ + protected static final String ATTRIBUTE_FIRST = "first"; + + /** Second attribute-name for StringPairRecord. */ + protected static final String ATTRIBUTE_SECOND = "second"; + + Recommendation first; + Recommendation second; + String firstName; + String secondName; + + + public RecommendationPairRecord() { + } + + + public RecommendationPairRecord(String firstName, + Recommendation first, + String secondName, + Recommendation second) + { + setFirst(first, firstName); + setSecond(second, secondName); + } + + + public void setFirst(Recommendation first, String name) { + this.first = first; + this.firstName = name; + setAttribute(ATTRIBUTE_FIRST, name); + } + + + public void setSecond(Recommendation second, String name) { + this.second = second; + this.secondName = name; + setAttribute(ATTRIBUTE_SECOND, name); + } + + + public Recommendation getFirst() { + return first; + } + + + public Recommendation getSecond() { + return second; + } + + + public String getFirstName() { + return firstName; + } + + + public String getSecondName() { + return secondName; + } + +/* + * public static Recommmendation recommendationfromString(String from, + String factory, String masterArtifactId) + { + String parts = StringUtil.unbracket(from).split(";"); + // TODO proper filter instead of null. + Recommendation r = new Recommendation(factory, parts[0], + masterArtifactId, null); + return r; + } + + public static RecommendationPairRecord[] fromString(String from, + String masterArtifactId) + { + if (from == null) { + return new RecommendationPairRecord[] {}; + } + + //List<RecommendationPairRecord> + String recs = from.split("#"); + for (int i = 0; i < recs.length; i+=2) { + Recommendation minuend = recommendationfromString(recs[i+0], "waterlevel", masterArtifactId); + Recommendation subtrahend = recommendationfromString(recs[i+0], "waterlevel", masterArtifactId); + } + return new RecommendationPairRecord[] {}; + }*/ +}