Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/shared/model/CollectionItemAttribute.java @ 9238:1c756bfee472
salix.supraregional table revision -> Anschluss
author | gernotbelger |
---|---|
date | Tue, 10 Jul 2018 13:27:17 +0200 |
parents | ea9eef426962 |
children |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.shared.model; |
1285
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import java.io.Serializable; |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import java.util.List; |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import java.util.ArrayList; |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 /** |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 */ |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 public class CollectionItemAttribute implements Serializable { |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
22 /** The list of styles. */ |
1285
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 protected List<Style> styles; |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
25 /** The artifact. */ |
1292
bdc270ea6195
Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1285
diff
changeset
|
26 protected String artifact; |
bdc270ea6195
Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1285
diff
changeset
|
27 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
28 |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
29 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
30 * Creates a new CollectionItem Attribute. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
31 */ |
1285
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 public CollectionItemAttribute() { |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 styles = new ArrayList<Style>(); |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 } |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
36 |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
37 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
38 * Append a new Style. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
39 * @param style The style. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
40 */ |
1285
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 public void appendStyle (Style style) { |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 this.styles.add(style); |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 } |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
45 |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
46 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
47 * Remove a style from the attributes. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
48 * @param name The style name. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
49 */ |
1285
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 public void removeStyle (String name) { |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 for (int i = 0; i < styles.size(); i++) { |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 if (styles.get(i).getName().equals(name)) { |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 styles.remove(i); |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 } |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 } |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 } |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
58 |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
59 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
60 * Get a style from the collection item. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
61 * @param facet The facet this style belongs to. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
62 * @param index The style index. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
63 * |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
64 * @return The selected style or 'null'. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
65 */ |
1326
974c6b3700de
Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1292
diff
changeset
|
66 public Style getStyle(String facet, int index) { |
1285
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 for (int i = 0; i < styles.size(); i++) { |
1326
974c6b3700de
Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1292
diff
changeset
|
68 Style tmp = styles.get(i); |
974c6b3700de
Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1292
diff
changeset
|
69 if (tmp.getFacet().equals(facet) && |
974c6b3700de
Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1292
diff
changeset
|
70 tmp.getIndex() == index) { |
974c6b3700de
Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1292
diff
changeset
|
71 return tmp; |
1285
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 } |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 } |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 return null; |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 } |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
77 |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
78 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
79 * Get the style at a postion. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
80 * @param i The position index. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
81 * |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
82 * @return The selected style. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
83 */ |
1285
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 public Style getStyle(int i) { |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 return styles.get(i); |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 } |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
88 |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
89 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
90 * Get the number of styles. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
91 * @return The number of styles. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
92 */ |
1285
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 public int getNumStyles() { |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 return styles.size(); |
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 } |
1292
bdc270ea6195
Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1285
diff
changeset
|
96 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
97 |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
98 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
99 * Set the current artifact. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
100 * @param The artifact uuid. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
101 */ |
1292
bdc270ea6195
Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1285
diff
changeset
|
102 public void setArtifact(String artifact) { |
bdc270ea6195
Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1285
diff
changeset
|
103 this.artifact = artifact; |
bdc270ea6195
Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1285
diff
changeset
|
104 } |
bdc270ea6195
Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1285
diff
changeset
|
105 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
106 |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
107 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
108 * Get the associated artifact. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
109 * @return The artifact. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1326
diff
changeset
|
110 */ |
1292
bdc270ea6195
Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1285
diff
changeset
|
111 public String getArtifact () { |
bdc270ea6195
Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1285
diff
changeset
|
112 return this.artifact; |
bdc270ea6195
Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1285
diff
changeset
|
113 } |
1285
0f3b19df1880
Added new service and model for collection item attributes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 } |