KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbNavReloadButtonTag.java,v 1.20 2004/10/20 10:52:02 hkollmann Exp $
3  * $Revision: 1.20 $
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.event.eventtype.EventType;
27
28 import org.dbforms.util.Util;
29
30 import javax.servlet.jsp.JspException JavaDoc;
31
32
33
34 /**
35  * this tag renders an "reload"-button.
36  *
37  * @author Henner Kollmann
38  */

39 public class DbNavReloadButtonTag extends DbBaseButtonTag
40    implements javax.servlet.jsp.tagext.TryCatchFinally JavaDoc {
41    private String JavaDoc forceReload = null;
42
43    /**
44     * DOCUMENT ME!
45     *
46     * @param string
47     */

48    public void setForceReload(String JavaDoc string) {
49       forceReload = string;
50    }
51
52
53    /**
54     * DOCUMENT ME!
55     *
56     * @return
57     */

58    public String JavaDoc getForceReload() {
59       return forceReload;
60    }
61
62
63    /**
64     * @see javax.servlet.jsp.tagext.TryCatchFinally#doCatch(java.lang.Throwable)
65     */

66    public void doCatch(Throwable JavaDoc t) throws Throwable JavaDoc {
67       throw t;
68    }
69
70
71    /**
72     * DOCUMENT ME!
73     */

74    public void doFinally() {
75       super.doFinally();
76    }
77
78
79    /**
80     * DOCUMENT ME!
81     *
82     * @return DOCUMENT ME!
83     *
84     * @throws javax.servlet.jsp.JspException DOCUMENT ME!
85     * @throws JspException DOCUMENT ME!
86     */

87    public int doStartTag() throws javax.servlet.jsp.JspException JavaDoc {
88       super.doStartTag();
89
90       try {
91          StringBuffer JavaDoc tagBuf = new StringBuffer JavaDoc();
92          StringBuffer JavaDoc tagName = new StringBuffer JavaDoc(EventType.EVENT_NAVIGATION_TRANSFER_RELOAD);
93
94          if (getTable() != null) {
95             tagName.append(getTable().getId());
96          }
97
98          if (hasForceReloadSet()) {
99             tagName.append("_force");
100          } else if (getParentForm()
101                              .isFooterReached()) {
102             tagName.append("_ins");
103          }
104
105          tagName.append("_");
106          tagName.append(Integer.toString(getUniqueID()));
107
108          if (getFollowUp() != null) {
109             tagBuf.append(getDataTag(tagName.toString(), "fu", getFollowUp()));
110          }
111
112          if (getFollowUpOnError() != null) {
113             tagBuf.append(getDataTag(tagName.toString(), "fue",
114                                      getFollowUpOnError()));
115          }
116
117          tagBuf.append(getButtonBegin());
118          tagBuf.append(" name=\"");
119          tagBuf.append(tagName);
120          tagBuf.append(getButtonEnd());
121
122          pageContext.getOut()
123                     .write(tagBuf.toString());
124       } catch (java.io.IOException JavaDoc ioe) {
125          throw new JspException JavaDoc("IO Error: " + ioe.getMessage());
126       }
127
128       if (getChoosenFlavor() == FLAVOR_MODERN) {
129          return EVAL_BODY_BUFFERED;
130       } else {
131          return SKIP_BODY;
132       }
133    }
134
135
136    /**
137     * DOCUMENT ME!
138     *
139     * @return DOCUMENT ME!
140     */

141    public boolean hasForceReloadSet() {
142       return Util.getTrue(forceReload);
143    }
144 }
145
Popular Tags