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.tag.basic.AttributedTagInterface;
21:
22: /**
23: * Link base tag.
24: *
25: * @author Oleg Mürk
26: */
27: public class BaseLinkTag extends PresentationTag {
28: protected String id, href, target;
29: protected boolean disabled = false;
30:
31: protected int doStartTag(Writer out) throws Exception {
32: super .doStartTag(out);
33: addContextEntry(AttributedTagInterface.HTML_ELEMENT_KEY, id);
34:
35: return EVAL_BODY_INCLUDE;
36: }
37:
38: /* ***********************************************************************************
39: * Tag attributes
40: * ***********************************************************************************/
41: /**
42: * @jsp.attribute
43: * type = "java.lang.String"
44: * required = "false"
45: * description = "Link id, allows to access link from JavaScript."
46: */
47: public void setId(String id) throws JspException {
48: this .id = (String) this .evaluateNotNull("id", id, String.class);
49: }
50:
51: /**
52: * @jsp.attribute
53: * type = "java.lang.String"
54: * required = "true"
55: * description = "Link target URL."
56: */
57: public void setHref(String href) throws JspException {
58: this .href = (String) this .evaluateNotNull("href", href,
59: String.class);
60: }
61:
62: /**
63: * @jsp.attribute
64: * type = "java.lang.String"
65: * required = "false"
66: * description = "Link target, same as <i><a></i> HTML tag <i>target</i> attribute."
67: */
68: public void setTarget(String target) throws JspException {
69: this .target = (String) this .evaluateNotNull("target", target,
70: String.class);
71: }
72:
73: /**
74: * @jsp.attribute
75: * type = "java.lang.String"
76: * required = "false"
77: * description = "Controls whether the link is disabled, disabled link doesn't link anywhere."
78: */
79: public void setDisabled(String disabled) throws JspException {
80: this .disabled = ((Boolean) this .evaluateNotNull("disabled",
81: disabled, Boolean.class)).booleanValue();
82: }
83: }
|