1 23 24 package org.dbforms.taglib; 25 26 import org.dbforms.config.ResultSetVector; 27 28 import org.dbforms.util.Util; 29 30 import org.dbforms.validation.ValidatorConstants; 31 32 import javax.servlet.jsp.JspException ; 33 34 35 36 44 public class DbUpdateButtonTag extends DbBaseButtonTag 45 implements javax.servlet.jsp.tagext.TryCatchFinally { 46 private String associatedRadio; 47 private String showAlways = "false"; 48 49 54 public void setAssociatedRadio(String associatedRadio) { 55 this.associatedRadio = associatedRadio; 56 } 57 58 59 64 public String getAssociatedRadio() { 65 return associatedRadio; 66 } 67 68 69 74 public void setShowAlways(String string) { 75 showAlways = string; 76 } 77 78 79 84 public String getShowAlways() { 85 return showAlways; 86 } 87 88 89 92 public void doCatch(Throwable t) throws Throwable { 93 throw t; 94 } 95 96 97 100 public void doFinally() { 101 associatedRadio = null; 102 showAlways = "false"; 103 super.doFinally(); 104 } 105 106 107 115 public int doStartTag() throws javax.servlet.jsp.JspException { 116 super.doStartTag(); 117 118 if (!Util.getTrue(showAlways) 119 && getParentForm() 120 .isFooterReached() 121 && ResultSetVector.isNull(getParentForm().getResultSetVector())) { 122 return SKIP_BODY; 124 } 125 126 try { 127 StringBuffer tagNameBuf = new StringBuffer ("ac_update"); 129 130 if (associatedRadio != null) { 131 tagNameBuf.append("ar"); 132 } 133 134 tagNameBuf.append("_"); 135 tagNameBuf.append(getTable().getId()); 136 137 if (associatedRadio == null) { 138 tagNameBuf.append("_"); 139 tagNameBuf.append(getParentForm().getPositionPath()); 140 } 141 142 tagNameBuf.append("_"); 144 tagNameBuf.append(Integer.toString(getUniqueID())); 145 146 String tagName = tagNameBuf.toString(); 147 148 StringBuffer tagBuf = new StringBuffer (); 150 151 if (associatedRadio != null) { 152 tagBuf.append(getDataTag(tagName, "arname", associatedRadio)); 153 } 154 155 if (getFollowUp() != null) { 156 tagBuf.append(getDataTag(tagName, "fu", getFollowUp())); 157 } 158 159 if (getFollowUpOnError() != null) { 160 tagBuf.append(getDataTag(tagName, "fue", getFollowUpOnError())); 161 } 162 163 tagBuf.append(getButtonBegin()); 164 tagBuf.append(" name=\""); 165 tagBuf.append(tagName); 166 tagBuf.append(getButtonEnd()); 167 168 pageContext.getOut() 169 .write(tagBuf.toString()); 170 } catch (java.io.IOException ioe) { 171 throw new JspException ("IO Error: " + ioe.getMessage()); 172 } 173 174 if (getChoosenFlavor() == FLAVOR_MODERN) { 175 return EVAL_BODY_BUFFERED; 176 } else { 177 return SKIP_BODY; 178 } 179 } 180 181 182 188 protected String JsValidation() { 189 return (ValidatorConstants.JS_CANCEL_VALIDATION + "=true;" 190 + ValidatorConstants.JS_UPDATE_VALIDATION_MODE + "=true;"); 191 } 192 } 193 | Popular Tags |