01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/field/TKFieldListIterator.java,v 1.7 2000/10/13 13:54:22 alex Exp $
03: *
04: */
05: package com.teamkonzept.field;
06:
07: import com.teamkonzept.lib.*;
08: import com.teamkonzept.web.*;
09:
10: public class TKFieldListIterator implements TKListIterator {
11:
12: TKListIterator oldIterator;
13: String listName;
14: TKVector dataVector;
15: TKBaseField field;
16: int entryCount;
17: String prefix;
18:
19: public TKFieldListIterator(TKVector dataVector, TKBaseField field,
20: String prefix, TKListIterator oldIterator, String listName) {
21: this .oldIterator = oldIterator;
22: this .field = field;
23: this .listName = listName;
24: this .dataVector = dataVector;
25: this .prefix = prefix;
26: this .entryCount = dataVector.size();
27: }
28:
29: public boolean apply(TKTemplate t, int i, String currListName) {
30: TKHTMLTemplate template = (TKHTMLTemplate) t;
31: if (currListName.equalsIgnoreCase(listName)) {
32: if (i >= entryCount)
33: return false;
34: Object data = dataVector.get(i);
35: template.set("LISTPOS", String.valueOf(i + 1));
36: field.fillIntoTemplate(template, data, prefix + i + ".");
37: return true;
38: } else if (oldIterator != null) {
39: return oldIterator.apply(template, i, currListName);
40: } else {
41: return false;
42: }
43: }
44: }
|