1 23 24 package org.dbforms.taglib; 25 26 import org.dbforms.config.ResultSetVector; 27 28 import org.dbforms.event.eventtype.EventType; 29 30 import org.dbforms.util.Util; 31 32 import javax.servlet.jsp.JspException ; 33 34 35 36 41 public class DbNavNewButtonTag extends DbBaseButtonTag 42 implements javax.servlet.jsp.tagext.TryCatchFinally { 43 private String destTable; 44 45 46 private String showAlwaysInFooter = "true"; 47 48 53 public void setDestTable(String destTable) { 54 this.destTable = destTable; 55 } 56 57 58 63 public String getDestTable() { 64 return destTable; 65 } 66 67 68 73 public void setShowAlwaysInFooter(String showAlwaysInFooter) { 74 this.showAlwaysInFooter = showAlwaysInFooter; 75 } 76 77 78 83 public String getShowAlwaysInFooter() { 84 return this.showAlwaysInFooter; 85 } 86 87 88 91 public void doCatch(Throwable t) throws Throwable { 92 throw t; 93 } 94 95 96 99 public void doFinally() { 100 destTable = null; 101 showAlwaysInFooter = "true"; 102 super.doFinally(); 103 } 104 105 106 114 public int doStartTag() throws javax.servlet.jsp.JspException { 115 super.doStartTag(); 116 117 if (getParentForm() 118 .isFooterReached() 119 && ResultSetVector.isNull(getParentForm().getResultSetVector()) 120 && !Util.getTrue(showAlwaysInFooter)) { 121 return SKIP_BODY; 123 } 124 125 try { 126 StringBuffer tagBuf = new StringBuffer (); 127 128 int tableId = ((destTable != null) && (destTable.length() != 0)) 131 ? getConfig() 132 .getTableByName(destTable) 133 .getId() 134 : getTable() 135 .getId(); 136 137 String tagName = EventType.EVENT_NAVIGATION_TRANSFER_NEW + tableId 138 + "_" + Integer.toString(getUniqueID()); 139 140 if (getFollowUp() != null) { 141 tagBuf.append(getDataTag(tagName, "fu", getFollowUp())); 142 } 143 144 if (getFollowUpOnError() != null) { 145 tagBuf.append(getDataTag(tagName, "fue", getFollowUpOnError())); 146 } 147 148 tagBuf.append(getButtonBegin()); 149 tagBuf.append(" name=\""); 150 tagBuf.append(tagName); 151 tagBuf.append(getButtonEnd()); 152 153 pageContext.getOut() 154 .write(tagBuf.toString()); 155 } catch (java.io.IOException ioe) { 156 throw new JspException ("IO Error: " + ioe.getMessage()); 157 } 158 159 if (getChoosenFlavor() == FLAVOR_MODERN) { 160 return EVAL_BODY_BUFFERED; 161 } else { 162 return SKIP_BODY; 163 } 164 } 165 } 166 | Popular Tags |