1 /* 2 * Copyright 2008 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 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 */ 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.struts.taglib.html.HiddenTag; 23 import org.springframework.web.util.HtmlUtils; 24 25 /** 26 * Renders a hidden field 27 */ 28 public class HiddenRenderer extends FieldRendererBase { 29 private HiddenTag tag = new HiddenTag(); 30 31 /** 32 * Resets the field on the following values on the tag: the page context, the parent tag, the property, and the value 33 * @see org.kuali.ole.sys.document.web.renderers.Renderer#clear() 34 */ 35 @Override 36 public void clear() { 37 super.clear(); 38 tag.setPageContext(null); 39 tag.setParent(null); 40 tag.setProperty(null); 41 tag.setValue(null); 42 } 43 44 /** 45 * Renders the hidden field using a Struts html:hidden tag 46 * @see org.kuali.ole.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag) 47 */ 48 public void render(PageContext pageContext, Tag parentTag) throws JspException { 49 tag.setPageContext(pageContext); 50 tag.setParent(parentTag); 51 tag.setProperty(getFieldName()); 52 if (getField().isSecure()) { 53 tag.setValue(getField().getEncryptedValue()); 54 } else { 55 tag.setValue(getField().getPropertyValue()); 56 } 57 tag.setStyleId(getFieldName()); 58 tag.setWrite(false); 59 tag.doStartTag(); 60 tag.doEndTag(); 61 } 62 63 /** 64 * You can't even see me...you think I got a quickfinder? 65 * @see org.kuali.ole.sys.document.web.renderers.FieldRenderer#renderQuickfinder() 66 */ 67 public boolean renderQuickfinder() { 68 return false; 69 } 70 71 }