1 /*
2 * The Kuali Financial System, a comprehensive financial management system for higher education.
3 *
4 * Copyright 2005-2014 The Kuali Foundation
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 package org.kuali.kfs.sys.document.web.renderers;
20
21 import javax.servlet.jsp.JspException;
22 import javax.servlet.jsp.PageContext;
23 import javax.servlet.jsp.tagext.Tag;
24
25 import org.kuali.rice.kns.web.taglib.html.KNSTextareaTag;
26 import org.springframework.web.util.HtmlUtils;
27
28 /**
29 * Renders a field as a text area
30 */
31 public class TextAreaRenderer extends FieldRendererBase {
32 private KNSTextareaTag tag = new KNSTextareaTag();
33
34 /**
35 * Resets the text area tag
36 * @see org.kuali.kfs.sys.document.web.renderers.FieldRendererBase#clear()
37 */
38 public void clear() {
39 super.clear();
40 tag.setPageContext(null);
41 tag.setParent(null);
42 tag.setProperty(null);
43 tag.setValue(null);
44 tag.setTitle(null);
45 tag.setRows(null);
46 tag.setCols(null);
47 tag.setStyleClass(null);
48 tag.setStyleId(null);
49 tag.setTabindex(null);
50 }
51
52 /**
53 * Uses the struts html:textarea tag to render a text area
54 * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag)
55 */
56 public void render(PageContext pageContext, Tag parentTag) throws JspException {
57 tag.setPageContext(pageContext);
58 tag.setParent(parentTag);
59 tag.setProperty(getFieldName());
60 tag.setValue(getField().getPropertyValue());
61 tag.setTitle(this.getAccessibleTitle());
62 tag.setRows(Integer.toString(getField().getRows()));
63 tag.setCols(Integer.toString(getField().getCols()));
64 tag.setStyleClass(getField().getStyleClass());
65 tag.setStyleId(getFieldName());
66
67 tag.doStartTag();
68 tag.doEndTag();
69
70 renderQuickFinderIfNecessary(pageContext, parentTag);
71
72 if (isShowError()) {
73 renderErrorIcon(pageContext);
74 }
75 }
76
77 /**
78 * I'll take a quick finder if needed
79 * @see org.kuali.kfs.sys.document.web.renderers.FieldRenderer#renderQuickfinder()
80 */
81 public boolean renderQuickfinder() {
82 return true;
83 }
84
85 }