Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/CollectionRecord.java @ 552:6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
flys-client/trunk@2066 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 07 Jun 2011 13:26:24 +0000 |
parents | a13382876e5d |
children | 53ad6dd2cb2b |
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()); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
33 } |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
34 |
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 * Sets the creation time. |
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 * @param creationTime 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 public void setCreationTime(Date creationTime) { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
42 setAttribute("creationTime", creationTime); |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 } |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
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 /** |
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
|
47 * 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
|
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 * @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
|
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 public Date getCreationTime() { |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
52 return getAttributeAsDate("creationTime"); |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 } |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
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 * 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
|
58 * |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 * @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
|
60 */ |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
61 public void setName(String name) { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
62 setAttribute("name", name); |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 } |
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
|
64 |
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
|
65 |
226
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
66 /** |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
67 * 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
|
68 * |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
69 * @return the name of the collection. |
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 public String getName() { |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
72 return getAttributeAsString("name"); |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
73 } |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
74 |
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 * Returns the collection objects itself. |
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 collection object. |
a13382876e5d
The project list is sorted now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
222
diff
changeset
|
80 */ |
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
|
81 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
|
82 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
|
83 } |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 } |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |