Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/CollectionRecord.java @ 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.
flys-client/trunk@2181 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 21 Jun 2011 16:22:39 +0000 |
parents | a13382876e5d |
children | 3acc631efdf0 |
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 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 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
|
6 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 /** |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 * 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
|
10 * |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 * @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
|
12 */ |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 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
|
14 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 /** The artifact collection. */ |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 protected Collection collection; |
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 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 /** |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * The default constructor. |
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 * @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
|
23 */ |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public CollectionRecord(Collection collection) { |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 this.collection = collection; |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
26 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
27 setCreationTime(collection.getCreationTime()); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
28 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
29 String name = collection.getName(); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
30 setName(name != null && name.length() > 0 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
31 ? name |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
32 : 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
|
33 |
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
|
34 setTTL(collection.getTTL()); |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
35 } |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
36 |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
37 |
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 * Sets the creation time. |
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 * @param creationTime The creation time. |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
42 */ |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
43 public void setCreationTime(Date creationTime) { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
44 setAttribute("creationTime", creationTime); |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 } |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 /** |
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
|
49 * 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
|
50 * |
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
|
51 * @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
|
52 */ |
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
|
53 public Date getCreationTime() { |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
54 return getAttributeAsDate("creationTime"); |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 } |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
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 * 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
|
60 * |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 * @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
|
62 */ |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
63 public void setName(String name) { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
64 setAttribute("name", name); |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 } |
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
|
66 |
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
|
67 |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
68 /** |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
69 * 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
|
70 * |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
71 * @return the name of the collection. |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
72 */ |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
73 public String getName() { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
74 return getAttributeAsString("name"); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
75 } |
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 |
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
|
78 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
|
79 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
|
80 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
|
81 } |
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
|
82 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
|
83 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
|
84 } |
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
|
85 } |
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 |
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 |
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 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
|
89 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
|
90 } |
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 |
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 |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
93 /** |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
94 * Returns the collection objects itself. |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
95 * |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
96 * @return the collection object. |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
97 */ |
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
|
98 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
|
99 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
|
100 } |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 } |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |