1 package de.webman.generator; 2 3 import com.teamkonzept.web.*; 4 import com.teamkonzept.lib.*; 5 6 10 public class GenContentIterator implements TKListIterator 11 { 12 13 16 private GeneratorContext context; 17 18 private TKVector entries; 19 private int entryCount; 20 21 24 private String listName; 25 private TKListIterator oldIterator; 26 private boolean onlyStructureContents; 27 private boolean fromReference; 28 29 30 private boolean onlyName; 31 32 public GenContentIterator( 33 GeneratorContext context, 34 TKVector entries, 35 String listName, 36 TKListIterator oldIterator, 37 boolean onlyStructureContents, boolean _fromReference, boolean _onlyName ) 38 { 39 this.context = context != null ? context : GeneratorContext.setup (); 40 41 this.entries = entries; 42 this.listName = listName; 43 this.oldIterator = oldIterator; 44 this.entryCount = entries.size(); 45 this.onlyStructureContents = onlyStructureContents; 46 fromReference = _fromReference; 47 onlyName = _onlyName; 48 } 49 50 51 60 public boolean apply( TKTemplate t, int i, String currListName ) 61 { 62 if( currListName.equalsIgnoreCase(listName) ) 63 { 64 if( i >= entryCount ) return false; 65 SiteContent content = ((SiteContent)entries.get(i)); 66 67 if (content != null) 68 content.fillNameIntoTemplate( (TKHTMLTemplate)t, listName ); 69 context.push(); 73 74 if (!ReferenceCycleDetector.isCycle(new Integer (content.getInstanceId())) && ! onlyName) 75 { 76 if ((content != null) && (!onlyStructureContents || content.isStructureContent())) 77 { 78 t.set( "SCOPE", currListName ); 79 t.set( currListName+".IDX", String.valueOf(i+1) ); 80 if( i % 2 == 1 ) t.set( currListName+".ODD", Boolean.TRUE ); 81 content.fillIntoTemplate( (TKHTMLTemplate )t, listName ); 82 } 83 } 84 85 context.pop(); 87 88 return true; 89 } 90 else if( oldIterator != null ) 91 { 92 return oldIterator.apply( t, i, currListName ); 93 } 94 return false; 95 } 96 } 97
| Popular Tags
|