KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbforms > taglib > DbNavCopyButtonTag


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbNavCopyButtonTag.java,v 1.15 2004/10/20 10:52:01 hkollmann Exp $
3  * $Revision: 1.15 $
4  * $Date: 2004/10/20 10:52:01 $
5  *
6  * DbForms - a Rapid Application Development Framework
7  * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */

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 JavaDoc;
33
34
35
36 /**
37  * this tag renders an "copy"-button.
38  *
39  * @author Stefano Borghi
40  * @version $Revision: 1.15 $
41  */

42 public class DbNavCopyButtonTag extends DbBaseButtonTag
43    implements javax.servlet.jsp.tagext.TryCatchFinally JavaDoc {
44    /** Holds value of property showAlwaysInFooter. */
45    private String JavaDoc showAlwaysInFooter = "true";
46
47    /**
48     * DOCUMENT ME!
49     *
50     * @param string
51     */

52    public void setShowAlwaysInFooter(String JavaDoc string) {
53       showAlwaysInFooter = string;
54    }
55
56
57    /**
58     * DOCUMENT ME!
59     *
60     * @return
61     */

62    public String JavaDoc getShowAlwaysInFooter() {
63       return showAlwaysInFooter;
64    }
65
66
67    /**
68     * @see javax.servlet.jsp.tagext.TryCatchFinally#doCatch(java.lang.Throwable)
69     */

70    public void doCatch(Throwable JavaDoc t) throws Throwable JavaDoc {
71       throw t;
72    }
73
74
75    /**
76     * DOCUMENT ME!
77     */

78    public void doFinally() {
79       showAlwaysInFooter = "true";
80       super.doFinally();
81    }
82
83
84    /**
85     * DOCUMENT ME!
86     *
87     * @return DOCUMENT ME!
88     *
89     * @throws javax.servlet.jsp.JspException DOCUMENT ME!
90     * @throws JspException DOCUMENT ME!
91     */

92    public int doStartTag() throws javax.servlet.jsp.JspException JavaDoc {
93       super.doStartTag();
94
95       if (getParentForm()
96                    .isFooterReached()
97                 && ResultSetVector.isNull(getParentForm().getResultSetVector())
98                 && !Util.getTrue(showAlwaysInFooter)) {
99          // 20030521 HKK: Bug fixing, thanks to Michael Slack!
100
return SKIP_BODY;
101       }
102
103       try {
104          StringBuffer JavaDoc tagBuf = new StringBuffer JavaDoc();
105          String JavaDoc tagName = EventType.EVENT_NAVIGATION_TRANSFER_COPY
106                                 + getTable()
107                                      .getId() + "_"
108                                 + Integer.toString(getUniqueID());
109
110          if (getFollowUp() != null) {
111             tagBuf.append(getDataTag(tagName, "fu", getFollowUp()));
112          }
113
114          if (getFollowUpOnError() != null) {
115             tagBuf.append(getDataTag(tagName, "fue", getFollowUpOnError()));
116          }
117
118          tagBuf.append(getButtonBegin());
119          tagBuf.append(" name=\"");
120          tagBuf.append(tagName);
121          tagBuf.append(getButtonEnd());
122
123          pageContext.getOut()
124                     .write(tagBuf.toString());
125       } catch (java.io.IOException JavaDoc ioe) {
126          throw new JspException JavaDoc("IO Error: " + ioe.getMessage());
127       }
128
129       if (getChoosenFlavor() == FLAVOR_MODERN) {
130          return EVAL_BODY_BUFFERED;
131       } else {
132          return SKIP_BODY;
133       }
134    }
135 }
136
Popular Tags