1 64 65 package com.jcorporate.expresso.services.html; 66 67 72 73 import java.io.PrintWriter ; 74 75 76 83 public class Button 84 extends HtmlElement { 85 private String fieldName = null; 86 private String fieldValue = (""); 87 private String thisClass = (this.getClass().getName() + "."); 88 89 95 public Button() 96 throws HtmlException { 97 super(); 98 } 99 100 107 public Button(String newFieldName, String newFieldValue) 108 throws HtmlException { 109 super(newFieldName); 110 111 String myName = (thisClass + "Button(String, String)"); 112 113 if (newFieldName == null) { 114 throw new HtmlException(myName + ":Field name must not be " + 115 "null for " + getName()); 116 } 117 118 fieldName = newFieldName; 119 120 if (newFieldValue == null) { 121 throw new HtmlException(myName + 122 ":Field value must not be null for " + 123 getName()); 124 } 125 126 fieldValue = newFieldValue; 127 } 128 129 136 protected void display(PrintWriter out, int depth) 137 throws HtmlException { 138 this.padWithTabs(out, depth); 139 out.print("<input"); 140 141 if (cSSClass != null) { 142 out.print(" class=\"" + cSSClass + "\""); 143 } 144 if (cSSID != null) { 145 out.print(" id=\"" + cSSID + "\""); 146 } 147 148 out.println(" type=submit name=" + fieldName + " value=\"" + 149 fieldValue + "\">"); 150 setDisplayed(); 151 } 152 153 154 } 155 156 | Popular Tags |