001: /*
002: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/field/TKTableRowShowIterator.java,v 1.7 2001/02/11 14:48:15 alex Exp $
003: *
004: */
005: package com.teamkonzept.field;
006:
007: import com.teamkonzept.lib.*;
008: import com.teamkonzept.web.*;
009:
010: public class TKTableRowShowIterator implements TKListIterator {
011:
012: TKListIterator oldIterator;
013: String outerList;
014: String innerList;
015: TKFieldTableOrientedData dataClass;
016: TKVector fields;
017: int fieldCount;
018: String tableScope;
019: String scope;
020: String fieldTableName;
021: //int outerIndex;
022: String fieldType;
023: TKBaseField rowField;
024: TKBaseField colField;
025: String listRowForInfo;
026:
027: public TKTableRowShowIterator(TKFieldTableOrientedData dataClass,
028: TKVector fields, TKBaseField rowField,
029: TKBaseField colField, String scope, String fieldTableName,
030: TKListIterator oldIterator, String outerList,
031: String innerList, String listRowForInfo) {
032: this .oldIterator = oldIterator;
033: this .fields = fields;
034: this .outerList = outerList;
035: this .innerList = innerList;
036: this .dataClass = dataClass;
037: this .fieldCount = fields.size();
038: this .fieldType = fieldType;
039: this .rowField = rowField;
040: this .colField = colField;
041: this .listRowForInfo = listRowForInfo;
042: //this.outerIndex = 0;
043: this .fieldTableName = fieldTableName;
044: this .scope = scope;
045: this .tableScope = scope + "." + fieldTableName;
046:
047: }
048:
049: public boolean apply(TKTemplate t, int i, String currListName) {
050:
051: TKHTMLTemplate template = (TKHTMLTemplate) t;
052:
053: TKVector dataVector = (TKVector) dataClass.contentData;
054:
055: //---- Row mit den Infos ----//
056: if (currListName.equalsIgnoreCase(tableScope + "."
057: + listRowForInfo)) {
058: TKVector colDataVector = dataClass.colData;
059:
060: if ((colDataVector == null) || (i >= colDataVector.size()))
061: return false;
062: template.set("SCOPE", tableScope);
063:
064: TKTableShowIterator.enterEntry(template, i, colDataVector
065: .elementAt(i), colField, tableScope + ".COLS",
066: "COL");
067: return true;
068: }
069: //---- aeussere liste ----//
070: if (currListName.equalsIgnoreCase(tableScope + "." + outerList)) {
071: if ((dataVector == null) || (i >= dataVector.size()))
072: return false;
073: template
074: .setEnumerationContext(currListName, new Integer(i));
075: //outerIndex = i;
076: template.set("SCOPE", tableScope);
077:
078: TKTableShowIterator.enterCounter(template, i, tableScope,
079: "ROW");
080:
081: //---- Zusatz Row ----//
082: TKVector rowDataVector = dataClass.rowData;
083: if ((rowDataVector != null) && (rowDataVector.size() > 0)) {
084:
085: TKTableShowIterator.enterEntry(template, i,
086: rowDataVector.elementAt(i), rowField,
087: tableScope + ".ROWS", "ROW");
088: }
089: return true;
090: }
091: //---- innere liste ----//
092: else if (currListName.equalsIgnoreCase(tableScope + "."
093: + innerList)) {
094: if (dataVector == null)
095: return false;
096: int outerIndex = ((Integer) template
097: .getEnumerationContext(tableScope + "." + outerList))
098: .intValue();
099: TKVector innerVector = (TKVector) dataVector
100: .get(outerIndex);
101: if (i >= innerVector.size())
102: return false;
103:
104: TKBaseField field = (TKBaseField) fields.get(i);
105: Object data = innerVector.get(i);
106:
107: TKTableShowIterator.enterEntry(template, i, data, field,
108: tableScope, "COL");
109:
110: //---- Zusatz Row ----//
111: TKVector colDataVector = dataClass.colData;
112: if (colDataVector != null) {
113: TKTableShowIterator.enterEntry(template, i,
114: colDataVector.elementAt(i), colField,
115: tableScope + ".COLS", "COL");
116: }
117:
118: return true;
119: } else if (oldIterator != null) {
120: return oldIterator.apply(template, i, currListName);
121: } else {
122: return false;
123: }
124: }
125:
126: //{{DECLARE_CONTROLS
127: //}}
128: }//end class
|