1 /***
2 * Copyright (c) 2003 held jointly by the individual authors.
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published
6 * by the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; with out even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation,
16 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 *
18 * > http://www.gnu.org/copyleft/lesser.html
19 * > http://www.opensource.org/licenses/lgpl-license.php
20 */
21 package net.mlw.vlh.web.tag;
22
23 import javax.servlet.jsp.JspException;
24
25 import net.mlw.vlh.web.util.JspUtils;
26
27 /***
28 * Base class for columnTags
29 * @author Andrej Zachar
30 * @version $Revision: 1.5 $ $Date: 2006/01/06 10:53:24 $
31 */
32 public class BaseColumnTag extends ConfigurableTag
33 {
34
35 private DefaultRowTag rowTag;
36
37 /*** The value to display in the column header. */
38 private String title;
39
40 private String titleKey;
41
42 /***
43 * The value to display in the column header tooltip.
44 * (In html rendered as the attribute 'title' of <th>).
45 */
46 private String toolTip;
47
48 /***
49 * A key of the localized message to be displayed in the column header tooltip.
50 * (In html rendered as the attribute 'title' of <th>).
51 */
52 private String toolTipKey;
53
54 /***
55 * @return Returns the title.
56 */
57 public String getTitle()
58 {
59 return title;
60 }
61
62 /***
63 * Sets the value to display in the column header.
64 *
65 * @param title
66 * The value to display in the column header.
67 */
68 public void setTitle(String title)
69 {
70 this.title = title;
71 }
72
73 /***
74 * @return Returns the titleKey.
75 */
76 public String getTitleKey()
77 {
78 return titleKey;
79 }
80
81 /***
82 * @param titleKey
83 * The titleKey to set.
84 */
85 public void setTitleKey(String titleKey)
86 {
87 this.titleKey = titleKey;
88 }
89
90 /***
91 * The value to display in the column header tooltip.
92 * It's shown when a mouse pointer is over the title.
93 * It's useful when you don't want a long title but still you'd like to
94 * provide to a user a more detailed info about the column.
95 * (In html rendered as the attribute 'title' of <th>).
96 * @return The value to display in the column header tooltip.
97 */
98 public String getToolTip()
99 {
100 return toolTip;
101 }
102
103 /***
104 * The value to display in the column header tooltip.
105 * (In html rendered as the attribute 'title' of <th>).
106 * @param toolTip
107 * The value to display in the column header tooltip.
108 */
109 public void setToolTip(String toolTip)
110 {
111 this.toolTip = toolTip;
112 }
113
114 /***
115 * Return the key of the localized message to be displayed in the column header tooltip.
116 * (In html rendered as the attribute 'title' of <th>).
117 *
118 * @return The key of the localized message to be displayed in the column header tooltip.
119 * @see org.springframework.context.support.ResourceBundleMessageSource
120 */
121 public String getToolTipKey()
122 {
123 return toolTipKey;
124 }
125
126 /***
127 * Set the key of the localized message to be displayed in the column header tooltip.
128 * (In html rendered as the attribute 'title' of <th>).
129 *
130 * @param toolTipKey
131 * The key of the localized message to be displayed in the column header tooltip.
132 * @see org.springframework.context.support.ResourceBundleMessageSource
133 */
134 public void setToolTipKey(String toolTipKey)
135 {
136 this.toolTipKey = toolTipKey;
137 }
138
139 /***
140 * @see javax.servlet.jsp.tagext.Tag#doEndTag()
141 */
142 public int doEndTag() throws JspException
143 {
144 int result = super.doEndTag();
145 reset();
146 return result;
147 }
148
149 public DefaultRowTag getRowTag() throws JspException
150 {
151 if (rowTag == null)
152 {
153 rowTag = (DefaultRowTag) JspUtils.getParent(this, DefaultRowTag.class);
154 }
155 return rowTag;
156 }
157
158 private void reset()
159 {
160 this.rowTag = null;
161 this.title = null;
162 this.titleKey = null;
163 this.toolTip = null;
164 this.toolTipKey = null;
165 }
166
167 /***
168 * Called on a Tag handler to release state.
169 * The page compiler guarantees that JSP page implementation
170 * objects will invoke this method on all tag handlers,
171 * but there may be multiple invocations on doStartTag and doEndTag in between.
172 *
173 * @see javax.servlet.jsp.tagext.Tag#release()
174 */
175 public void release()
176 {
177 super.release();
178 reset();
179 }
180 }