1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98 package com.ivata.mask.web.tag.html;
99 import java.util.List;
100
101 import javax.servlet.jsp.JspException;
102 /***
103 * <p>
104 * Overrides an HTML <code><input type=submit></code> tag, by overriding
105 * the class from <strong>Struts </strong>.
106 * </p>
107 *
108 * <p>
109 * <b>Tag attributes: </b> <br/><table cellpadding='2' cellspacing='5'
110 * border='0' align='center' width='85%'>
111 * <tr class='TableHeadingColor'>
112 * <th>attribute</th>
113 * <th>reqd.</th>
114 * <th>param. class</th>
115 * <th width='100%'>description</th>
116 * </tr>
117 * <tr>
118 * <td>fieldName</td>
119 * <td>true</td>
120 * <td><code>java.lang.String</code></td>
121 * <td>The field name is used to default the following attributes of the tag:
122 * <br/>
123 * <ul>
124 * <li><code>styleId</code></li>
125 * <li><code>titleKey</code></li>
126 * <li><code>valueKey</code></li>
127 * </ul>.</td>
128 * </tr>
129 * <tr>
130 * <td>titleKey</td>
131 * <td>true</td>
132 * <td><code>java.lang.String</code></td>
133 * <td>Specifies the localized text to use for mouse-over events.</td>
134 * </tr>
135 * <tr>
136 * <td>valueKey</td>
137 * <td>true</td>
138 * <td><code>java.lang.String</code></td>
139 * <td>Specifies the localized text to use for the button text.</td>
140 * </tr>
141 * </table>
142 * </p>
143 *
144 * <p>
145 * <b>Note: </b> all the tag attributes from {@link
146 * org.apache.struts.taglib.html.CancelTag Stuts} are included.
147 * </p>
148 *
149 * @since ivata masks 0.4 (2003-01-15)
150 * @author Colin MacLeod
151 * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
152 * @version $Revision: 1.5 $
153 */
154 public class CancelTag extends org.apache.struts.taglib.html.CancelTag {
155 /***
156 * <p>
157 * >Name of the field to which this label refers. This is used in
158 * conjunction with the <code>resourceFieldPath</code> to retrieve the
159 * correct message resources path.
160 * </p>
161 */
162 private String fieldName = "cancel";
163 /***
164 * <p>
165 * Stores and maintains <strong>ivata op </strong> specific mask properties.
166 * </p>
167 */
168 private MaskProperties maskProperties = new MaskProperties();
169 /***
170 * <p>
171 * Overridden to reset mask properties.
172 * </p>
173 *
174 * @return <code>EVAL_PAGE</code> since we always want to evaluate the
175 * page after this tag.
176 *
177 * @throws JspException
178 * if there is an error in the mask properties.
179 */
180 public int doEndTag() throws JspException {
181
182 if (maskProperties.getReadOnly()
183 || (pageContext.getRequest().getParameter("print") != null)) {
184 maskProperties.reset(this);
185 return EVAL_PAGE;
186 }
187 int returnValue = super.doEndTag();
188 maskProperties.reset(this);
189 this.fieldName = "cancel";
190 return returnValue;
191 }
192 /***
193 * <p>
194 * Overridden to set the value and title strings to the values represented
195 * by the localized keys in this class.
196 * </p>
197 *
198 * @return value returned by superclass method.
199 *
200 * @throws JspException
201 * if either <code>valueKey</code> or <code>titleKey</code>
202 * have not been set, or as thrown by superclass method.
203 */
204 public int doStartTag() throws JspException {
205 maskProperties.setFieldName(fieldName);
206 maskProperties.doStartTag(this, pageContext);
207 return super.doStartTag();
208 }
209 /***
210 * Refer to {@link MaskProperties#getBundle}.
211 *
212 * @return Refer to {@link MaskProperties#getBundle}.
213 */
214 public final String getBundle() {
215 return maskProperties.getBundle();
216 }
217 /***
218 * <p>
219 * Stores and maintains <strong>ivata op </strong> specific mask properties.
220 * </p>
221 *
222 * @return the current value of maskProperties.
223 */
224 public MaskProperties getMaskProperties() {
225 return maskProperties;
226 }
227 public final List getTitleArgs() {
228 return maskProperties.getTitleArgs();
229 }
230 /***
231 * <p>
232 * Get the value of the key used to localize the title tag attribute.
233 * </p>
234 *
235 * @return the current value of titleKey.
236 */
237 public String getTitleKey() {
238 return maskProperties.getTitleKey();
239 }
240 public final List getValueArgs() {
241 return maskProperties.getValueArgs();
242 }
243 /***
244 * <p>
245 * Get the value of the key used to localize the value tag attribute.
246 * </p>
247 *
248 * @return the current value of valueKey.
249 */
250 public String getValueKey() {
251 return maskProperties.getValueKey();
252 }
253 /***
254 * <p>
255 * >Name of the field to which this label refers. This is used in
256 * conjunction with the <code>resourceFieldPath</code> to retrieve the
257 * correct message resources path.
258 * </p>
259 *
260 * @param fieldNameParam
261 * the new value of fieldName.
262 */
263 public void setFieldName(final String fieldNameParam) {
264 this.fieldName = fieldNameParam;
265 }
266 /***
267 * <p>
268 * Stores and maintains <strong>ivata op </strong> specific mask properties.
269 * </p>
270 *
271 * @param maskPropertiesParam
272 * the new value of maskProperties.
273 */
274 public void setMaskProperties(final MaskProperties maskPropertiesParam) {
275 this.maskProperties = maskPropertiesParam;
276 }
277 /***
278 * Refer to {@link MaskProperties#setTitleArgs}.
279 *
280 * @param args Refer to {@link MaskProperties#setTitleArgs}.
281 */
282 public final void setTitleArgs(final List args) {
283 maskProperties.setTitleArgs(args);
284 }
285 /***
286 * Refer to {@link MaskProperties#setTitleKey}.
287 *
288 * @param titleKeyParam Refer to {@link MaskProperties#setTitleKey}.
289 */
290 public final void setTitleKey(final String titleKeyParam) {
291 maskProperties.setTitleKey(titleKeyParam);
292 }
293 /***
294 * Refer to {@link MaskProperties#setValueArgs}.
295 *
296 * @param args Refer to {@link MaskProperties#setValueArgs}.
297 */
298 public final void setValueArgs(final List args) {
299 maskProperties.setValueArgs(args);
300 }
301 /***
302 * <p>
303 * Set the value of the key used to localize the value tag attribute.
304 * </p>
305 *
306 * @param valueKey
307 * the new value of valueKey.
308 */
309 public final void setValueKey(final String valueKey) {
310 maskProperties.setValueKey(valueKey);
311 }
312 }
313