1 package com.openedit.store; 2 3 import java.util.ArrayList ; 4 import java.util.Collection ; 5 import java.util.Iterator ; 6 import java.util.List ; 7 8 import org.dom4j.Element; 9 10 import com.openedit.modules.xml.XmlFile; 11 12 public class Types implements Collection 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 get(String 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 keys() 44 { 45 List list = new ArrayList (); 46 for (Iterator 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 arg0) 59 { 60 61 return getPageSettings().getElements().add(arg0); 62 } 63 64 public boolean addAll(Collection 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 inO) 77 { 78 79 return getPageSettings().getElements().contains(inO); 80 } 81 82 public boolean containsAll(Collection 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 iterator() 95 { 96 return getPageSettings().getElements().iterator(); 97 } 98 99 public boolean remove(Object inO) 100 { 101 102 return getPageSettings().getElements().remove(inO); 103 } 104 105 public boolean removeAll(Collection arg0) 106 { 107 108 return getPageSettings().getElements().removeAll(arg0); 109 } 110 111 public boolean retainAll(Collection arg0) 112 { 113 114 return getPageSettings().getElements().retainAll(arg0); 115 } 116 117 public Object [] toArray() 118 { 119 120 return getPageSettings().getElements().toArray(); 121 } 122 123 public Object [] toArray(Object [] arg0) 124 { 125 126 return getPageSettings().getElements().toArray(arg0); 127 } 128 } 129 | Popular Tags |