Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/shared/model/PropertyGroup.java @ 5838:5aa05a7a34b7
Rename modules to more fitting names.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 15:23:37 +0200 |
parents | flys-client/src/main/java/org/dive4elements/river/client/shared/model/PropertyGroup.java@821a02bbfb4e |
children | 172338b1407f |
comparison
equal
deleted
inserted
replaced
5837:d9901a08d0a6 | 5838:5aa05a7a34b7 |
---|---|
1 package org.dive4elements.river.client.shared.model; | |
2 | |
3 import java.util.ArrayList; | |
4 import java.util.List; | |
5 | |
6 /** | |
7 * A group of properties. | |
8 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
9 */ | |
10 public class PropertyGroup implements Property, Cloneable { | |
11 | |
12 /** The group name */ | |
13 protected String name; | |
14 | |
15 protected List<Property> properties; | |
16 | |
17 public PropertyGroup() { | |
18 } | |
19 | |
20 public PropertyGroup(String name) { | |
21 this.name = name; | |
22 } | |
23 | |
24 public PropertyGroup(String name, List<Property> properties) { | |
25 this.name = name; | |
26 this.properties = properties; | |
27 } | |
28 | |
29 public String getName() { | |
30 return this.name; | |
31 } | |
32 | |
33 public void setName(String name) { | |
34 this.name = name; | |
35 } | |
36 | |
37 public List<Property> getProperties() { | |
38 return this.properties; | |
39 } | |
40 | |
41 public void setProperties(List<Property> properties) { | |
42 this.properties = properties; | |
43 } | |
44 | |
45 public Property getPropertyByName(String name) { | |
46 for (int i = 0; i < properties.size(); i++) { | |
47 if (properties.get(i).getName().equals(name)) { | |
48 return properties.get(i); | |
49 } | |
50 } | |
51 return null; | |
52 } | |
53 | |
54 @Override | |
55 public Object clone() { | |
56 PropertyGroup clone = new PropertyGroup(this.getName()); | |
57 List<Property> cloneList = new ArrayList<Property>(); | |
58 for(Property p: properties) { | |
59 cloneList.add((Property)p.clone()); | |
60 } | |
61 clone.setProperties(cloneList); | |
62 return clone; | |
63 } | |
64 | |
65 @Override | |
66 public String toString() { | |
67 StringBuilder buf = new StringBuilder(); | |
68 | |
69 for(Property p : properties) { | |
70 buf.append(p.getName()); | |
71 buf.append("="); | |
72 if(p instanceof PropertySetting) { | |
73 buf.append(((PropertySetting)p).getValue().toString()); | |
74 } | |
75 buf.append(" "); | |
76 } | |
77 | |
78 return buf.toString(); | |
79 } | |
80 } |