1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
31
32
33
34 /***
35 * this tag renders an "first"-button.
36 *
37 * @author Joachim Peer
38 */
39 public class DbNavFirstButtonTag extends AbstractDbBaseButtonTag
40 implements javax.servlet.jsp.tagext.TryCatchFinally {
41
42 /***
43 * DOCUMENT ME!
44 */
45 public void doFinally() {
46 super.doFinally();
47 }
48
49
50 /***
51 * DOCUMENT ME!
52 *
53 * @return DOCUMENT ME!
54 *
55 * @throws javax.servlet.jsp.JspException DOCUMENT ME!
56 * @throws JspException DOCUMENT ME!
57 */
58 public int doStartTag() throws javax.servlet.jsp.JspException {
59 super.doStartTag();
60
61 if (getParentForm()
62 .isFooterReached()
63 && ResultSetVector.isNull(getParentForm().getResultSetVector())) {
64
65 return SKIP_BODY;
66 }
67
68 boolean isFirstPage = getParentForm()
69 .getResultSetVector()
70 .isFirstPage();
71
72 try {
73
74 if (isFirstPage && "nohtml".equals(getDisabledBehaviour())) {
75 return SKIP_BODY;
76 } else if (isFirstPage && "altimage".equals(getDisabledBehaviour())) {
77 pageContext.getOut()
78 .write(getDisabledImage());
79
80 return SKIP_BODY;
81 }
82
83 else {
84 StringBuffer tagBuf = new StringBuffer();
85 String tagName = EventType.EVENT_NAVIGATION_TRANSFER_FIRST
86 + getTable()
87 .getId() + "_"
88 + Integer.toString(getUniqueID());
89
90 if (getFollowUp() != null) {
91 tagBuf.append(getDataTag(tagName, "fu", getFollowUp()));
92 }
93
94 if (getFollowUpOnError() != null) {
95 tagBuf.append(getDataTag(tagName, "fue", getFollowUpOnError()));
96 }
97
98 tagBuf.append(getButtonBegin());
99
100 if (isFirstPage) {
101 tagBuf.append(" disabled=\"true\"");
102 }
103
104 tagBuf.append(" name=\"");
105 tagBuf.append(tagName);
106 tagBuf.append(getButtonEnd());
107
108 pageContext.getOut()
109 .write(tagBuf.toString());
110 }
111 } catch (java.io.IOException ioe) {
112 throw new JspException("IO Error: " + ioe.getMessage());
113 }
114
115 if (getChoosenFlavor() == FLAVOR_MODERN) {
116 return EVAL_BODY_BUFFERED;
117 } else {
118 return SKIP_BODY;
119 }
120 }
121 }