01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/field/TKFieldTableRowOrientedIterator.java,v 1.6 2000/06/01 15:02:54 alex Exp $
03: *
04: */
05: package com.teamkonzept.field;
06:
07: import com.teamkonzept.lib.*;
08: import com.teamkonzept.web.*;
09:
10: public class TKFieldTableRowOrientedIterator implements TKListIterator {
11:
12: TKListIterator oldIterator;
13: String outerList;
14: String innerList;
15: TKFieldTableOrientedData dataClass;
16: TKVector fields;
17: int fieldCount;
18: String prefix;
19: int outerIndex;
20: String fieldType;
21: TKBaseField rowField;
22: TKBaseField colField;
23: String listRowForInfo;
24:
25: public TKFieldTableRowOrientedIterator(
26: TKFieldTableOrientedData dataClass, TKVector fields,
27: TKBaseField rowField, TKBaseField colField, String prefix,
28: TKListIterator oldIterator, String outerList,
29: String innerList, String listRowForInfo, String fieldType) {
30: this .oldIterator = oldIterator;
31: this .fields = fields;
32: this .outerList = outerList;
33: this .innerList = innerList;
34: this .dataClass = dataClass;
35: this .prefix = prefix;
36: this .fieldCount = fields.size();
37: this .fieldType = fieldType;
38: this .rowField = rowField;
39: this .colField = colField;
40: this .listRowForInfo = listRowForInfo;
41: this .outerIndex = 0;
42: }
43:
44: public boolean apply(TKTemplate t, int i, String currListName) {
45: TKHTMLTemplate template = (TKHTMLTemplate) t;
46:
47: TKVector dataVector = (TKVector) dataClass.contentData;
48:
49: //---- Row mit den Infos ----//
50: if (currListName.equalsIgnoreCase(listRowForInfo)) {
51: TKVector colDataVector = dataClass.colData;
52: if ((colDataVector == null) || (i >= colDataVector.size()))
53: return false;
54: colField.fillIntoTemplate(template, colDataVector
55: .elementAt(i), prefix
56: + TKFieldTableOriented.PRE_COLS + "." + i + ".");
57: return true;
58: }
59: //---- aeussere liste ----//
60: else if (currListName.equalsIgnoreCase(outerList)) {
61: if ((dataVector == null) || (i >= dataVector.size()))
62: return false;
63: outerIndex = i;
64: t.set("PREFIX_IDX", prefix + outerIndex + ".");
65: TKVector rowDataVector = dataClass.rowData;
66:
67: if ((rowDataVector != null) && (rowDataVector.size() > 0)) {
68: rowField.fillIntoTemplate(template, rowDataVector
69: .elementAt(outerIndex), prefix
70: + TKFieldTableOriented.PRE_ROWS + "."
71: + outerIndex + ".");
72: }
73:
74: return true;
75:
76: }
77: //---- innere liste ----//
78: else if (currListName.equalsIgnoreCase(innerList)) {
79: if (dataVector == null)
80: return false;
81: TKVector innerVector = (TKVector) dataVector
82: .get(outerIndex);
83: if (i >= innerVector.size())
84: return false;
85:
86: TKBaseField field = (TKBaseField) fields.get(i);
87: field.fillIntoTemplate(template, innerVector.get(i), prefix
88: + outerIndex + "." + i + ".");
89:
90: return true;
91: } else if (oldIterator != null) {
92: return oldIterator.apply(template, i, currListName);
93: } else {
94: return false;
95: }
96: }
97: //{{DECLARE_CONTROLS
98: //}}
99: }
|