001/*
002 * The Kuali Financial System, a comprehensive financial management system for higher education.
003 * 
004 * Copyright 2005-2014 The Kuali Foundation
005 * 
006 * This program is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU Affero General Public License as
008 * published by the Free Software Foundation, either version 3 of the
009 * License, or (at your option) any later version.
010 * 
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU Affero General Public License for more details.
015 * 
016 * You should have received a copy of the GNU Affero General Public License
017 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package org.kuali.kfs.sys.document.web;
020
021import java.util.List;
022
023import javax.servlet.jsp.JspException;
024import javax.servlet.jsp.PageContext;
025import javax.servlet.jsp.tagext.Tag;
026
027import org.kuali.rice.kns.web.ui.Field;
028
029/**
030 * Methods needed by elements of accounting lines that plan on rendering themselves
031 */
032public interface RenderableElement {
033    /**
034     * Determines if this element is hidden or not
035     * @return true if hidden, false otherwise
036     */
037    public abstract boolean isHidden();
038    
039    /**
040     * Determines if this element is an action block or not
041     * @return true if this is an action block, false otherwise
042     */
043    public abstract boolean isActionBlock();
044    
045    /**
046     * Is this renderable element empty of any truly renderable content?
047     * @return true if it should not be rendered, false otherwise
048     */
049    public abstract boolean isEmpty();
050    
051    /**
052     * Renders this element
053     * @param pageContext the context to render to
054     * @param parentTag the parent tag that is requesting this rendering
055     * @param renderingContext the context about the accounting line that this element would end up rendering
056     */
057    public abstract void renderElement(PageContext pageContext, Tag parentTag, AccountingLineRenderingContext renderingContext) throws JspException;
058    
059    /**
060     * Asks that the renderable element appends any field names it knows of to the given list; this is so that proper quick finders can be generated
061     * and population accomplished when fields themselves are rendered
062     * @param fieldNames the List of fields to append fields to
063     */
064    public abstract void appendFields(List<Field> fields);
065    
066    /**
067     * Allows the arbitrarily high tab index to be set for controls
068     * @param reallyHighIndex a really high index for elements who should not be tabbed to
069     */
070    public abstract void populateWithTabIndexIfRequested(int reallyHighIndex);
071}