01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/field/TKListShowIterator.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 TKListShowIterator implements TKListIterator {
11:
12: TKListIterator oldIterator;
13: TKVector dataVector;
14: TKBaseField field;
15: int entryCount;
16: String scope;
17: String fieldListName;
18: String listTagName;
19:
20: public TKListShowIterator(TKVector dataVector, TKBaseField field,
21: String scope, String fieldListName,
22: TKListIterator oldIterator) {
23: this .oldIterator = oldIterator;
24: this .field = field;
25: this .fieldListName = fieldListName;
26: this .dataVector = dataVector;
27: this .scope = scope;
28: this .entryCount = dataVector.size();
29: this .listTagName = scope + "." + fieldListName;
30: }
31:
32: public boolean apply(TKTemplate t, int i, String currListName) {
33: TKHTMLTemplate template = (TKHTMLTemplate) t;
34: if (currListName.equalsIgnoreCase(listTagName)) {
35: if (i >= entryCount)
36: return false;
37: Object data = dataVector.get(i);
38: String subScope = listTagName;
39: template.set("SCOPE", subScope);
40: template.set(subScope + ".IDX", String.valueOf(i + 1));
41: field.fillIntoPresentation(template, data, subScope);
42: return true;
43: } else if (oldIterator != null) {
44: return oldIterator.apply(template, i, currListName);
45: } else {
46: return false;
47: }
48: }
49: }
|