1 23 24 package org.dbforms.taglib; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 import org.dbforms.config.ResultSetVector; 30 31 import org.dbforms.util.Util; 32 33 import org.dbforms.validation.ValidatorConstants; 34 35 import javax.servlet.jsp.JspException ; 36 37 38 39 47 public class DbInsertButtonTag extends DbBaseButtonTag 48 implements javax.servlet.jsp.tagext.TryCatchFinally { 49 private static Log logCat = LogFactory.getLog(DbInsertButtonTag.class 50 .getName()); 51 private String showAlways = "false"; 52 53 58 public void setShowAlways(String showAlways) { 59 this.showAlways = showAlways; 60 } 61 62 63 68 public String getShowAlways() { 69 return showAlways; 70 } 71 72 73 76 public void doCatch(Throwable t) throws Throwable { 77 throw t; 78 } 79 80 81 84 public void doFinally() { 85 showAlways = "false"; 86 super.doFinally(); 87 } 88 89 90 98 public int doStartTag() throws javax.servlet.jsp.JspException { 99 super.doStartTag(); 100 101 logCat.info("pos DbInsertButtonTag 1"); 102 103 if (!Util.getTrue(showAlways) 104 && !(getParentForm() 105 .isFooterReached() 106 && ResultSetVector.isNull(getParentForm().getResultSetVector()))) { 107 return SKIP_BODY; 109 } 110 111 115 logCat.info("pos DbInsertButtonTag 2"); 116 117 try { 118 logCat.info("pos DbInsertButtonTag 3"); 119 120 StringBuffer tagBuf = new StringBuffer (); 121 StringBuffer tagNameBuf = new StringBuffer (); 122 123 tagNameBuf.append("ac_insert_"); 124 tagNameBuf.append(getTable().getId()); 125 tagNameBuf.append("_"); 126 tagNameBuf.append(getParentForm().getPositionPathCore()); 127 128 tagNameBuf.append("_"); 130 tagNameBuf.append(Integer.toString(getUniqueID())); 131 132 String tagName = tagNameBuf.toString(); 133 134 if (getFollowUp() != null) { 135 tagBuf.append(getDataTag(tagName, "fu", getFollowUp())); 136 } 137 138 if (getFollowUpOnError() != null) { 139 tagBuf.append(getDataTag(tagName, "fue", getFollowUpOnError())); 140 } 141 142 tagBuf.append(getButtonBegin()); 144 tagBuf.append(" name=\""); 145 tagBuf.append(tagName); 146 tagBuf.append(getButtonEnd()); 147 148 pageContext.getOut() 149 .write(tagBuf.toString()); 150 } catch (java.io.IOException ioe) { 151 throw new JspException ("IO Error: " + ioe.getMessage()); 152 } 153 154 if (getChoosenFlavor() == FLAVOR_MODERN) { 155 return EVAL_BODY_BUFFERED; 156 } else { 157 return SKIP_BODY; 158 } 159 } 160 161 162 168 protected String JsValidation() { 169 return (ValidatorConstants.JS_CANCEL_VALIDATION + "=true;" 170 + ValidatorConstants.JS_UPDATE_VALIDATION_MODE + "=false;"); 171 } 172 } 173 | Popular Tags |