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.util.JspUtil;
20:
21: /**
22: * Standard link tag.
23: *
24: * @author Oleg Mürk
25: *
26: * @jsp.tag
27: * name = "link"
28: * body-content = "JSP"
29: * description = "Usual HTML link, acts as a <i><a></i> HTML tag."
30: */
31: public class LinkHtmlTag extends BaseLinkTag {
32: private String disabledStyleClass;
33:
34: protected int doStartTag(Writer out) throws Exception {
35: super .doStartTag(out);
36:
37: JspUtil.writeOpenStartTag(out, "a");
38: JspUtil.writeAttribute(out, "id", id);
39: JspUtil.writeAttribute(out, "class",
40: !disabled ? getStyleClass() : getDisabledStyleClass());
41: JspUtil.writeAttribute(out, "style", getStyle());
42: if (!disabled) {
43: JspUtil.writeAttribute(out, "href", href);
44: JspUtil.writeAttribute(out, "target", target);
45: } else
46: JspUtil.writeAttribute(out, "href", "javascript:");
47:
48: JspUtil.writeCloseStartTag_SS(out);
49:
50: return EVAL_BODY_INCLUDE;
51: }
52:
53: protected int doEndTag(Writer out) throws Exception {
54: JspUtil.writeEndTag_SS(out, "a");
55:
56: super .doEndTag(out);
57: return EVAL_PAGE;
58: }
59:
60: public String getDisabledStyleClass() {
61: return disabledStyleClass;
62: }
63:
64: /* ***********************************************************************************
65: * Tag attributes
66: * ***********************************************************************************/
67:
68: /**
69: * @jsp.attribute
70: * type = "java.lang.String"
71: * required = "false"
72: * description = "CSS class for disabled link"
73: */
74: public void setDisabledStyleClass(String disabledStyleClass)
75: throws JspException {
76: this .disabledStyleClass = (String) this .evaluate(
77: "disabledStyleClass", disabledStyleClass, String.class);
78: }
79: }
|