1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.document.web.renderers;
17
18 import javax.servlet.jsp.JspException;
19 import javax.servlet.jsp.PageContext;
20 import javax.servlet.jsp.tagext.Tag;
21
22 import org.apache.commons.lang.StringUtils;
23 import org.kuali.rice.kns.web.taglib.html.KNSTextTag;
24 import org.springframework.web.util.HtmlUtils;
25
26
27
28
29 public class TextRenderer extends FieldRendererBase {
30 private KNSTextTag tag = new KNSTextTag();
31
32
33
34
35
36 @Override
37 public void clear() {
38 super.clear();
39 tag.setProperty(null);
40 tag.setTitle(null);
41 tag.setSize(null);
42 tag.setMaxlength(null);
43 tag.setOnblur(null);
44 tag.setStyleClass(null);
45 tag.setValue(null);
46 tag.setStyleId(null);
47 tag.setTabindex(null);
48 }
49
50
51
52
53
54 public void render(PageContext pageContext, Tag parentTag) throws JspException {
55 tag.setPageContext(pageContext);
56 tag.setParent(parentTag);
57 tag.setProperty(getFieldName());
58 tag.setTitle(getAccessibleTitle());
59 tag.setSize(getFieldSize());
60
61 tag.setMaxlength(getFieldMaxLength());
62 final String onBlur = buildOnBlur();
63 if (!StringUtils.isBlank(onBlur)) {
64 tag.setOnblur(buildOnBlur());
65 }
66 tag.setStyleClass(getField().getStyleClass());
67
68 tag.setValue(getField().getPropertyValue());
69 tag.setStyleId(getFieldName());
70
71 tag.doStartTag();
72 tag.doEndTag();
73
74 renderQuickFinderIfNecessary(pageContext, parentTag);
75
76 if (isShowError()) {
77 renderErrorIcon(pageContext);
78 }
79 }
80
81
82
83
84
85 protected String getFieldMaxLength() {
86 return Integer.toString(getField().getMaxLength());
87 }
88
89
90
91
92
93 protected String getFieldSize() {
94 return Integer.toString(getField().getSize());
95 }
96
97
98
99
100
101 public boolean renderQuickfinder() {
102 return true;
103 }
104
105 }