01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/field/TKFieldSwitchFakeIterator.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 TKFieldSwitchFakeIterator implements TKListIterator {
11: TKListIterator oldIterator;
12: String listName;
13: TKFieldSwitchData data;
14: TKHashtable fieldHash;
15: String prefix;
16:
17: public TKFieldSwitchFakeIterator(TKFieldSwitchData data,
18: TKHashtable fieldHash, String prefix,
19: TKListIterator oldIterator, String listName) {
20: this .oldIterator = oldIterator;
21: this .listName = listName;
22: this .data = data;
23: this .fieldHash = fieldHash;
24: this .prefix = prefix;
25: }
26:
27: public boolean apply(TKTemplate t, int i, String currListName) {
28: TKHTMLTemplate template = (TKHTMLTemplate) t;
29: if (currListName.equalsIgnoreCase(listName)) {
30: if (i >= 1)
31: return false;
32: if (data.data == null)
33: return false;
34: TKBaseField field = (TKBaseField) fieldHash
35: .get(data.alternative);
36: field.fillIntoTemplate(template, data.data, prefix
37: + data.alternative + '.');
38: return true;
39: } else if (oldIterator != null) {
40: return oldIterator.apply(template, i, currListName);
41: } else {
42: return false;
43: }
44: }
45: }
|