1 15 package org.apache.tapestry.vlib; 16 17 import org.apache.tapestry.IMarkupWriter; 18 import org.apache.tapestry.IRequestCycle; 19 import org.apache.tapestry.form.IFormComponent; 20 import org.apache.tapestry.valid.IValidator; 21 import org.apache.tapestry.valid.ValidationDelegate; 22 23 32 33 public class VirtualLibraryDelegate extends ValidationDelegate 34 { 35 public void writeLabelPrefix( 36 IFormComponent component, 37 IMarkupWriter writer, 38 IRequestCycle cycle) 39 { 40 if (isInError(component)) 41 { 42 writer.begin("span"); 43 writer.attribute("class", "invalid-field"); 44 } 45 } 46 47 public void writeLabelSuffix( 48 IFormComponent component, 49 IMarkupWriter writer, 50 IRequestCycle cycle) 51 { 52 if (isInError(component)) 53 writer.end(); 54 } 55 56 public void writeAttributes( 57 IMarkupWriter writer, 58 IRequestCycle cycle, 59 IFormComponent component, 60 IValidator validator) 61 { 62 if (isInError()) 63 writer.attribute("class", "error"); 64 } 65 66 67 public void writeSuffix( 68 IMarkupWriter writer, 69 IRequestCycle cycle, 70 IFormComponent component, 71 IValidator validator) 72 { 73 } 74 75 } | Popular Tags |