1 5 package com.teamkonzept.field; 6 7 import com.teamkonzept.lib.*; 8 import com.teamkonzept.web.*; 9 10 public class TKListShowIterator implements TKListIterator { 11 12 TKListIterator oldIterator; 13 TKVector dataVector; 14 TKBaseField field; 15 int entryCount; 16 String scope; 17 String fieldListName; 18 String listTagName; 19 20 public TKListShowIterator( 21 TKVector dataVector, 22 TKBaseField field, 23 String scope, 24 String fieldListName, 25 TKListIterator oldIterator 26 ) 27 { 28 this.oldIterator = oldIterator; 29 this.field = field; 30 this.fieldListName = fieldListName; 31 this.dataVector = dataVector; 32 this.scope = scope; 33 this.entryCount = dataVector.size(); 34 this.listTagName = scope+"."+fieldListName; 35 } 36 37 public boolean apply( TKTemplate t, int i, String currListName ) 38 { 39 TKHTMLTemplate template = (TKHTMLTemplate) t; 40 if( currListName.equalsIgnoreCase( listTagName ) ) { 41 if( i >= entryCount ) return false; 42 Object data = dataVector.get( i ); 43 String subScope = listTagName; 44 template.set( "SCOPE", subScope ); 45 template.set( subScope+".IDX", String.valueOf(i+1) ); 46 field.fillIntoPresentation( template, data, subScope ); 47 return true; 48 } 49 else if( oldIterator != null ) { 50 return oldIterator.apply( template, i, currListName ); 51 } 52 else { 53 return false; 54 } 55 } 56 } 57 58
| Popular Tags
|