1 16 package org.mortbay.html; 17 18 19 26 public class Input extends Tag 27 { 28 29 30 public final static String Text="text"; 31 public final static String Password="password"; 32 public final static String Checkbox="checkbox"; 33 public final static String Radio="radio"; 34 public final static String Submit="submit"; 35 public final static String Reset="reset"; 36 public final static String Hidden="hidden"; 37 public final static String File="file"; 38 public final static String Image="image"; 39 40 41 public Input(String type,String name) 42 { 43 super("input"); 44 attribute("type",type); 45 attribute("name",name); 46 } 47 48 49 public Input(String type,String name, String value) 50 { 51 this(type,name); 52 attribute("value",value); 53 } 54 55 56 public Input(Image image,String name, String value) 57 { 58 super("input"); 59 attribute("type","image"); 60 attribute("name",name); 61 if (value!=null) 62 attribute("value",value); 63 attribute(image.attributes()); 64 } 65 66 67 public Input(Image image,String name) 68 { 69 super("input"); 70 attribute("type","image"); 71 attribute("name",name); 72 attribute(image.attributes()); 73 } 74 75 76 public Input check() 77 { 78 attribute("checked"); 79 return this; 80 } 81 82 83 public Input setSize(int size) 84 { 85 size(size); 86 return this; 87 } 88 89 90 public Input setMaxSize(int size) 91 { 92 attribute("maxlength",size); 93 return this; 94 } 95 96 97 public Input fixed() 98 { 99 setMaxSize(size()); 100 return this; 101 } 102 } 103 | Popular Tags |