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 "previous"-button.
36 *
37 * @author Joachim Peer
38 */
39 public class DbNavPrevButtonTag extends AbstractDbBaseButtonTag
40 implements javax.servlet.jsp.tagext.TryCatchFinally {
41 private String stepWidth;
42
43 /***
44 * DOCUMENT ME!
45 *
46 * @param stepWidth DOCUMENT ME!
47 */
48 public void setStepWidth(String stepWidth) {
49 this.stepWidth = stepWidth;
50 }
51
52
53 /***
54 * DOCUMENT ME!
55 *
56 * @return DOCUMENT ME!
57 */
58 public String getStepWidth() {
59 return stepWidth;
60 }
61
62 /***
63 * DOCUMENT ME!
64 */
65 public void doFinally() {
66 stepWidth = null;
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 if (getParentForm()
83 .isFooterReached()
84 && ResultSetVector.isNull(getParentForm().getResultSetVector())) {
85
86 return SKIP_BODY;
87 }
88
89 boolean isFirstPage = getParentForm()
90 .getResultSetVector()
91 .isFirstPage();
92
93 try {
94
95 if (isFirstPage && "nohtml".equals(getDisabledBehaviour())) {
96 return SKIP_BODY;
97 } else if (isFirstPage && "altimage".equals(getDisabledBehaviour())) {
98 pageContext.getOut()
99 .write(getDisabledImage());
100
101 return SKIP_BODY;
102 }
103
104 else {
105 StringBuffer tagBuf = new StringBuffer();
106 String tagName = EventType.EVENT_NAVIGATION_TRANSFER_PREV
107 + getTable()
108 .getId() + "_"
109 + Integer.toString(getUniqueID());
110
111 if (stepWidth != null) {
112 tagBuf.append(getDataTag(tagName, "sw", stepWidth));
113 }
114
115 if (getFollowUp() != null) {
116 tagBuf.append(getDataTag(tagName, "fu", getFollowUp()));
117 }
118
119 if (getFollowUpOnError() != null) {
120 tagBuf.append(getDataTag(tagName, "fue", getFollowUpOnError()));
121 }
122
123 tagBuf.append(getButtonBegin());
124
125 if (isFirstPage) {
126 tagBuf.append(" disabled=\"true\"");
127 }
128
129 tagBuf.append(" name=\"");
130 tagBuf.append(tagName);
131 tagBuf.append(getButtonEnd());
132
133 pageContext.getOut()
134 .write(tagBuf.toString());
135 }
136 } catch (java.io.IOException ioe) {
137 throw new JspException("IO Error: " + ioe.getMessage());
138 }
139
140 if (getChoosenFlavor() == FLAVOR_MODERN) {
141 return EVAL_BODY_BUFFERED;
142 } else {
143 return SKIP_BODY;
144 }
145 }
146 }