01: /*
02: * Copyright 2004, 2005, 2006 Odysseus Software GmbH
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package de.odysseus.calyxo.panels.conf.impl;
17:
18: import java.util.ArrayList;
19: import java.util.Iterator;
20:
21: import de.odysseus.calyxo.base.conf.impl.ConfigImpl;
22: import de.odysseus.calyxo.panels.conf.ListConfig;
23:
24: /**
25: * List configuration implementation.
26: *
27: * @author Christoph Beck
28: */
29: public class ListConfigImpl extends ConfigImpl implements ListConfig {
30: private String name;
31: private ArrayList items = new ArrayList();
32:
33: /*
34: * (non-Javadoc)
35: * @see de.odysseus.calyxo.base.conf.impl.ConfigImpl#_getElementName()
36: */
37: protected String _getElementName() {
38: return "list";
39: }
40:
41: /*
42: * (non-Javadoc)
43: * @see de.odysseus.calyxo.base.conf.impl.ConfigImpl#_addChildren(de.odysseus.calyxo.base.conf.impl.ConfigImpl.Elements)
44: */
45: protected void _addChildren(Elements list) {
46: super ._addChildren(list);
47: list.add(getItemConfigs());
48: }
49:
50: /*
51: * (non-Javadoc)
52: * @see de.odysseus.calyxo.base.conf.impl.ConfigImpl#_putAttributes(de.odysseus.calyxo.base.conf.impl.ConfigImpl.Attributes)
53: */
54: protected void _putAttributes(Attributes map) {
55: super ._putAttributes(map);
56: map.put("name", name);
57: }
58:
59: /**
60: * Add list item
61: */
62: public void add(ItemConfigImpl item) {
63: items.add(item);
64: }
65:
66: /*
67: * (non-Javadoc)
68: * @see de.odysseus.calyxo.panels.conf.ListConfig#getItemConfigs()
69: */
70: public Iterator getItemConfigs() {
71: return items.iterator();
72: }
73:
74: /**
75: * Get list name
76: */
77: public String getName() {
78: return name;
79: }
80:
81: /**
82: * Set list name
83: */
84: public void setName(String string) {
85: name = string;
86: }
87: }
|