00001 public class TextBox extends Widget 00002 { 00003 public int rows, cols; 00004 public String text; 00005 00006 public TextBox(int rows, int cols, String prefix, Form form) 00007 { 00008 super(prefix, form); 00009 this.rows = rows; 00010 this.cols = cols; 00011 } 00012 00013 public void loadValues() 00014 { 00015 text = loadAttribute(); 00016 } 00017 00018 public void display(boolean hidden) 00019 { 00020 display(hidden, ""); 00021 } 00022 00023 public void display(boolean hidden, String params) 00024 { 00025 String t = text == null ? "" : text; 00026 if (hidden) 00027 p("<input type=hidden name=" + prefix + " value=\"" + htmlencode(t) 00028 + "\"" + params+ ">"); 00029 else if (rows == 0) 00030 p("<input type=textbox name=" + prefix + " value=\"" + htmlencode(t) 00031 + "\" size=" + cols + params+ ">"); 00032 else 00033 p("<textarea name=" + prefix + " rows=" + rows + " cols=" + cols 00034 + params + ">" + t + "</textarea>"); 00035 } 00036 };