View Javadoc

1   /*
2    * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbNavReloadButtonTag.java,v 1.23 2006/01/13 13:38:51 hkollmann Exp $
3    * $Revision: 1.23 $
4    * $Date: 2006/01/13 13:38:51 $
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;
31  
32  
33  
34  /***
35   * this tag renders an "reload"-button.
36   *
37   * @author Henner Kollmann
38   */
39  public class DbNavReloadButtonTag extends AbstractDbBaseButtonTag
40     implements javax.servlet.jsp.tagext.TryCatchFinally {
41     private String forceReload = null;
42  
43     /***
44      * DOCUMENT ME!
45      *
46      * @param string
47      */
48     public void setForceReload(String string) {
49        forceReload = string;
50     }
51  
52  
53     /***
54      * DOCUMENT ME!
55      *
56      * @return
57      */
58     public String getForceReload() {
59        return forceReload;
60     }
61  
62  
63     /***
64      * DOCUMENT ME!
65      */
66     public void doFinally() {
67        super.doFinally();
68     }
69  
70  
71     /***
72      * DOCUMENT ME!
73      *
74      * @return DOCUMENT ME!
75      *
76      * @throws javax.servlet.jsp.JspException DOCUMENT ME!
77      * @throws JspException DOCUMENT ME!
78      */
79     public int doStartTag() throws javax.servlet.jsp.JspException {
80        super.doStartTag();
81  
82        try {
83           StringBuffer tagBuf  = new StringBuffer();
84           StringBuffer tagName = new StringBuffer(EventType.EVENT_NAVIGATION_TRANSFER_RELOAD);
85  
86           if (getTable() != null) {
87              tagName.append(getTable().getId());
88           }
89  
90           if (hasForceReloadSet()) {
91              tagName.append("_force");
92           } else if (getParentForm()
93                               .isFooterReached()) {
94  //            tagName.append("_ins");
95           }
96  
97           tagName.append("_");
98           tagName.append(Integer.toString(getUniqueID()));
99  
100          if (getFollowUp() != null) {
101             tagBuf.append(getDataTag(tagName.toString(), "fu", getFollowUp()));
102          }
103 
104          if (getFollowUpOnError() != null) {
105             tagBuf.append(getDataTag(tagName.toString(), "fue",
106                                      getFollowUpOnError()));
107          }
108 
109          tagBuf.append(getButtonBegin());
110          tagBuf.append(" name=\"");
111          tagBuf.append(tagName);
112          tagBuf.append(getButtonEnd());
113 
114          pageContext.getOut()
115                     .write(tagBuf.toString());
116       } catch (java.io.IOException ioe) {
117          throw new JspException("IO Error: " + ioe.getMessage());
118       }
119 
120       if (getChoosenFlavor() == FLAVOR_MODERN) {
121          return EVAL_BODY_BUFFERED;
122       } else {
123          return SKIP_BODY;
124       }
125    }
126 
127 
128    /***
129     * DOCUMENT ME!
130     *
131     * @return DOCUMENT ME!
132     */
133    public boolean hasForceReloadSet() {
134       return Util.getTrue(forceReload);
135    }
136 }