1 5 14 package com.teamkonzept.lib.templates; 15 16 import java.io.*; 17 18 import com.teamkonzept.lib.*; 19 20 26 public class TKExistsTag extends TKLabelTag { 27 static final int TAG_TYPE = TKWhileTag.TAG_TYPE+1; 28 static final String TRUE = "1"; 29 static final String FALSE = "0"; 30 31 public TKExistsTag( TKTemplateSyntax parent, String name, boolean hasSubTags ) throws TKTemplateSyntaxException 32 { 33 super( parent, name, hasSubTags ); 34 } 35 36 public String apply( TKTemplateData td ) throws TKTemplateSyntaxException 37 { 38 String location = getRealLabel( td ); 39 String parentLocation = ( parent == null ? "" : parent.getSource() ); 40 41 return TKTemplateCache.exists( location, parentLocation ) ? TRUE : FALSE; 42 } 43 44 public void apply(TKTemplateData td, Writer writer) 45 throws TKTemplateSyntaxException, IOException 46 { 47 String location = getRealLabel( td ); 48 String parentLocation = ( parent == null ? "" : parent.getSource() ); 49 50 writer.write(TKTemplateCache.exists( location, parentLocation ) ? TRUE : FALSE); 51 } 52 53 54 } 56 | Popular Tags |