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