KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > store > Types


1 package com.openedit.store;
2
3 import java.util.ArrayList JavaDoc;
4 import java.util.Collection JavaDoc;
5 import java.util.Iterator JavaDoc;
6 import java.util.List JavaDoc;
7
8 import org.dom4j.Element;
9
10 import com.openedit.modules.xml.XmlFile;
11
12 public class Types implements Collection JavaDoc
13 {
14     protected XmlFile fieldPageSettings;
15     
16     public Types (XmlFile inSettings)
17     {
18         setPageSettings(inSettings);
19     }
20
21     public XmlFile getPageSettings()
22     {
23         return fieldPageSettings;
24     }
25
26     public void setPageSettings(XmlFile inPageSettings)
27     {
28         fieldPageSettings = inPageSettings;
29     }
30     
31     public String JavaDoc get(String JavaDoc inId)
32     {
33         if (getPageSettings() != null)
34         {
35             Element prop = getPageSettings().getElementById(inId);
36             if (prop != null)
37             {
38                 return prop.getText();
39             }
40         }
41         return null;
42     }
43     public List JavaDoc keys()
44     {
45         List JavaDoc list = new ArrayList JavaDoc();
46         for (Iterator JavaDoc iter = getPageSettings().getElements().iterator(); iter.hasNext();)
47         {
48             Element prop = (Element)iter.next();
49             list.add(prop.attributeValue("id"));
50         }
51         return list;
52     }
53     public int size()
54     {
55         return getPageSettings().getElements().size();
56     }
57
58     public boolean add(Object JavaDoc arg0)
59     {
60         
61         return getPageSettings().getElements().add(arg0);
62     }
63
64     public boolean addAll(Collection JavaDoc arg0)
65     {
66         
67         return getPageSettings().getElements().addAll(arg0);
68     }
69
70     public void clear()
71     {
72         
73         getPageSettings().getElements().clear();
74     }
75
76     public boolean contains(Object JavaDoc inO)
77     {
78         
79         return getPageSettings().getElements().contains(inO);
80     }
81
82     public boolean containsAll(Collection JavaDoc arg0)
83     {
84         
85         return getPageSettings().getElements().containsAll(arg0);
86     }
87
88     public boolean isEmpty()
89     {
90         
91         return getPageSettings().getElements().isEmpty();
92     }
93
94     public Iterator JavaDoc iterator()
95     {
96         return getPageSettings().getElements().iterator();
97     }
98
99     public boolean remove(Object JavaDoc inO)
100     {
101         
102         return getPageSettings().getElements().remove(inO);
103     }
104
105     public boolean removeAll(Collection JavaDoc arg0)
106     {
107         
108         return getPageSettings().getElements().removeAll(arg0);
109     }
110
111     public boolean retainAll(Collection JavaDoc arg0)
112     {
113         
114         return getPageSettings().getElements().retainAll(arg0);
115     }
116
117     public Object JavaDoc[] toArray()
118     {
119         
120         return getPageSettings().getElements().toArray();
121     }
122
123     public Object JavaDoc[] toArray(Object JavaDoc[] arg0)
124     {
125         
126         return getPageSettings().getElements().toArray(arg0);
127     }
128 }
129
Popular Tags