1 package de.webman.generator; 2 3 import com.teamkonzept.web.*; 4 import com.teamkonzept.lib.*; 5 6 10 public class GenReferenceIterator implements TKListIterator 11 { 12 13 16 private GeneratorContext context; 17 18 private TKVector urlEntries; 19 private TKVector nodeEntries; 20 private TKVector docEntries; 21 private int entryCount; 22 private String listName; 23 private TKListIterator oldIterator; 24 25 private GenNode anchor; 26 private SiteReference ref; 27 28 private String tmplBase; 29 private String ownUrl; 30 private String rootDir; 31 private boolean isPreview; 32 33 public GenReferenceIterator( 34 GeneratorContext context, 35 GenNode anchor, 36 SiteReference ref, 37 TKVector urlEntries, 38 TKVector nodeEntries, 39 TKVector docEntries, 40 String tmplBase, 41 String listName, 42 String ownUrl, 43 String rootDir, 44 boolean isPreview, 45 TKListIterator oldIterator ) 46 { 47 this.context = context != null ? context : GeneratorContext.setup (); 48 49 this.urlEntries = urlEntries; 50 this.nodeEntries = nodeEntries; 51 this.docEntries = docEntries; 52 this.listName = listName; 53 this.oldIterator = oldIterator; 54 this.entryCount = urlEntries.size(); 55 this.anchor = anchor; 56 this.ref = ref; 57 this.ownUrl = ownUrl; 58 this.rootDir = rootDir; 59 this.isPreview = isPreview; 60 this.tmplBase = tmplBase; 61 } 62 63 public boolean apply( TKTemplate t, int i, String currListName ) 64 { 65 if( currListName.equalsIgnoreCase(listName) ) { 66 if( i >= entryCount ) return false; 67 t.set( "SCOPE", currListName ); 69 t.set( currListName+".IDX", String.valueOf(i+1) ); 70 if( i % 2 == 1 ) t.set( currListName+".ODD", Boolean.TRUE ); 71 context.genDocuments.fillReferenceIntoTemplate( 72 t, 73 null, 74 (String )urlEntries.get(i), 75 (GenNode)(nodeEntries == null?null:nodeEntries.get(i)), 76 anchor, 77 (GenDocument)(docEntries==null?null:docEntries.get(i)), 78 listName, 79 ref, tmplBase, ownUrl, rootDir, isPreview 80 ); 81 return true; 82 } 83 else if( oldIterator != null ) { 84 return oldIterator.apply( t, i, currListName ); 85 } 86 return false; 87 } 88 } 89
| Popular Tags
|