KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbNavLastButtonTag.java,v 1.23 2004/10/20 10:52:02 hkollmann Exp $
3  * $Revision: 1.23 $
4  * $Date: 2004/10/20 10:52:02 $
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 javax.servlet.jsp.JspException JavaDoc;
31
32
33
34 /**
35  * this tag renders an "last"-button.
36  *
37  * @author Joachim Peer
38  */

39 public class DbNavLastButtonTag extends DbBaseButtonTag
40    implements javax.servlet.jsp.tagext.TryCatchFinally JavaDoc {
41    /**
42     * @see javax.servlet.jsp.tagext.TryCatchFinally#doCatch(java.lang.Throwable)
43     */

44    public void doCatch(Throwable JavaDoc t) throws Throwable JavaDoc {
45       throw t;
46    }
47
48
49    /**
50     * DOCUMENT ME!
51     */

52    public void doFinally() {
53       super.doFinally();
54    }
55
56
57    /**
58     * DOCUMENT ME!
59     *
60     * @return DOCUMENT ME!
61     *
62     * @throws javax.servlet.jsp.JspException DOCUMENT ME!
63     * @throws JspException DOCUMENT ME!
64     */

65    public int doStartTag() throws javax.servlet.jsp.JspException JavaDoc {
66       super.doStartTag();
67
68       if (getParentForm()
69                    .isFooterReached()
70                 && ResultSetVector.isNull(getParentForm().getResultSetVector())) {
71          // 20030521 HKK: Bug fixing, thanks to Michael Slack!
72
return SKIP_BODY;
73       }
74
75       boolean isLastPage = getParentForm()
76                               .getResultSetVector()
77                               .isLastPage();
78
79       try {
80          //20040227 JFM
81
if (isLastPage && "nohtml".equals(getDisabledBehaviour())) {
82             return SKIP_BODY;
83          } else if (isLastPage && "altimage".equals(getDisabledBehaviour())) {
84             pageContext.getOut()
85                        .write(getDisabledImage());
86
87             return SKIP_BODY;
88          }
89          //default: "disabled".equals(getDisabledBehaviour())
90
else {
91             StringBuffer JavaDoc tagBuf = new StringBuffer JavaDoc();
92             String JavaDoc tagName = EventType.EVENT_NAVIGATION_TRANSFER_LAST
93                                    + getTable()
94                                         .getId() + "_"
95                                    + Integer.toString(getUniqueID());
96
97             if (getFollowUp() != null) {
98                tagBuf.append(getDataTag(tagName, "fu", getFollowUp()));
99             }
100
101             if (getFollowUpOnError() != null) {
102                tagBuf.append(getDataTag(tagName, "fue", getFollowUpOnError()));
103             }
104
105             tagBuf.append(getButtonBegin());
106
107             if (isLastPage) {
108                tagBuf.append(" disabled=\"true\"");
109             }
110
111             tagBuf.append(" name=\"");
112             tagBuf.append(tagName);
113             tagBuf.append(getButtonEnd());
114
115             pageContext.getOut()
116                        .write(tagBuf.toString());
117          }
118       } catch (java.io.IOException JavaDoc ioe) {
119          throw new JspException JavaDoc("IO Error: " + ioe.getMessage());
120       }
121
122       if (getChoosenFlavor() == FLAVOR_MODERN) {
123          return EVAL_BODY_BUFFERED;
124       } else {
125          return SKIP_BODY;
126       }
127    }
128 }
129
Popular Tags