Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/CollectionRecord.java @ 1411:63be3137abac
Parse and display WMS layers supported by a user specified WMS service.
flys-client/trunk@3298 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 21 Nov 2011 21:00:03 +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 : |