1 17 18 package org.objectweb.jac.aspects.gui.web.html; 19 20 import org.mortbay.util.UrlEncoded; 21 22 public class Button extends Block 23 { 24 25 public final static String BUTTON="button"; 26 public final static String SUBMIT="submit"; 27 public final static String RESET="reset"; 28 29 public Button(String type,String name) { 30 super("button"); 31 attribute("type",type); 32 attribute("name",name); 33 } 34 35 public Button(String type,String name, String value) { 36 this(type,name); 37 attribute("value",value); 38 } 39 40 public Button check() { 41 attribute("checked"); 42 return this; 43 } 44 45 public Button setSize(int size) { 46 size(size); 47 return this; 48 } 49 50 public Button setMaxSize(int size) { 51 attribute("maxlength",size); 52 return this; 53 } 54 55 public Button fixed() { 56 setMaxSize(size()); 57 return this; 58 } 59 60 public void encodeAttribute(String attribute) { 61 attributeMap.put(attributeMap, 62 UrlEncoded.encodeString((String )attributeMap.get(attribute))); 63 } 64 } 65 | Popular Tags |