001/*
002 * Copyright 2008 The Kuali Foundation
003 * 
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * 
008 * http://www.opensource.org/licenses/ecl2.php
009 * 
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.ole.sys.document.web;
017
018import javax.servlet.jsp.JspException;
019import javax.servlet.jsp.PageContext;
020import javax.servlet.jsp.tagext.Tag;
021
022import org.kuali.ole.sys.document.web.renderers.StringRenderer;
023
024/**
025 * A renderable element which renders a literal label
026 */
027public class LiteralHeaderLabel extends HeaderLabel {
028    private String literalLabel;
029    
030    /**
031     * Constructs a LiteralHeaderLabel, forcing the literalLabel to be passed in
032     * @param literalLabel the literal label to render
033     */
034    public LiteralHeaderLabel(String literalLabel) {
035        this.literalLabel = literalLabel;
036    }
037    
038    /**
039     * Uses StringRenderer to render the label
040     * @see org.kuali.ole.sys.document.web.RenderableElement#renderElement(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag, org.kuali.ole.sys.document.web.AccountingLineRenderingContext)
041     */
042    public void renderElement(PageContext pageContext, Tag parentTag, AccountingLineRenderingContext renderingContext) throws JspException {
043        StringRenderer renderer = new StringRenderer();
044        renderer.setStringToRender(literalLabel);
045        renderer.render(pageContext, parentTag);
046        renderer.clear();
047    }
048
049}