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