1 20 package org.enhydra.barracuda.contrib.dbroggisch.display; 21 22 23 import java.util.*; 24 import javax.servlet.*; 25 import javax.servlet.http.*; 26 27 import org.enhydra.barracuda.core.comp.*; 28 import org.enhydra.barracuda.core.forms.*; 29 import org.enhydra.barracuda.core.comp.model.*; 30 31 62 public class IterativeCollectionModel extends AbstractTemplateModel implements IterativeModel { 63 64 private Collection _models; 65 private String _name; 66 private Iterator _it; 67 71 protected Object _current; 72 73 74 80 public IterativeCollectionModel(String name, Collection models) { 81 _name = name; 82 _models = models; 83 } 84 85 90 public IterativeCollectionModel(String name) { 91 this(name, new ArrayList()); 92 } 93 94 98 public IterativeCollectionModel() { 99 this(null, new ArrayList()); 100 } 101 102 103 108 public void setName(String name) { 109 _name = name; 110 } 111 112 113 118 public String getName() { 119 return _name; 120 } 121 122 127 public Collection getModels() { 128 return this._models; 129 } 130 131 132 137 public void setModels(Collection arg_models){ 138 this._models = arg_models; 139 } 140 141 146 public void add(Object val) { 147 _models.add(val); 148 } 149 150 152 153 public boolean hasNext() 154 { 155 return (_it != null && _it.hasNext()); 156 } 157 158 public void preIterate() 159 { 160 _it = _models.iterator(); 161 } 162 163 public void postIterate() 164 { 165 166 } 167 168 public void loadNext() 169 { 170 _current = _it.next(); 171 } 172 173 } 174 | Popular Tags |