01: package com.teamkonzept.field;
02:
03: import com.teamkonzept.lib.*;
04: import com.teamkonzept.web.*;
05:
06: public class TKFieldGroupIterator implements TKListIterator {
07:
08: TKListIterator oldIterator;
09: String listName;
10: TKHashtable dataHash;
11: TKVector fields;
12: int fieldCount;
13: String prefix;
14:
15: public TKFieldGroupIterator(TKHashtable dataHash, TKVector fields,
16: String prefix, TKListIterator oldIterator, String listName) {
17: this .oldIterator = oldIterator;
18: this .fields = fields;
19: this .listName = listName;
20: this .dataHash = dataHash;
21: this .prefix = prefix;
22: this .fieldCount = fields.size();
23: }
24:
25: public boolean apply(TKTemplate t, int i, String currListName) {
26: TKHTMLTemplate template = (TKHTMLTemplate) t;
27: if (currListName.equalsIgnoreCase(listName)) {
28: if (i >= fieldCount)
29: return false;
30: TKBaseField field = (TKBaseField) fields.get(i);
31: Object data = dataHash.get(field.getName());
32: field.fillIntoTemplate(template, data, prefix);
33: return true;
34: } else if (oldIterator != null) {
35: return oldIterator.apply(template, i, currListName);
36: } else {
37: return false;
38: }
39: }
40: }
|