1 5 14 package com.teamkonzept.lib.templates; 15 16 import java.io.*; 17 18 import com.oroinc.text.regex.*; 19 20 import com.teamkonzept.lib.*; 21 22 27 public class TKNotTag extends TKLabelTag { 28 public TKTemplateSyntax notText; 29 static final int TAG_TYPE = TKCaseTag.TAG_TYPE+1; 30 31 40 public TKNotTag( TKTemplateSyntax parent, String def, PatternMatcherInput matcherInput, boolean hasSubTags ) throws TKTemplateSyntaxException 41 { 42 super( parent, def, hasSubTags ); 43 try { 44 notText = parent.newChild( matcherInput, parent.getSource() ); 45 } 46 catch (ArrayIndexOutOfBoundsException e) { throw new TKTemplateSyntaxException(parent.getSource(),"NOEND","NOT", def); 48 } 49 checkError(notText,"NOT", def); 50 } 51 52 60 public String apply( TKTemplateData td ) throws TKTemplateSyntaxException 61 { 62 String value = expandVariable (getLabel( td ),td,null); 63 64 if( value == null || value.length() == 0 ) { 65 return notText.apply( td ); 66 } 67 return null; 68 } 69 70 78 public void apply(TKTemplateData td, Writer writer) 79 throws TKTemplateSyntaxException, IOException 80 { 81 String value = expandVariable (getLabel( td ),td,null); 82 83 if( value == null || value.length() == 0 ) { 84 notText.apply( td, writer ); 85 } 86 } 87 } 88 89 | Popular Tags |