1 23 24 package org.dbforms.taglib; 25 26 import org.dbforms.event.eventtype.EventType; 27 28 import org.dbforms.util.Util; 29 30 import javax.servlet.jsp.JspException ; 31 32 33 34 41 public class DbGotoButtonTag extends DbBaseButtonTag 42 implements javax.servlet.jsp.tagext.TryCatchFinally { 43 private String childField; 44 private String destPos; 45 private String destTable; 46 private String destination; 47 private String keyToDestPos; 48 private String keyToKeyToDestPos; 49 private String parentField; 50 private String singleRow = "false"; 51 52 57 public void setChildField(String string) { 58 childField = string; 59 } 60 61 62 67 public String getChildField() { 68 return childField; 69 } 70 71 72 77 public void setDestPos(String destPos) { 78 this.destPos = destPos; 79 } 80 81 82 87 public String getDestPos() { 88 return destPos; 89 } 90 91 92 97 public void setDestTable(String destTable) { 98 this.destTable = destTable; 99 } 100 101 102 107 public String getDestTable() { 108 return destTable; 109 } 110 111 112 117 public void setDestination(String destination) { 118 this.destination = destination; 119 } 120 121 122 127 public String getDestination() { 128 return destination; 129 } 130 131 132 137 public void setKeyToDestPos(String keyToDestPos) { 138 this.keyToDestPos = keyToDestPos; 139 } 140 141 142 147 public String getKeyToDestPos() { 148 return keyToDestPos; 149 } 150 151 152 157 public void setKeyToKeyToDestPos(String keyToKeyToDestPos) { 158 this.keyToKeyToDestPos = keyToKeyToDestPos; 159 } 160 161 162 167 public String getKeyToKeyToDestPos() { 168 return keyToKeyToDestPos; 169 } 170 171 172 177 public void setParentField(String string) { 178 parentField = string; 179 } 180 181 182 187 public String getParentField() { 188 return parentField; 189 } 190 191 192 197 public void setSingleRow(String string) { 198 singleRow = string; 199 } 200 201 202 207 public String getSingleRow() { 208 return singleRow; 209 } 210 211 212 215 public void doCatch(Throwable t) throws Throwable { 216 throw t; 217 } 218 219 220 223 public void doFinally() { 224 destination = null; 225 destTable = null; 226 destPos = null; 227 keyToDestPos = null; 228 keyToKeyToDestPos = null; 229 singleRow = "false"; 230 super.doFinally(); 231 } 232 233 234 242 public int doStartTag() throws javax.servlet.jsp.JspException { 243 super.doStartTag(); 244 245 try { 246 String tagName = EventType.EVENT_NAVIGATION_TRANSFER_GOTO 247 + ((getTable() != null) ? getTable() 248 .getId() 249 : (-1)) + "_" 250 + Integer.toString(getUniqueID()); 251 252 StringBuffer tagBuf = new StringBuffer (); 253 254 if (destination != null) { 258 tagBuf.append(getDataTag(tagName, "fu", destination)); 259 } 260 261 if (destTable != null) { 262 tagBuf.append(getDataTag(tagName, "destTable", destTable)); 263 } 264 265 tagBuf.append(getDataTag(tagName, "destPos", destPos)); 269 tagBuf.append(getDataTag(tagName, "keyToDestPos", 270 Util.encode(keyToDestPos, 271 pageContext.getRequest().getCharacterEncoding()))); 272 tagBuf.append(getDataTag(tagName, "keyToKeyToDestPos", 273 Util.encode(keyToKeyToDestPos, 274 pageContext.getRequest().getCharacterEncoding()))); 275 276 if ((getConfig() 278 .getTableByName(destTable) != getTable()) 279 && (getParentForm() 280 .getTable() != null)) { 281 tagBuf.append(getDataTag(tagName, "srcTable", 282 getParentForm().getTable().getName())); 283 tagBuf.append(getDataTag(tagName, "childField", 284 Util.encode(childField, 285 pageContext.getRequest().getCharacterEncoding()))); 286 tagBuf.append(getDataTag(tagName, "parentField", 287 Util.encode(parentField, 288 pageContext.getRequest().getCharacterEncoding()))); 289 } 290 291 tagBuf.append(getDataTag(tagName, "singleRow", getSingleRow())); 292 293 tagBuf.append(getButtonBegin()); 294 tagBuf.append(" name=\""); 295 tagBuf.append(tagName); 296 tagBuf.append(getButtonEnd()); 297 298 pageContext.getOut() 299 .write(tagBuf.toString()); 300 } catch (java.io.IOException ioe) { 301 throw new JspException ("IO Error: " + ioe.getMessage()); 302 } 303 304 if (getChoosenFlavor() == FLAVOR_MODERN) { 305 return EVAL_BODY_BUFFERED; 306 } else { 307 return SKIP_BODY; 308 } 309 } 310 } 311 | Popular Tags |