1 /*
2 * The SmartWeb Framework
3 * Copyright (C) 2004-2006
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * For further informations on the SmartWeb Framework please visit
20 *
21 * http://smartweb.sourceforge.net
22 */
23
24 package net.smartlab.web.page;
25
26 import javax.servlet.jsp.JspException;
27 import javax.servlet.jsp.PageContext;
28 import javax.servlet.jsp.tagext.Tag;
29 import javax.servlet.jsp.tagext.TagSupport;
30
31 /**
32 * TODO documentation
33 *
34 * @author rlogiacco
35 */
36 public abstract class AbstractTag implements Tag {
37
38 /**
39 * TODO documentation
40 */
41 protected PageContext context;
42
43 /**
44 * TODO documentation
45 */
46 private Tag parent;
47
48 /**
49 * @see javax.servlet.jsp.tagext.Tag#setPageContext(javax.servlet.jsp.PageContext)
50 */
51 public void setPageContext(PageContext context) {
52 this.context = context;
53 }
54
55 /**
56 * @see javax.servlet.jsp.tagext.Tag#setParent(javax.servlet.jsp.tagext.Tag)
57 */
58 public void setParent(Tag parent) {
59 this.parent = parent;
60 }
61
62 /**
63 * @see javax.servlet.jsp.tagext.Tag#getParent()
64 */
65 public Tag getParent() {
66 return parent;
67 }
68
69 /**
70 * @see javax.servlet.jsp.tagext.Tag#doEndTag()
71 */
72 public int doEndTag() throws JspException {
73 return EVAL_PAGE;
74 }
75
76 /**
77 * @see javax.servlet.jsp.tagext.Tag#release()
78 */
79 public void release() {
80 // Do nothing
81 }
82
83 /**
84 * TODO documentation
85 *
86 * @return
87 */
88 protected Paginator getPaginator() {
89 return ((PaginateTag)TagSupport.findAncestorWithClass(this, PaginateTag.class)).getPaginator();
90 }
91 }