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