01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/field/TKFieldSwitchIterator.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 TKFieldSwitchIterator implements TKListIterator {
11:
12: TKListIterator oldIterator;
13: String listName;
14: TKVector fieldVector;
15: int entryCount;
16: String prefix;
17:
18: public TKFieldSwitchIterator(TKVector fieldVector, String prefix,
19: TKListIterator oldIterator, String listName) {
20: this .oldIterator = oldIterator;
21: this .listName = listName;
22: this .fieldVector = fieldVector;
23: this .prefix = prefix;
24: this .entryCount = fieldVector.size();
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 >= entryCount)
31: return false;
32: //template.addSubst( "NAME", fieldName );
33: TKBaseField field = (TKBaseField) fieldVector.get(i);
34: template.set("ALTSHOWNAME", field.getShowName());
35: template.set("ALTNAME", field.getName());
36: return true;
37: } else if (oldIterator != null) {
38: return oldIterator.apply(template, i, currListName);
39: } else {
40: return false;
41: }
42: }
43: }
|