comparison flys-client/src/main/java/org/dive4elements/river/client/shared/model/CollectionItemAttribute.java @ 5834:f507086aa94b

Repaired internal references.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 12:31:32 +0200
parents flys-client/src/main/java/de/intevation/flys/client/shared/model/CollectionItemAttribute.java@92074508a387
children 821a02bbfb4e
comparison
equal deleted inserted replaced
5833:a2bdc0f524e8 5834:f507086aa94b
1 package de.intevation.flys.client.shared.model;
2
3 import java.io.Serializable;
4
5 import java.util.List;
6 import java.util.ArrayList;
7
8
9 /**
10 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
11 */
12 public class CollectionItemAttribute implements Serializable {
13
14 /** The list of styles. */
15 protected List<Style> styles;
16
17 /** The artifact. */
18 protected String artifact;
19
20
21 /**
22 * Creates a new CollectionItem Attribute.
23 */
24 public CollectionItemAttribute() {
25 styles = new ArrayList<Style>();
26 }
27
28
29 /**
30 * Append a new Style.
31 * @param style The style.
32 */
33 public void appendStyle (Style style) {
34 this.styles.add(style);
35 }
36
37
38 /**
39 * Remove a style from the attributes.
40 * @param name The style name.
41 */
42 public void removeStyle (String name) {
43 for (int i = 0; i < styles.size(); i++) {
44 if (styles.get(i).getName().equals(name)) {
45 styles.remove(i);
46 }
47 }
48 }
49
50
51 /**
52 * Get a style from the collection item.
53 * @param facet The facet this style belongs to.
54 * @param index The style index.
55 *
56 * @return The selected style or 'null'.
57 */
58 public Style getStyle(String facet, int index) {
59 for (int i = 0; i < styles.size(); i++) {
60 Style tmp = styles.get(i);
61 if (tmp.getFacet().equals(facet) &&
62 tmp.getIndex() == index) {
63 return tmp;
64 }
65 }
66 return null;
67 }
68
69
70 /**
71 * Get the style at a postion.
72 * @param i The position index.
73 *
74 * @return The selected style.
75 */
76 public Style getStyle(int i) {
77 return styles.get(i);
78 }
79
80
81 /**
82 * Get the number of styles.
83 * @return The number of styles.
84 */
85 public int getNumStyles() {
86 return styles.size();
87 }
88
89
90 /**
91 * Set the current artifact.
92 * @param The artifact uuid.
93 */
94 public void setArtifact(String artifact) {
95 this.artifact = artifact;
96 }
97
98
99 /**
100 * Get the associated artifact.
101 * @return The artifact.
102 */
103 public String getArtifact () {
104 return this.artifact;
105 }
106 }

http://dive4elements.wald.intevation.org