01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: **/package org.araneaframework.jsp.tag.presentation;
16:
17: import java.io.Writer;
18: import javax.servlet.jsp.JspException;
19: import org.araneaframework.jsp.tag.PresentationTag;
20: import org.araneaframework.jsp.util.JspUtil;
21:
22: /**
23: * Base tag for simple button which has label but not much more.
24: *
25: * @author Oleg Mürk
26: */
27: public class BaseSimpleButtonTag extends PresentationTag {
28: protected String id;
29: protected String labelId;
30: protected String contextWidgetId;
31: protected String localizedLabel;
32: protected String onClickPrecondition;
33: protected String tabindex;
34:
35: protected int doStartTag(Writer out) throws Exception {
36: super .doStartTag(out);
37:
38: if (labelId != null)
39: localizedLabel = JspUtil.getResourceString(pageContext,
40: labelId);
41:
42: contextWidgetId = getContextWidgetFullId();
43:
44: return EVAL_BODY_INCLUDE;
45: }
46:
47: /* ***********************************************************************************
48: * Tag attributes
49: * ***********************************************************************************/
50:
51: /**
52: * @jsp.attribute
53: * type = "java.lang.String"
54: * required = "false"
55: * description = "Button id, allows to access button from JavaScript."
56: */
57: public void setId(String id) throws JspException {
58: this .id = (String) evaluate("id", id, String.class);
59: }
60:
61: /**
62: * @jsp.attribute
63: * type = "java.lang.String"
64: * required = "false"
65: * description = "Id of button label."
66: */
67: public void setLabelId(String labelId) throws JspException {
68: this .labelId = (String) evaluate("labelId", labelId,
69: String.class);
70: }
71:
72: /**
73: * @jsp.attribute
74: * type = "java.lang.String"
75: * required = "false"
76: * description = "Precondition for deciding whether go to server side or not."
77: */
78: public void setOnClickPrecondition(String onClickPrecondition)
79: throws JspException {
80: this .onClickPrecondition = (String) evaluate(
81: "onClickPrecondition", onClickPrecondition,
82: String.class);
83: }
84:
85: /**
86: * @since 1.0.11
87: * @jsp.attribute
88: * type = "java.lang.String"
89: * required = "false"
90: * description = "HTML tabindex for the element."
91: */
92: public void setTabindex(String tabindex) throws JspException {
93: this .tabindex = (String) evaluateNotNull("tabindex", tabindex,
94: String.class);
95: }
96: }
|