001: /*
002: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/field/TKFieldTableColOrientedIterator.java,v 1.6 2000/06/01 15:02:53 alex Exp $
003: *
004: */
005: package com.teamkonzept.field;
006:
007: import com.teamkonzept.lib.*;
008: import com.teamkonzept.web.*;
009:
010: public class TKFieldTableColOrientedIterator implements TKListIterator {
011:
012: TKListIterator oldIterator;
013: String outerList;
014: String innerList;
015: TKFieldTableOrientedData dataClass;
016: TKVector fields;
017: int fieldCount;
018: String prefix;
019: int outerIndex;
020: String fieldType;
021: TKBaseField rowField;
022: TKBaseField colField;
023: String listRowForInfo;
024:
025: public TKFieldTableColOrientedIterator(
026: TKFieldTableOrientedData dataClass, TKVector fields,
027: TKBaseField rowField, TKBaseField colField, String prefix,
028: TKListIterator oldIterator, String outerList,
029: String innerList, String listRowForInfo, String fieldType
030:
031: ) {
032: this .oldIterator = oldIterator;
033: this .fields = fields;
034: this .outerList = outerList;
035: this .innerList = innerList;
036: this .dataClass = dataClass;
037: this .prefix = prefix;
038: this .fieldCount = fields.size();
039: this .fieldType = fieldType;
040: this .rowField = rowField;
041: this .colField = colField;
042: this .listRowForInfo = listRowForInfo;
043: this .outerIndex = 0;
044:
045: }
046:
047: public boolean apply(TKTemplate t, int i, String currListName) {
048:
049: TKHTMLTemplate template = (TKHTMLTemplate) t;
050:
051: TKVector dataVector = (TKVector) dataClass.contentData;
052:
053: //---- Row mit den Infos ----//
054: if (currListName.equalsIgnoreCase(listRowForInfo)) {
055: TKVector colDataVector = dataClass.colData;
056: if ((colDataVector == null) || (i >= colDataVector.size()))
057: return false;
058: colField.fillIntoTemplate(template, colDataVector
059: .elementAt(i), prefix
060: + TKFieldTableRowOriented.PRE_COLS + "." + i + ".");
061: return true;
062: }
063:
064: //---- aeussere liste ----//
065: else if (currListName.equalsIgnoreCase(outerList)) {
066: if ((dataVector == null) || (i >= fields.size()))
067: return false;
068: outerIndex = i;
069:
070: TKVector rowDataVector = dataClass.rowData;
071: if ((rowDataVector != null) && (rowDataVector.size() > 0)) {
072: rowField.fillIntoTemplate(template, rowDataVector
073: .elementAt(outerIndex), prefix
074: + TKFieldTableRowOriented.PRE_ROWS + "."
075: + outerIndex + ".");
076: }
077:
078: return true;
079: }
080: //---- innere liste ----//
081: else if (currListName.equalsIgnoreCase(innerList)) {
082: if (dataVector == null)
083: return false;
084: //TKVector innerVector = (TKVector) dataVector.get(outerIndex);
085: if (i >= dataVector.size())
086: return false;
087: t.set("PREFIX_IDX", prefix + i + ".");
088: TKBaseField field = (TKBaseField) fields.get(outerIndex);
089: field.fillIntoTemplate(template, ((TKVector) dataVector
090: .elementAt(i)).elementAt(outerIndex), prefix
091: + outerIndex + "." + i + ".");
092: return true;
093: } else if (oldIterator != null) {
094: return oldIterator.apply(template, i, currListName);
095: } else {
096: return false;
097: }
098: }
099:
100: //{{DECLARE_CONTROLS
101: //}}
102: }//end class
|