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 IterativeListModel extends AbstractTemplateModel implements IterativeModel { 63 64 private List _models; 65 private String _name; 66 private Iterator _it; 67 71 protected Object _current; 72 73 74 80 public IterativeListModel(String name, List models) { 81 _name = name; 82 _models = models; 83 } 84 85 90 public IterativeListModel(String name) { 91 this(name, new ArrayList()); 92 } 93 94 98 public IterativeListModel() { 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 List getModels() { 128 return this._models; 129 } 130 131 132 137 public void setModels(List 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 |