annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/CollectionRecord.java @ 3719:e82acd5c86f7

Merged revisions 5495-5496,5509,5514-5515,5521-5526 via svnmerge from file:///home/clients/bsh/bsh-generischer-viewer/Material/SVN/flys-client/trunk ........ r5495 | ingo | 2012-09-17 14:55:09 +0200 (Mo, 17 Sep 2012) | 1 line Added missing i18n strings for minfo state description. ........ r5496 | ingo | 2012-09-17 15:47:43 +0200 (Mo, 17 Sep 2012) | 1 line Tagged 'flys-client' as 2.9.1 ........ r5509 | teichmann | 2012-09-18 17:54:37 +0200 (Di, 18 Sep 2012) | 1 line Removed trailing whitespace. ........ r5514 | bricks | 2012-09-19 09:56:42 +0200 (Mi, 19 Sep 2012) | 2 lines Add missing Changelog entry for r5472 ........ r5515 | bricks | 2012-09-19 09:59:35 +0200 (Mi, 19 Sep 2012) | 2 lines Implement a scrolling gauge info tree ........ r5521 | bricks | 2012-09-19 14:41:48 +0200 (Mi, 19 Sep 2012) | 2 lines Add station info to the gauges ........ r5522 | bricks | 2012-09-19 14:43:43 +0200 (Mi, 19 Sep 2012) | 2 lines Improve the handling of the GaugePanel in the ParameterList ........ r5523 | bricks | 2012-09-19 14:51:02 +0200 (Mi, 19 Sep 2012) | 4 lines Improve the GaugePanel Be locale aware and only load the gauge info if the river name changes. ........ r5524 | bricks | 2012-09-19 15:14:46 +0200 (Mi, 19 Sep 2012) | 5 lines Fix a NullPointerException When iterating over a list it must be checked if the reference to the list is valid. ........ r5525 | bricks | 2012-09-19 15:16:24 +0200 (Mi, 19 Sep 2012) | 2 lines Don't display the GaugePanel if no river is selected ........ r5526 | bricks | 2012-09-19 15:18:36 +0200 (Mi, 19 Sep 2012) | 2 lines Use the wstunit from the river as unit for the Pegelnullpunkt ........ flys-client/tags/2.9.1@5528 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 19 Sep 2012 14:42:48 +0000
parents 80626c4a5bbf
children
rev   line source
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.shared.model;
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.util.Date;
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
607
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
5 import com.google.gwt.safehtml.shared.SafeHtml;
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
6 import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
7
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import com.smartgwt.client.widgets.grid.ListGridRecord;
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 /**
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 * The CollectionRecord is a wrapper to put Collection objects into a ListGrid.
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 *
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 */
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 public class CollectionRecord extends ListGridRecord {
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 /** The artifact collection. */
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 protected Collection collection;
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 /**
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 * The default constructor.
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 *
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 * @param collection The artifact collection.
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 */
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 public CollectionRecord(Collection collection) {
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 this.collection = collection;
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
29
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
30 setCreationTime(collection.getCreationTime());
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
31
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
32 String name = collection.getName();
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
33 setName(name != null && name.length() > 0
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
34 ? name
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
35 : collection.identifier());
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
36
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
37 setTTL(collection.getTTL());
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
38 }
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
39
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
40
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
41 /**
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
42 * Sets the creation time.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
43 *
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
44 * @param creationTime The creation time.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
45 */
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
46 public void setCreationTime(Date creationTime) {
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
47 setAttribute("creationTime", creationTime);
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 }
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 /**
97
0bec0112c8b3 Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
52 * Returns the date of the creation.
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 *
97
0bec0112c8b3 Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
54 * @return the creation time.
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 */
97
0bec0112c8b3 Integrated the ProjectList into the client. Now, the Collections of a user are displayed in the list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
56 public Date getCreationTime() {
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
57 return getAttributeAsDate("creationTime");
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 }
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 /**
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 * Returns the name of the collection.
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 *
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 * @return the name of the collection.
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 */
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
66 public void setName(String name) {
607
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
67 SafeHtmlBuilder b = new SafeHtmlBuilder();
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
68 b.appendEscaped(name);
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
69
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
70 SafeHtml html = b.toSafeHtml();
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
71
3acc631efdf0 Escape project's names in the project list.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
72 setAttribute("name", html.asString());
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 }
222
9bd9c24f4935 The CollectionRecord implements a method that returns the Collection objects which is represented by the record now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 97
diff changeset
74
9bd9c24f4935 The CollectionRecord implements a method that returns the Collection objects which is represented by the record now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 97
diff changeset
75
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
76 /**
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
77 * Returns the name of the collection or the uuid if no name is specified.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
78 *
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
79 * @return the name of the collection.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
80 */
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
81 public String getName() {
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
82 return getAttributeAsString("name");
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
83 }
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
84
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
85
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
86 public void setTTL(long ttl) {
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
87 if (ttl == 0) {
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
88 setAttribute("ttl", "star_gold");
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
89 }
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
90 else {
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
91 setAttribute("ttl", "star_silver");
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
92 }
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
93 }
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
94
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
95
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
96 public String getTTL() {
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
97 return getAttribute("ttl");
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
98 }
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
99
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 226
diff changeset
100
226
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
101 /**
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
102 * Returns the collection objects itself.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
103 *
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
104 * @return the collection object.
a13382876e5d The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 222
diff changeset
105 */
222
9bd9c24f4935 The CollectionRecord implements a method that returns the Collection objects which is represented by the record now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 97
diff changeset
106 public Collection getCollection() {
9bd9c24f4935 The CollectionRecord implements a method that returns the Collection objects which is represented by the record now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 97
diff changeset
107 return collection;
9bd9c24f4935 The CollectionRecord implements a method that returns the Collection objects which is represented by the record now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 97
diff changeset
108 }
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 }
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org