comparison artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultSettings.java @ 473:d0ac790a6c89 dive4elements-move

Moved directories to org.dive4elements
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 10:57:18 +0200
parents artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultSettings.java@ab3900303f25
children 415df0fc4fa1
comparison
equal deleted inserted replaced
472:783cc1b6b615 473:d0ac790a6c89
1 package de.intevation.artifactdatabase.state;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.w3c.dom.Document;
7 import org.w3c.dom.Element;
8 import org.w3c.dom.Node;
9
10
11 /**
12 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
13 */
14 public class DefaultSettings implements Settings {
15
16 protected List<Section> sections;
17
18 public DefaultSettings() {
19 sections = new ArrayList<Section>();
20 }
21
22 @Override
23 public void addSection(Section section) {
24 if (section != null) {
25 sections.add(section);
26 }
27 }
28
29 @Override
30 public int getSectionCount() {
31 return sections.size();
32 }
33
34 @Override
35 public Section getSection(int pos) {
36 if (pos >= 0 && pos < getSectionCount()) {
37 return sections.get(pos);
38 }
39
40 return null;
41 }
42
43 @Override
44 public void removeSection(Section section) {
45 if (section != null) {
46 sections.remove(section);
47 }
48 }
49
50 @Override
51 public void toXML(Node parent) {
52 Document owner = parent.getOwnerDocument();
53 Element settings = owner.createElement("settings");
54
55 parent.appendChild(settings);
56
57 for (Section section: sections) {
58 section.toXML(settings);
59 }
60 }
61 }
62 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org