1 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 OUTER_INDEX_KEY = "outerIndex"; 13 14 TKListIterator oldIterator; 15 String outerList; 16 String innerList; 17 TKFieldTableOrientedData dataClass; 18 TKVector fields; 19 int fieldCount; 20 String tableScope; 21 String scope; 22 String fieldTableName; 23 String fieldType; 25 TKBaseField rowField; 26 TKBaseField colField; 27 String listRowForInfo; 28 29 30 public TKTableColShowIterator ( 31 TKFieldTableOrientedData dataClass, 32 TKVector fields, 33 TKBaseField rowField, 34 TKBaseField colField, 35 String scope, 36 String fieldTableName, 37 TKListIterator oldIterator, 38 String outerList, 39 String innerList, 40 String 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.fieldTableName = fieldTableName; 55 this.scope = scope; 56 this.tableScope = scope+"."+fieldTableName; 57 58 } 59 60 61 public boolean apply( TKTemplate t, int i, String currListName ) 62 { 63 64 TKHTMLTemplate template = (TKHTMLTemplate) t; 65 66 TKVector dataVector = (TKVector) dataClass.contentData; 67 68 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 if( currListName.equalsIgnoreCase(tableScope+"."+outerList) ) { 81 if( (dataVector == null) || (i >= fields.size()) ) return false; 82 83 t.setEnumerationContext( currListName, new Integer (i) ); 85 86 template.set( "SCOPE", tableScope ); 87 TKTableShowIterator.enterCounter( template, i, tableScope, "ROW" ); 88 89 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 else if( currListName.equalsIgnoreCase(tableScope+"."+innerList) ) { 99 if(dataVector == null) return false; 100 if( i >= dataVector.size() ) return false; 101 102 int outerIndex = ((Integer )t.getEnumerationContext( tableScope+"."+outerList )).intValue(); 103 TKBaseField field = (TKBaseField) fields.get(outerIndex); 104 Object data = ((TKVector) dataVector.elementAt(i)).elementAt(outerIndex); 105 106 TKTableShowIterator.enterEntry( template, i, data, field, tableScope, "COL" ); 107 108 109 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 } 127 | Popular Tags |