comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RecommendationPairRecord.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-client/src/main/java/org/dive4elements/river/client/client/ui/RecommendationPairRecord.java@821a02bbfb4e
children 172338b1407f
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.client.client.ui;
2
3 import com.smartgwt.client.widgets.grid.ListGridRecord;
4
5 import org.dive4elements.river.client.shared.model.Recommendation;
6
7
8 /**
9 * Two strings to be displayed in a GridList, derived from two
10 * Recommendations.
11 */
12 public class RecommendationPairRecord extends ListGridRecord {
13
14 /** First attribute-name for StringPairRecord. */
15 protected static final String ATTRIBUTE_FIRST = "first";
16
17 /** Second attribute-name for StringPairRecord. */
18 protected static final String ATTRIBUTE_SECOND = "second";
19
20 /** The "first" recommendation (typically the minuend). */
21 Recommendation first;
22
23 /** The "second" recommendation (typically the subtrahend). */
24 Recommendation second;
25
26 /**
27 * Whether the RecommendationPairRecord was restored from data and thus
28 * already loaded (usually cloned) in an ArtifactCollection or not.
29 */
30 boolean alreadyLoaded;
31
32
33 /** Trivial, blocked constructor. */
34 @SuppressWarnings("unused")
35 private RecommendationPairRecord() {
36 }
37
38
39 /**
40 * Create a new RecommendationPairRecord.
41 *
42 * @param first The first recommendation (typically the minuend).
43 * @param second The second recommendation (typically the subtrahend).
44 */
45 public RecommendationPairRecord(
46 Recommendation first,
47 Recommendation second)
48 {
49 setFirst(first);
50 setSecond(second);
51 alreadyLoaded = false;
52 }
53
54
55 /**
56 * Sets the first recommendation with info (minuend).
57 * @param first Recommendation to store.
58 */
59 public void setFirst(Recommendation first) {
60 this.first = first;
61 setAttribute(ATTRIBUTE_FIRST, first.getDisplayName());
62 }
63
64
65 /**
66 * Sets the second recommendation with info (subtrahend).
67 * @param second Recommendation to store.
68 */
69 public void setSecond(Recommendation second) {
70 this.second = second;
71 setAttribute(ATTRIBUTE_SECOND, second.getDisplayName());
72 }
73
74
75 /**
76 * Get first recommendation (typically the minuend).
77 * @return first recommendation (typically the minuend).
78 */
79 public Recommendation getFirst() {
80 return first;
81 }
82
83
84 /**
85 * Get second recommendation (typically the subtrahend).
86 * @return second recommendation (typically the subtrahend).
87 */
88 public Recommendation getSecond() {
89 return second;
90 }
91
92
93 /**
94 * Get name of first recommendation (typically the minuend).
95 * @return name of first recommendation (typically the minuend).
96 */
97 public String getFirstName() {
98 return first.getDisplayName();
99 }
100
101
102 /**
103 * Get name of second recommendation (typically the subtrahend).
104 * @return name of second recommendation (typically the subtrahend).
105 */
106 public String getSecondName() {
107 return second.getDisplayName();
108 }
109
110
111 /**
112 * Sets whether or not the Recommendation is already loaded (in contrast
113 * to not yet loaded).
114 * @param isAlreadyLoaded new value.
115 */
116 public void setIsAlreadyLoaded(boolean isAlreadyLoaded) {
117 this.alreadyLoaded = isAlreadyLoaded;
118 }
119
120
121 /**
122 * Whether or not this pair of recommendations is already laoded (usually
123 * cloned) in an ArtifactCollection.
124 * @return whether pair of recommendations is already loaded.
125 */
126 public boolean isAlreadyLoaded() {
127 return this.alreadyLoaded;
128 }
129 }

http://dive4elements.wald.intevation.org