1 15 package org.apache.tapestry.form; 16 17 import org.apache.tapestry.IBinding; 18 import org.apache.tapestry.IMarkupWriter; 19 import org.apache.tapestry.IRequestCycle; 20 21 32 public abstract class TextField extends AbstractValidatableField 33 { 34 public abstract boolean isHidden(); 35 36 public abstract Object getValue(); 37 38 public abstract void setValue(Object value); 39 40 43 public void render(IMarkupWriter writer, IRequestCycle cycle, String value) 44 { 45 renderDelegatePrefix(writer, cycle); 46 47 writer.beginEmpty("input"); 48 49 writer.attribute("type", isHidden() ? "password" : "text"); 50 51 writer.attribute("name", getName()); 52 53 if (isDisabled()) 54 writer.attribute("disabled", "disabled"); 55 56 if (value != null) 57 writer.attribute("value", value); 58 59 renderIdAttribute(writer, cycle); 60 61 renderDelegateAttributes(writer, cycle); 62 63 renderContributions(writer, cycle); 64 65 renderInformalParameters(writer, cycle); 66 67 writer.closeTag(); 68 69 renderDelegateSuffix(writer, cycle); 70 } 71 72 75 public void writeValue(Object value) 76 { 77 setValue(value); 78 } 79 80 83 public Object readValue() 84 { 85 return getValue(); 86 } 87 } | Popular Tags |