KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > teamkonzept > field > TKTableColShowIterator


1 /*
2  * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/field/TKTableColShowIterator.java,v 1.7 2001/02/11 14:48:15 alex Exp $
3  *
4  */

5 package com.teamkonzept.field;
6
7 import com.teamkonzept.lib.*;
8 import com.teamkonzept.web.*;
9
10 public class TKTableColShowIterator implements TKListIterator {
11     
12     final static String JavaDoc OUTER_INDEX_KEY = "outerIndex";
13     
14     TKListIterator oldIterator;
15     String JavaDoc outerList;
16     String JavaDoc innerList;
17     TKFieldTableOrientedData dataClass;
18     TKVector fields;
19     int fieldCount;
20     String JavaDoc tableScope;
21     String JavaDoc scope;
22     String JavaDoc fieldTableName;
23     //int outerIndex;
24
String JavaDoc fieldType;
25     TKBaseField rowField;
26     TKBaseField colField;
27     String JavaDoc listRowForInfo;
28     
29         
30     public TKTableColShowIterator (
31         TKFieldTableOrientedData dataClass,
32         TKVector fields,
33         TKBaseField rowField,
34         TKBaseField colField,
35         String JavaDoc scope,
36         String JavaDoc fieldTableName,
37         TKListIterator oldIterator,
38         String JavaDoc outerList,
39         String JavaDoc innerList,
40         String JavaDoc listRowForInfo
41     )
42     {
43         this.oldIterator = oldIterator;
44         this.fields = fields;
45         this.outerList = outerList;
46         this.innerList = innerList;
47         this.dataClass = dataClass;
48         this.fieldCount = fields.size();
49         this.fieldType = fieldType;
50         this.rowField = rowField;
51         this.colField = colField;
52         this.listRowForInfo = listRowForInfo;
53         //this.outerIndex = 0;
54
this.fieldTableName = fieldTableName;
55         this.scope = scope;
56         this.tableScope = scope+"."+fieldTableName;
57         
58     }
59     
60
61     public boolean apply( TKTemplate t, int i, String JavaDoc currListName )
62     {
63     
64         TKHTMLTemplate template = (TKHTMLTemplate) t;
65
66         TKVector dataVector = (TKVector) dataClass.contentData;
67
68         //---- Row mit den Infos ----//
69
if( currListName.equalsIgnoreCase(tableScope+"."+listRowForInfo)) {
70             TKVector colDataVector = dataClass.colData;
71                         
72             if( (colDataVector == null) || (i >= colDataVector.size())) return false;
73             template.set( "SCOPE", tableScope );
74     
75             TKTableShowIterator.enterEntry( template, i, colDataVector.elementAt(i), colField, tableScope+".COLS", "COL" );
76
77             return true;
78         }
79         //---- aeussere liste ----//
80
if( currListName.equalsIgnoreCase(tableScope+"."+outerList) ) {
81             if( (dataVector == null) || (i >= fields.size()) ) return false;
82             
83             //outerIndex = i;
84
t.setEnumerationContext( currListName, new Integer JavaDoc(i) );
85             
86             template.set( "SCOPE", tableScope );
87             TKTableShowIterator.enterCounter( template, i, tableScope, "ROW" );
88
89             //---- Zusatz Row ----//
90
TKVector rowDataVector = dataClass.rowData;
91             if( (rowDataVector != null) && (rowDataVector.size() > 0) ) {
92                 TKTableShowIterator.enterEntry( template, i, rowDataVector.elementAt(i), rowField, tableScope+".ROWS", "ROW" );
93                 
94             }
95             return true;
96         }
97         //---- innere liste ----//
98
else if( currListName.equalsIgnoreCase(tableScope+"."+innerList) ) {
99             if(dataVector == null) return false;
100             if( i >= dataVector.size() ) return false;
101             
102             int outerIndex = ((Integer JavaDoc)t.getEnumerationContext( tableScope+"."+outerList )).intValue();
103             TKBaseField field = (TKBaseField) fields.get(outerIndex);
104             Object JavaDoc data = ((TKVector) dataVector.elementAt(i)).elementAt(outerIndex);
105             
106             TKTableShowIterator.enterEntry( template, i, data, field, tableScope, "COL" );
107
108
109             //---- Zusatz Row ----//
110
TKVector colDataVector = dataClass.colData;
111             if(colDataVector != null) {
112                 TKTableShowIterator.enterEntry( template, i, colDataVector.elementAt(i), colField, tableScope+".COLS", "COL" );
113             }
114
115             return true;
116         }
117         else if( oldIterator != null ) {
118             return oldIterator.apply( template, i, currListName );
119         }
120         else {
121             return false;
122         }
123     }
124
125 }//end class
126

127
Popular Tags