Update of /cvsroot/displaytag/display09/src/org/apache/taglibs/display/tags
In directory sc8-pr-cvs1:/tmp/cvs-serv22073/src/org/apache/taglibs/display/tags

Added Files:
        ColumnTag.java ColumnTagBeanInfo.java HtmlTableTag.java 
        SetPropertyTag.java TableProperties.java TableTag.java 
        TableTag.properties TableTagBeanInfo.java 
        TableTagExtraInfo.java TableTagParameters.java 
        TemplateTag.java 
Log Message:


--- NEW FILE: ColumnTag.java ---
package org.apache.taglibs.display.tags;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.taglibs.display.decorator.ColumnDecorator;
import org.apache.taglibs.display.decorator.DecoratorFactory;
import org.apache.taglibs.display.model.Cell;
import org.apache.taglibs.display.model.HeaderCell;
import org.apache.taglibs.display.model.Href;
import org.apache.taglibs.display.model.MultipleHtmlAttribute;
import org.apache.taglibs.display.model.TagConstants;

/**
 * <p>
 * This tag works hand in hand with the SmartListTag to display a list of
 * objects.  This describes a column of data in the SmartListTag.  There can
 * be any (reasonable) number of columns that make up the list.
 * </p>
 * <p>
 * This tag does no work itself, it is simply a container of information.  The
 * TableTag does all the work based on the information provided in the
 * attributes of this tag.
 * <p>
 * @author fgiust
 * @version $Revision: 1.1 $ ($Author: fgiust $)
 */
public class ColumnTag extends BodyTagSupport
{

        /**
         * Field mLog
         */
        private static Log mLog= LogFactory.getLog(ColumnTag.class);

        /**
         * Field mStaticContent
         */
        private String mStaticContent;

        /** html pass-through attributes for cells **/
        private HashMap mAttributeMap= new HashMap();

        /** html pass-through attributes for cell headers **/
        private HashMap mHeaderAttributeMap= new HashMap();

        /**
         * the property method that is called to retrieve the information to be 
displayed in this column.
         * This method is called on the current object in the iteration for the given 
row.
         * The property format is in typical struts format for properties (required)
         */
        private String mProperty;

        /** the title displayed for this column.  if this is omitted then the property 
name is used
         * for the title of the column (optional)
         */
        private String mTitle;

        /**
         * by default, null values don't appear in the list, by setting viewNulls to 
'true', then
         * null values will appear as "null" in the list (mostly useful for debugging) 
(optional)
         */
        private boolean mNulls;

        /**
         * Field mSortable
         */
        private boolean mSortable;

        /**
         * if set to true, then any email addresses and URLs found in the content of 
the column are
         * automatically converted into a hypertext link.
         */
        private boolean mAutolink;

        /**
         * the grouping level (starting at 1 and incrementing) of this column 
(indicates if successive
         * contain the same values, then they should not be displayed).  The level 
indicates that if a
         * lower level no longer matches, then the matching for this higher level 
should start over as
         * well. If this attribute is not included, then no grouping is performed. 
(optional)
         */
        private int mGroup= -1;

        /**
         * if this attribute is provided, then the data that is shown for this column 
is wrapped inside
         * a &lt;a href&gt; tag with the url provided through this attribute. 
Typically you would use
         * this attribute along with one of the struts-like param attributes below to 
create a dynamic
         * link so that each row creates a different URL based on the data that is 
being viewed. (optional)
         */
        private Href mHref;

        /**
         * The name of the request parameter that will be dynamically added to the 
generated href URL.
         * The corresponding value is defined by the paramProperty and (optional) 
paramName attributes,
         * optionally scoped by the paramScope attribute. (optional)
         */
        private String mParamId;

        /**
         * The name of a JSP bean that is a String containing the value for the 
request parameter named
         * by paramId (if paramProperty is not specified), or a JSP bean whose 
property getter is called
         * to return a String (if paramProperty is specified). The JSP bean is 
constrained to the bean
         * scope specified by the paramScope property, if it is specified. If 
paramName is omitted, then
         * it is assumed that the current object being iterated on is the target bean. 
(optional)
         */
        private String mParamName;

        /**
         * The name of a property of the bean specified by the paramName attribute (or 
the current object
         * being iterated on if paramName is not provided), whose return value must be 
a String containing
         * the value of the request parameter (named by the paramId attribute) that 
will be dynamically
         * added to this href URL. (optional)
         */
        private String mParamProperty;

        /**
         * The scope within which to search for the bean specified by the paramName 
attribute. If not
         * specified, all scopes are searched. If paramName is not provided, then the 
current object
         * being iterated on is assumed to be the target bean. (optional)
         */
        private String mParamScope;

        /**
         * If this attribute is provided, then the column's displayed is limited to 
this number of
         * characters.  An elipse (...) is appended to the end if this column is 
linked, and the user
         * can mouseover the elipse to get the full text. (optional)
         */
        private int mMaxLength;

        /**
         * If this attribute is provided, then the column's displayed is limited to 
this number of words.
         * An elipse (...) is appended to the end if this column is linked, and the 
user can mouseover
         * the elipse to get the full text. (optional)
         */
        private int mMaxWords;

        /**
         * Field mHeaderClazz
         */
        private String mHeaderClazz;

        /**
         * static value if no property attribute is provided
         */
        private Object mValue;

        /**
         * Field mDoubleQuote
         */
        private String mDoubleQuote;

        /** a class that should be used to "decorate" the underlying object being 
displayed. If a decorator
         * is specified for the entire table, then this decorator will decorate that 
decorator. (optional)
         */
        private String mDecorator;

        /**
         * Field mDecoratorObject
         */
        private ColumnDecorator mDecoratorObject;

        /**
         * Method getStaticContent
         * @return String
         */
        public String getStaticContent()
        {

                return mStaticContent;
        }

        /**
         * Method setProperty
         * @param pAttributeValue String
         */
        public void setProperty(String pAttributeValue)
        {
                mProperty= pAttributeValue;
        }

        /**
         * Method setTitle
         * @param pAttributeValue String
         */
        public void setTitle(String pAttributeValue)
        {
                mTitle= pAttributeValue;
        }

        /**
         * Method setNulls
         * @param pAttributeValue String
         */
        public void setNulls(String pAttributeValue)
        {
                if (!Boolean.FALSE.toString().equals(pAttributeValue))
                {
                        mNulls= true;
                }

        }

        /**
         * Method setSortable
         * @param pAttributeValue String
         */
        public void setSortable(String pAttributeValue)
        {
                if (!Boolean.FALSE.toString().equals(pAttributeValue))
                {
                        mSortable= true;
                }
        }

        /**
         *
         * @deprecated: use setSortable()
         * @param pAttributeValue String
         */
        public void setSort(String pAttributeValue)
        {
                setSortable(pAttributeValue);
        }

        /**
         * Method setAutolink
         * @param pAttributeValue String
         */
        public void setAutolink(String pAttributeValue)
        {
                if (!"false".equals(pAttributeValue))
                {
                        mAutolink= true;
                }
        }

        /**
         * Method setGroup
         * @param pAttributeValue String
         */
        public void setGroup(String pAttributeValue)
        {
                try
                {
                        mGroup= Integer.parseInt(pAttributeValue);
                }
                catch (NumberFormatException e)
                {
                        // ignore?
                }
        }

        /**
         * Method setHref
         * @param pAttributeValue String
         */
        public void setHref(String pAttributeValue)
        {
                mHref= new Href(pAttributeValue);
        }

        /**
         * Method setParamId
         * @param pAttributeValue String
         */
        public void setParamId(String pAttributeValue)
        {
                mParamId= pAttributeValue;
        }

        /**
         * Method setParamName
         * @param pAttributeValue String
         */
        public void setParamName(String pAttributeValue)
        {
                mParamName= pAttributeValue;
        }

        /**
         * Method setParamProperty
         * @param pAttributeValue String
         */
        public void setParamProperty(String pAttributeValue)
        {
                mParamProperty= pAttributeValue;
        }

        /**
         * Method setParamScope
         * @param pAttributeValue String
         */
        public void setParamScope(String pAttributeValue)
        {
                mParamScope= pAttributeValue;
        }

        /**
         * Method setMaxLength
         * @param pAttributeValue int
         */
        public void setMaxLength(int pAttributeValue)
        {
                mMaxLength= pAttributeValue;
        }

        /**
         * Method setMaxWords
         * @param pAttributeValue int
         */
        public void setMaxWords(int pAttributeValue)
        {
                mMaxWords= pAttributeValue;
        }

        /**
         * Method setWidth
         * @param pAttributeValue String
         */
        public void setWidth(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_WIDTH, pAttributeValue);
                mHeaderAttributeMap.put(TagConstants.ATTRIBUTE_WIDTH, pAttributeValue);
        }

        /**
         * Method setAlign
         * @param pAttributeValue String
         */
        public void setAlign(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_ALIGN, pAttributeValue);
                mHeaderAttributeMap.put(TagConstants.ATTRIBUTE_ALIGN, pAttributeValue);
        }

        /**
         * Method setBackground
         * @param pAttributeValue String
         */
        public void setBackground(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_BACKGROUND, pAttributeValue);
        }

        /**
         * Method setBgcolor
         * @param pAttributeValue String
         */
        public void setBgcolor(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_BGCOLOR, pAttributeValue);
        }

        /**
         * Method setHeight
         * @param pAttributeValue String
         */
        public void setHeight(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_HEIGHT, pAttributeValue);
        }

        /**
         * Method setNowrap
         * @param pAttributeValue String
         */
        public void setNowrap(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_NOWRAP, pAttributeValue);
        }

        /**
         * Method setValign
         * @param pAttributeValue String
         */
        public void setValign(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_VALIGN, pAttributeValue);
        }

        /**
         *
         * @deprecated: use setClass()
         * @param pAttributeValue String
         */
        public void setStyleClass(String pAttributeValue)
        {
                setClass(pAttributeValue);
        }

        /**
         * Method setClass
         * @param pAttributeValue String
         */
        public void setClass(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_CLASS, new 
MultipleHtmlAttribute(pAttributeValue));
        }

        /**
         * Method addClass
         * @param pAttributeValue String
         */
        public void addClass(String pAttributeValue)
        {
                Object lClassAttributes= 
mAttributeMap.get(TagConstants.ATTRIBUTE_CLASS);

                if (lClassAttributes == null)
                {
                        mAttributeMap.put(TagConstants.ATTRIBUTE_CLASS, new 
MultipleHtmlAttribute(pAttributeValue));
                }
                else
                {
                        ((MultipleHtmlAttribute) 
lClassAttributes).addAttributeValue(pAttributeValue);
                }
        }

        /**
         * Method setHeaderClass
         * @param pAttributeValue String
         */
        public void setHeaderClass(String pAttributeValue)
        {
                mHeaderAttributeMap.put(TagConstants.ATTRIBUTE_CLASS, new 
MultipleHtmlAttribute(pAttributeValue));
        }

        /**
         *
         * @deprecated: use setHeaderClass()
         * @param pAttributeValue String
         */
        public void setHeaderStyleClass(String pAttributeValue)
        {
                setHeaderClass(pAttributeValue);
        }

        /**
         * Method setValue
         * @param pAttributeValue Object
         */
        public void setValue(Object pAttributeValue)
        {
                mValue= pAttributeValue;
        }

        /**
         * Method setDoubleQuote
         * @param pAttributeValue String
         */
        public void setDoubleQuote(String pAttributeValue)
        {
                mDoubleQuote= pAttributeValue;
        }

        /**
         * Method setDecorator
         * @param pAttributeValue String
         */
        public void setDecorator(String pAttributeValue)
        {
                mDecorator= pAttributeValue;
        }

        /**
         * Method getDecoratorObject
         * @return ColumnDecorator
         */
        public ColumnDecorator getDecoratorObject()
        {
                return mDecoratorObject;
        }

        /**
         * Method setDecoratorObject
         * @param pDecorator ColumnDecorator
         */
        public void setDecoratorObject(ColumnDecorator pDecorator)
        {
                mDecoratorObject= pDecorator;
        }

        /**
         * Method getProperty
         * @return String
         */
        public String getProperty()
        {
                return mProperty;
        }

        /**
         * Method getTitle
         * @return String
         */
        public String getTitle()
        {
                return mTitle;
        }

        /**
         * Method getShowNulls
         * @return boolean
         */
        public boolean getShowNulls()
        {
                return mNulls;
        }

        /**
         * Method getAutolink
         * @return boolean
         */
        public boolean getAutolink()
        {
                return mAutolink;
        }

        /**
         * Method getHref
         * @return Href
         */
        public Href getHref()
        {
                return mHref;
        }

        /**
         * Method getParamId
         * @return String
         */
        public String getParamId()
        {
                return mParamId;
        }

        /**
         * Method getParamName
         * @return String
         */
        public String getParamName()
        {
                return mParamName;
        }

        /**
         * Method getParamProperty
         * @return String
         */
        public String getParamProperty()
        {
                return mParamProperty;
        }

        /**
         * Method getParamScope
         * @return String
         */
        public String getParamScope()
        {
                return mParamScope;
        }

        /**
         * Method getMaxLength
         * @return int
         */
        public int getMaxLength()
        {
                return mMaxLength;
        }

        /**
         * Method getMaxWords
         * @return int
         */
        public int getMaxWords()
        {
                return mMaxWords;
        }

        /**
         * Method getHeaderStyleClass
         * @return String
         */
        public String getHeaderStyleClass()
        {
                return mHeaderClazz;
        }

        /**
         * Method getValue
         * @return Object
         */
        public Object getValue()
        {
                return mValue;
        }

        /**
         * Method getDoubleQuote
         * @return String
         */
        public String getDoubleQuote()
        {
                return mDoubleQuote;
        }

        /**
         * Method getDecoratorClassName
         * @return String
         */
        public String getDecoratorClassName()
        {
                return mDecorator;
        }

        /**
         * Passes attribute information up to the parent TableTag.
         *
         * <p>When we hit the end of the tag, we simply let our parent (which better
         * be a TableTag) know what the user wants to do with this column.
         * We do that by simple registering this tag with the parent.  This tag's
         * only job is to hold the configuration information to describe this
         * particular column.  The TableTag does all the work.</p>
         *
         * @return int
         * @throws JspException if this tag is being used outside of a
         *    &lt;display:list...&gt; tag.
         * @see javax.servlet.jsp.tagext.Tag#doEndTag()
         **/

        public int doEndTag() throws JspException
        {

                TableTag lTableTag= (TableTag) findAncestorWithClass(this, 
TableTag.class);
                
                if (lTableTag == null)
                {
                        mLog.error("No ancestor table tag found");
                        throw new JspException("Can not use column tag outside of a 
TableTag.");
                }

                // add column header only once
                if (lTableTag.isFirstIteration())
                {

                        HeaderCell lHeaderCell= new HeaderCell();
                        lHeaderCell.setHeaderAttributes((Map) 
mHeaderAttributeMap.clone());
                        lHeaderCell.setHtmlAttributes((Map) mAttributeMap.clone());
                        lHeaderCell.getTitle(mTitle);
                        lHeaderCell.setSortable(mSortable);
                        
lHeaderCell.setColumnDecorator(DecoratorFactory.loadColumnDecorator(mDecorator));
                        lHeaderCell.setBeanPropertyName(mProperty);
                        lHeaderCell.setShowNulls(mNulls);
                        lHeaderCell.setMaxLength(mMaxLength);
                        lHeaderCell.setMaxWords(mMaxWords);
                        lHeaderCell.setAutoLink(mAutolink);
                        lHeaderCell.setGroup(mGroup);
                        lTableTag.addColumn(lHeaderCell);
                        mLog.debug("columnTag.doEndTag() :: first iteration - adding 
header" + lHeaderCell);
                }

                // mLog.debug("columnTag.doEndTag() :: creating cell");
                Cell lCell;

                if (mProperty == null)
                {

                        Object lCellValue;

                        if (mValue != null)
                        {
                                lCellValue= mValue;
                        }
                        else if (getBodyContent() != null)
                        {
                                String lValue= null;
                                BodyContent lBodyContent= getBodyContent();
                                if (lBodyContent != null)
                                {
                                        lValue= lBodyContent.getString();
                                }

                                if (lValue == null && mNulls)
                                {
                                        lValue= "";
                                }

                                lCellValue= lValue;
                        }
                        else
                        {
                                mLog.error("Column tag: you must specify a property or 
value attribute, or a body");
                                throw new JspException("Column tag: you must specify a 
property or value attribute, or a body");
                        }
                        lCell= new Cell(lCellValue);

                }
                else
                {
                        lCell= Cell.EMPTY_CELL;
                }

                lTableTag.addCell(lCell);

                mAttributeMap.clear();
                mHeaderAttributeMap.clear();
                mStaticContent= null;
                mParamName= null;

                return super.doEndTag();
        }

        /**
         * Returns a String representation of this Tag that is suitable for
         * printing while debugging.  The format of the string is subject to change
         * but it currently:
         *
         * <p><code>ColumnTag([title],[property],[href])</code></p>
         *
         * <p>Where the placeholders in brackets are replaced with their appropriate
         * instance variables.</p>
         * @return String
         **/

        public String toString()
        {
                return "ColumnTag(" + mTitle + "," + mProperty + "," + mHref + ")";
        }

        /**
         * Method release
         * @see javax.servlet.jsp.tagext.Tag#release()
         */
        public void release()
        {

                super.release();
        }

        /**
         * Field mColumnNumber
         */
        private int mColumnNumber;

        /**
         * Method setColumnNumber
         * @param pColumnNumber int
         */
        public void setColumnNumber(int pColumnNumber)
        {
                mColumnNumber= pColumnNumber;
        }

        /**
         * Method getColumnNumber
         * @return int
         */
        public int getColumnNumber()
        {
                return mColumnNumber;
        }

        /**
         * Field mAlreadySorted
         */
        private boolean mAlreadySorted= false;

        /**
         * Method isAlreadySorted
         * @return boolean
         */
        public boolean isAlreadySorted()
        {
                return mAlreadySorted;
        }

        /**
         * Method setAlreadySorted
         */
        public void setAlreadySorted()
        {
                mAlreadySorted= true;
        }

}

--- NEW FILE: ColumnTagBeanInfo.java ---
package org.apache.taglibs.display.tags;

import org.apache.taglibs.display.util.BeanInfoUtil;

/**
 * @author fgiust
 * @version $Revision: 1.1 $ ($Author: fgiust $)
 * @see org.apache.taglibs.display.util.BeanInfoUtil
 */
public class ColumnTagBeanInfo extends BeanInfoUtil
{

}
--- NEW FILE: HtmlTableTag.java ---
package org.apache.taglibs.display.tags;

import java.util.HashMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.taglibs.display.model.HtmlAttributeMap;
import org.apache.taglibs.display.model.TagConstants;

/**
 * @author fgiust
 * @version $Revision: 1.1 $ ($Author: fgiust $)
 */
public class HtmlTableTag extends TemplateTag
{

        /**
         * Field mLog
         */
        private static Log mLog= LogFactory.getLog(HtmlTableTag.class);

        /**
         * Field mAttributeMap
         */
        private HashMap mAttributeMap= new HtmlAttributeMap();

        /**
         * Method setWidth
         * @param pAttributeValue String
         */
        public void setWidth(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_WIDTH, pAttributeValue);
        }

        /**
         * Method setBorder
         * @param pAttributeValue String
         */
        public void setBorder(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_BORDER, pAttributeValue);
        }

        /**
         * Method setCellspacing
         * @param pAttributeValue String
         */
        public void setCellspacing(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_CELLSPACING, pAttributeValue);
        }

        /**
         * Method setCellpadding
         * @param pAttributeValue String
         */
        public void setCellpadding(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_CELLPADDING, pAttributeValue);
        }

        /**
         * Method setAlign
         * @param pAttributeValue String
         */
        public void setAlign(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_ALIGN, pAttributeValue);
        }

        /**
         * Method setBackground
         * @param pAttributeValue String
         */
        public void setBackground(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_BACKGROUND, pAttributeValue);
        }

        /**
         * Method setBgcolor
         * @param pAttributeValue String
         */
        public void setBgcolor(String pAttributeValue)
        {

                mAttributeMap.put(TagConstants.ATTRIBUTE_BGCOLOR, pAttributeValue);
        }

        /**
         * Method setFrame
         * @param pAttributeValue String
         */
        public void setFrame(String pAttributeValue)
        {

                mAttributeMap.put(TagConstants.ATTRIBUTE_FRAME, pAttributeValue);
        }

        /**
         * Method setHeight
         * @param pAttributeValue String
         */
        public void setHeight(String pAttributeValue)
        {

                mAttributeMap.put(TagConstants.ATTRIBUTE_HEIGHT, pAttributeValue);
        }

        /**
         * Method setHspace
         * @param pAttributeValue String
         */
        public void setHspace(String pAttributeValue)
        {

                mAttributeMap.put(TagConstants.ATTRIBUTE_HSPACE, pAttributeValue);
        }

        /**
         * Method setRules
         * @param pAttributeValue String
         */
        public void setRules(String pAttributeValue)
        {

                mAttributeMap.put(TagConstants.ATTRIBUTE_RULES, pAttributeValue);
        }

        /**
         * Method setSummary
         * @param pAttributeValue String
         */
        public void setSummary(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_SUMMARY, pAttributeValue);
        }

        /**
         * Method setVspace
         * @param pAttributeValue String
         */
        public void setVspace(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_VSPACE, pAttributeValue);
        }

        /**
         *
         * @deprecated: use setClass()
         * @param pAttributeValue String attribute value
         */
        public void setStyleClass(String pAttributeValue)
        {
                setClass(pAttributeValue);
        }

        /**
         * Method setClass
         * @param pAttributeValue String attribute value
         */
        public void setClass(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_CLASS, pAttributeValue);
        }

        /**
         * Method setId
         * @param pAttributeValue String
         */
        public void setId(String pAttributeValue)
        {
                mAttributeMap.put(TagConstants.ATTRIBUTE_ID, pAttributeValue);
                super.setId(pAttributeValue);
        }

        /**
         * Method getOpenTag
         * @return String
         */
        public String getOpenTag()
        {

                if (mAttributeMap.size() == 0)
                {
                        return TagConstants.TAG_OPEN + TagConstants.TABLE_TAG_NAME + 
TagConstants.TAG_CLOSE;
                }

                StringBuffer lBuffer= new StringBuffer();

                
lBuffer.append(TagConstants.TAG_OPEN).append(TagConstants.TABLE_TAG_NAME);

                lBuffer.append(mAttributeMap);

                lBuffer.append(TagConstants.TAG_CLOSE);

                return lBuffer.toString();
        }

        /**
         * Method getCloseTag
         * @return String
         */
        public String getCloseTag()
        {
                return TagConstants.TAG_OPENCLOSING + TagConstants.TABLE_TAG_NAME + 
TagConstants.TAG_CLOSE;
        }

        /**
         * Method release
         * @see javax.servlet.jsp.tagext.Tag#release()
         */
        public void release()
        {
                mAttributeMap.clear();
                super.release();
        }

}

--- NEW FILE: SetPropertyTag.java ---
package org.apache.taglibs.display.tags;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author fgiust
 * @version $Revision: 1.1 $ ($Author: fgiust $)
 */
public class SetPropertyTag extends BodyTagSupport implements Cloneable
{

        /**
         * Field mLog
         */
        private static Log mLog= LogFactory.getLog(SetPropertyTag.class);

        /**
         * Field mName
         */
        private String mName;

        /**
         * Field mValue
         */
        private String mValue;

        /**
         * Method setName
         * @param pName String
         */
        public void setName(String pName)
        {
                mName= pName;
        }

        /**
         * Method setValue
         * @param pValue String
         */
        public void setValue(String pValue)
        {
                mValue= pValue;
        }

        /**
         * Method getName
         * @return String
         */
        public String getName()
        {
                return mName;
        }

        /**
         * Method getValue
         * @return String
         */
        public String getValue()
        {
                return mValue;
        }

        /**
         * Passes attribute information up to the parent TableTag.<p>
         *
         * When we hit the end of the tag, we simply let our parent (which better
         * be a TableTag) know what the user wants to change a property value, and
         * we pass the name/value pair that the user gave us, up to the parent
         *
         * @return int
         * @throws JspException if no parent table tag is found
         * @see javax.servlet.jsp.tagext.Tag#doEndTag()
         **/
        public int doEndTag() throws JspException
        {

                TableTag lTableTag= (TableTag) findAncestorWithClass(this, 
TableTag.class);

                if (lTableTag == null)
                {
                        mLog.error("No ancestor table tag found");
                        throw new JspException("Can not use property tag outside of a 
TableTag.");
                }

                lTableTag.setProperty(mName, mValue);

                return super.doEndTag();
        }

}

--- NEW FILE: TableProperties.java ---
package org.apache.taglibs.display.tags;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import javax.servlet.jsp.JspException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author fgiust
 * @version $Revision: 1.1 $ ($Author: fgiust $)
 */
public class TableProperties
{

        /**
         * Field mLog
         */
        private static Log mLog= LogFactory.getLog(TableProperties.class);

        /**
         * Field DEFAULT_FILENAME
         */
        private static final String DEFAULT_FILENAME= "TableTag.properties";

        /**
         * Field mPropertiesFilename
         */
        private static String mPropertiesFilename= DEFAULT_FILENAME;

        /**
         * Field mUserFilename
         */
        private static String mUserFilename= null;

        /**
         *
         * @return the String value of mPropertiesFilename.
         */
        public static String getPropertiesFilename()
        {
                return mUserFilename;
        }

        /**
         *
         * @param pPropertiesFilename - the new value for mPropertiesFilename
         */
        public static void setPropertiesFilename(String pPropertiesFilename)
        {
                mUserFilename= pPropertiesFilename;
        }

        /**
         * Field mProp
         */
        private Properties mProp= null;

        /**
         * Field PROPERTY_BOOLEAN_EXPORTCSV
         */
        private static final String PROPERTY_BOOLEAN_EXPORTCSV= "export.csv";
        /**
         * Field PROPERTY_BOOLEAN_EXPORTEXCEL
         */
        private static final String PROPERTY_BOOLEAN_EXPORTEXCEL= "export.excel";
        /**
         * Field PROPERTY_BOOLEAN_EXPORTXML
         */
        private static final String PROPERTY_BOOLEAN_EXPORTXML= "export.xml";

        /**
         * Field PROPERTY_STRING_EXPORTCSV_LABEL
         */
        private static final String PROPERTY_STRING_EXPORTCSV_LABEL= 
"export.csv.label";
        /**
         * Field PROPERTY_STRING_EXPORTEXCEL_LABEL
         */
        private static final String PROPERTY_STRING_EXPORTEXCEL_LABEL= 
"export.excel.label";
        /**
         * Field PROPERTY_STRING_EXPORTXML_LABEL
         */
        private static final String PROPERTY_STRING_EXPORTXML_LABEL= 
"export.xml.label";


        /**
         * Field PROPERTY_BOOLEAN_EXPORTCSV_HEADER
         */
        private static final String PROPERTY_BOOLEAN_EXPORTCSV_HEADER= 
"export.csv.include_header";
        /**
         * Field PROPERTY_BOOLEAN_EXPORTEXCEL_HEADER
         */
        private static final String PROPERTY_BOOLEAN_EXPORTEXCEL_HEADER= 
"export.excel.include_header";

        /**
         * Field PROPERTY_STRING_EXPORTBANNER
         */
        private static final String PROPERTY_STRING_EXPORTBANNER= "export.banner";
        /**
         * Field PROPERTY_STRING_EXPORTBANNER_SEPARATOR
         */
        private static final String PROPERTY_STRING_EXPORTBANNER_SEPARATOR= 
"export.banner.sepchar";

        /**
         * Field PROPERTY_BOOLEAN_EXPORTDECORATED
         */
        private static final String PROPERTY_BOOLEAN_EXPORTDECORATED= 
"export.decorated";

        /**
         * Field PROPERTY_STRING_EXPORTAMOUNT
         */
        private static final String PROPERTY_STRING_EXPORTAMOUNT= "export.amount";
        /**
         * Field PROPERTY_STRING_EXPORT_FILENAME
         */
        private static final String PROPERTY_STRING_EXPORT_FILENAME= "export.filename";

        /**
         * Field PROPERTY_BOOLEAN_SHOWHEADER
         */
        private static final String PROPERTY_BOOLEAN_SHOWHEADER= "basic.show.header";
        /**
         * Field PROPERTY_STRING_EMPTYLIST_MESSAGE
         */
        private static final String PROPERTY_STRING_EMPTYLIST_MESSAGE= 
"basic.msg.empty_list";

        /**
         * Field PROPERTY_STRING_BANNER_PLACEMENT
         */
        private static final String PROPERTY_STRING_BANNER_PLACEMENT= 
"paging.banner.placement";

        /**
         * Field PROPERTY_STRING_PAGING_INVALIDPAGE
         */
        private static final String PROPERTY_STRING_PAGING_INVALIDPAGE= 
"error.msg.invalid_page";

        /**
         * Field PROPERTY_STRING_PAGING_ITEM_NAME
         */
        private static final String PROPERTY_STRING_PAGING_ITEM_NAME= 
"paging.banner.item_name";
        /**
         * Field PROPERTY_STRING_PAGING_ITEMS_NAME
         */
        private static final String PROPERTY_STRING_PAGING_ITEMS_NAME= 
"paging.banner.items_name";
        /**
         * Field PROPERTY_STRING_PAGING_NOITEMS
         */
        private static final String PROPERTY_STRING_PAGING_NOITEMS= 
"paging.banner.no_items_found";
        /**
         * Field PROPERTY_STRING_PAGING_FOUND_ONEITEM
         */
        private static final String PROPERTY_STRING_PAGING_FOUND_ONEITEM= 
"paging.banner.one_item_found";
        /**
         * Field PROPERTY_STRING_PAGING_FOUND_ALLITEMS
         */
        private static final String PROPERTY_STRING_PAGING_FOUND_ALLITEMS= 
"paging.banner.all_items_found";
        /**
         * Field PROPERTY_STRING_PAGING_FOUND_SOMEITEMS
         */
        private static final String PROPERTY_STRING_PAGING_FOUND_SOMEITEMS= 
"paging.banner.some_items_found";

        /**
         * Field PROPERTY_INT_PAGING_GROUPSIZE
         */
        private static final String PROPERTY_INT_PAGING_GROUPSIZE= 
"paging.banner.group_size";
        /**
         * Field PROPERTY_STRING_PAGING_BANNER_ONEPAGE
         */
        private static final String PROPERTY_STRING_PAGING_BANNER_ONEPAGE= 
"paging.banner.onepage";
        /**
         * Field PROPERTY_STRING_PAGING_BANNER_FIRST
         */
        private static final String PROPERTY_STRING_PAGING_BANNER_FIRST= 
"paging.banner.first";
        /**
         * Field PROPERTY_STRING_PAGING_BANNER_LAST
         */
        private static final String PROPERTY_STRING_PAGING_BANNER_LAST= 
"paging.banner.last";
        /**
         * Field PROPERTY_STRING_PAGING_BANNER_FULL
         */
        private static final String PROPERTY_STRING_PAGING_BANNER_FULL= 
"paging.banner.full";
        /**
         * Field PROPERTY_STRING_PAGING_PAGE_LINK
         */
        private static final String PROPERTY_STRING_PAGING_PAGE_LINK= 
"paging.banner.page.link";
        /**
         * Field PROPERTY_STRING_PAGING_PAGE_SELECTED
         */
        private static final String PROPERTY_STRING_PAGING_PAGE_SELECTED= 
"paging.banner.page.selected";
        /**
         * Field PROPERTY_STRING_PAGING_PAGE_SPARATOR
         */
        private static final String PROPERTY_STRING_PAGING_PAGE_SPARATOR= 
"paging.banner.page.separator";

        /**
         * Field PROPERTY_STRING_SAVE_EXCEL_FILENAME
         */
        private static final String PROPERTY_STRING_SAVE_EXCEL_FILENAME= 
"save.excel.filename";
        /**
         * Field PROPERTY_STRING_SAVE_EXCEL_BANNER
         */
        private static final String PROPERTY_STRING_SAVE_EXCEL_BANNER= 
"save.excel.banner";

        /**
         * Method getPagingInvalidPage
         * @return String
         */
        public String getPagingInvalidPage()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_INVALIDPAGE);
        }

        /**
         * Method getPagingItemName
         * @return String
         */
        public String getPagingItemName()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_ITEM_NAME);
        }

        /**
         * Method getPagingItemsName
         * @return String
         */
        public String getPagingItemsName()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_ITEMS_NAME);
        }

        /**
         * Method getPagingFoundNoItems
         * @return String
         */
        public String getPagingFoundNoItems()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_NOITEMS);
        }

        /**
         * Method getPagingFoundOneItem
         * @return String
         */
        public String getPagingFoundOneItem()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_FOUND_ONEITEM);
        }

        /**
         * Method getPagingFoundAllItems
         * @return String
         */
        public String getPagingFoundAllItems()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_FOUND_ALLITEMS);
        }

        /**
         * Method getPagingFoundSomeItems
         * @return String
         */
        public String getPagingFoundSomeItems()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_FOUND_SOMEITEMS);
        }

        /**
         * Method getPagingGroupSize
         * @param pDefault int
         * @return int
         */
        public int getPagingGroupSize(int pDefault)
        {
                return getIntProperty(PROPERTY_INT_PAGING_GROUPSIZE, pDefault);
        }

        /**
         * Method getPagingBannerOnePage
         * @return String
         */
        public String getPagingBannerOnePage()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_BANNER_ONEPAGE);
        }

        /**
         * Method getPagingBannerFirst
         * @return String
         */
        public String getPagingBannerFirst()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_BANNER_FIRST);
        }

        /**
         * Method getPagingBannerLast
         * @return String
         */
        public String getPagingBannerLast()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_BANNER_LAST);
        }

        /**
         * Method getPagingBannerFull
         * @return String
         */
        public String getPagingBannerFull()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_BANNER_FULL);
        }

        /**
         * Method getPagingPageLink
         * @return String
         */
        public String getPagingPageLink()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_PAGE_LINK);
        }

        /**
         * Method getPagingPageSelected
         * @return String
         */
        public String getPagingPageSelected()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_PAGE_SELECTED);
        }

        /**
         * Method getPagingPageSeparator
         * @return String
         */
        public String getPagingPageSeparator()
        {
                return mProp.getProperty(PROPERTY_STRING_PAGING_PAGE_SPARATOR);
        }

        /**
         * Method getAddCsvExport
         * @return boolean
         */
        protected boolean getAddCsvExport()
        {
                return getBooleanProperty(PROPERTY_BOOLEAN_EXPORTCSV);
        }

        /**
         * Method getAddExcelExport
         * @return boolean
         */
        protected boolean getAddExcelExport()
        {
                return getBooleanProperty(PROPERTY_BOOLEAN_EXPORTEXCEL);
        }

        /**
         * Method getAddXmlExport
         * @return boolean
         */
        protected boolean getAddXmlExport()
        {
                return getBooleanProperty(PROPERTY_BOOLEAN_EXPORTXML);
        }

        /**
         * Method getExportCsvHeader
         * @return boolean
         */
        protected boolean getExportCsvHeader()
        {
                return getBooleanProperty(PROPERTY_BOOLEAN_EXPORTCSV_HEADER);
        }

        /**
         * Method getExportExcelHeader
         * @return boolean
         */
        protected boolean getExportExcelHeader()
        {
                return getBooleanProperty(PROPERTY_BOOLEAN_EXPORTEXCEL_HEADER);
        }

        /**
         * Method getExportDecorated
         * @return boolean
         */
        protected boolean getExportDecorated()
        {
                return getBooleanProperty(PROPERTY_BOOLEAN_EXPORTDECORATED);
        }

        /**
         * Method getExportCsvLabel
         * @return String
         */
        protected String getExportCsvLabel()
        {
                return mProp.getProperty(PROPERTY_STRING_EXPORTCSV_LABEL);
        }

        /**
         * Method getExportExcelLabel
         * @return String
         */
        protected String getExportExcelLabel()
        {
                return mProp.getProperty(PROPERTY_STRING_EXPORTEXCEL_LABEL);
        }

        /**
         * Method getExportXmlLabel
         * @return String
         */
        protected String getExportXmlLabel()
        {
                return mProp.getProperty(PROPERTY_STRING_EXPORTXML_LABEL);
        }

        /**
         * Method getExportFileName
         * @return String
         */
        protected String getExportFileName()
        {
                return mProp.getProperty(PROPERTY_STRING_EXPORT_FILENAME);
        }

        /**
         * Method getExportBanner
         * @return String
         */
        protected String getExportBanner()
        {
                return mProp.getProperty(PROPERTY_STRING_EXPORTBANNER);
        }

        /**
         * Method getExportBannerSeparator
         * @return String
         */
        protected String getExportBannerSeparator()
        {
                return mProp.getProperty(PROPERTY_STRING_EXPORTBANNER_SEPARATOR);
        }

        /**
         * Method getShowHeader
         * @return boolean
         */
        protected boolean getShowHeader()
        {
                return getBooleanProperty(PROPERTY_BOOLEAN_SHOWHEADER);
        }

        /**
         * Method getEmptyListMessage
         * @return String
         */
        protected String getEmptyListMessage()
        {
                return mProp.getProperty(PROPERTY_STRING_EMPTYLIST_MESSAGE);
        }

        /**
         * Method getExportFullList
         * @return boolean
         */
        protected boolean getExportFullList()
        {
                return "list".equals(mProp.getProperty(PROPERTY_STRING_EXPORTAMOUNT));
        }

        /**
         * Method getAddPagingBannerTop
         * @return boolean
         */
        protected boolean getAddPagingBannerTop()
        {
                String lPlacement= mProp.getProperty(PROPERTY_STRING_BANNER_PLACEMENT);
                return ("top".equals(lPlacement) || "both".equals(lPlacement));
        }

        /**
         * Method getAddPagingBannerBottom
         * @return boolean
         */
        protected boolean getAddPagingBannerBottom()
        {
                String lPlacement= mProp.getProperty(PROPERTY_STRING_BANNER_PLACEMENT);
                return ("bottom".equals(lPlacement) || "both".equals(lPlacement));
        }

        /**
         * Method getSaveExcelFilename
         * @return String
         */
        protected String getSaveExcelFilename()
        {
                return mProp.getProperty(PROPERTY_STRING_SAVE_EXCEL_FILENAME);
        }

        /**
         * Method getSaveExcelBanner
         * @return String
         */
        protected String getSaveExcelBanner()
        {
                return mProp.getProperty(PROPERTY_STRING_SAVE_EXCEL_BANNER);
        }

        /**
         * Initialize a new TableProperties loading the default properties file and 
the user defined one
         * @throws JspException for errors in loading .properties files
         */
        public TableProperties() throws JspException
        {

                Properties lDefaultProperties= new Properties();

                try
                {
                        mLog.debug("loading default properties");
                        
lDefaultProperties.load(this.getClass().getResourceAsStream(mPropertiesFilename));
                        mProp= new Properties(lDefaultProperties);
                }
                catch (IOException ex)
                {
                        throw new JspException("Unable to load default properties");
                }

                String lUserPropertiesFileName= getPropertiesFilename();

                if (lUserPropertiesFileName != null)
                {

                        mLog.debug("loading user defined properties file @ " + 
lUserPropertiesFileName);

                        try
                        {
                                FileInputStream lFileInput= new 
FileInputStream(lUserPropertiesFileName);
                                mProp.load(lFileInput);
                                lFileInput.close();
                        }
                        catch (FileNotFoundException ex1)
                        {
                                throw new JspException("Unable to find user properties 
file @ " + lUserPropertiesFileName);
                        }

                        catch (IOException ex1)
                        {
                                throw new JspException("Unable to read user properties 
file @ " + lUserPropertiesFileName);
                        }

                }
        }

        /**
         * Method getProperty
         * @param pPropertyName String
         * @return String
         */
        private String getProperty(String pPropertyName)
        {
                return mProp.getProperty(pPropertyName);
        }

        /**
         * Method setProperty
         * @param pPropertyName String
         * @param pPropertyValue String
         */
        public void setProperty(String pPropertyName, String pPropertyValue)
        {
                mProp.setProperty(pPropertyName, pPropertyValue);
        }

        /**
         * Method getBooleanProperty
         * @param pPropertyName String
         * @return boolean
         */
        private boolean getBooleanProperty(String pPropertyName)
        {
                return 
Boolean.TRUE.toString().equals(mProp.getProperty(pPropertyName));
        }

        /**
         * Method getIntProperty
         * @param pPropertyName String
         * @param pDefault int
         * @return int
         */
        private int getIntProperty(String pPropertyName, int pDefault)
        {
                int lInt= pDefault;
                try
                {
                        lInt= Integer.parseInt(mProp.getProperty(pPropertyName));
                }
                catch (NumberFormatException e)
                {
                        // Don't care, use default
                }

                return lInt;
        }

}
--- NEW FILE: TableTag.java ---
package org.apache.taglibs.display.tags;

import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;

import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;

import org.apache.commons.collections.IteratorUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.taglibs.display.decorator.DecoratorFactory;
import org.apache.taglibs.display.decorator.TableDecorator;
[...1216 lines suppressed...]
         * Called by the setProperty tag to override some default behavior or text
         * string.
         * @param pName String
         * @param pValue String
         */
        public void setProperty(String pName, String pValue)
        {
                mProp.setProperty(pName, pValue);
        }

        /**
         * Method release
         * @see javax.servlet.jsp.tagext.Tag#release()
         */
        public void release()
        {
                super.release();
        }

}

--- NEW FILE: TableTag.properties ---
basic.msg.empty_list=Nothing found to display
basic.show.header=true
error.msg.invalid_page=invalid page

export.amount=list
export.decorated=true
export.banner=<div class="exportlinks">{0}</div>
export.banner.sepchar= | 

export.csv=true
export.csv.label=<span class="excel">CSV</span>
export.csv.include_header=false

export.excel=true
export.excel.label=<span class="excel">Excel</span>
export.excel.include_header=true

export.xml=true
export.xml.label=<span class="excel">XML</span>

paging.banner.item_name=item
paging.banner.items_name=items

paging.banner.no_items_found=<div>No {0} found.</div>
paging.banner.one_item_found=<div>{0} item found.</div>
paging.banner.all_items_found=<div>{0} {1} found, showing all {2}</div>
paging.banner.some_items_found=<div>{0} {1} found, displaying {2} to {3}</div>


paging.banner.full=[<a href="{1}">First</a>/<a href="{2}">Prev</a>] {0} [<a 
href="{3}">Next</a>/<a href="{4}">Last</a>]
paging.banner.first=[First/Prev] {0} [<a href="{3}">Next</a>/<a href="{4}">Last</a>]
paging.banner.last=[<a href="{1}">First</a>/<a href="{2}">Prev</a>] {0} [Next/Last]
paging.banner.onepage={0}

paging.banner.group_size=8

paging.banner.page.selected=<strong>{0}</strong>
paging.banner.page.link=<a href="{1}" title="go to page {0}">{0}</a>
paging.banner.page.separator=, 
paging.banner.placement=top



save.excel.banner=<a href="{0}" rel="external">save ({1} bytes)</a>
save.excel.filename=export.xls


--- NEW FILE: TableTagBeanInfo.java ---
package org.apache.taglibs.display.tags;

import org.apache.taglibs.display.util.BeanInfoUtil;

/**
 * @author fgiust
 * @see org.apache.taglibs.display.util.BeanInfoUtil
 * @version $Revision: 1.1 $ ($Author: fgiust $)
 */
public class TableTagBeanInfo extends BeanInfoUtil
{

}
--- NEW FILE: TableTagExtraInfo.java ---
package org.apache.taglibs.display.tags;

import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;

/**
 * @author fgiust
 * @version $Revision: 1.1 $ ($Author: fgiust $)
 */
public class TableTagExtraInfo extends TagExtraInfo
{
        
        /**
         * suffix added to id for saving row number in pagecontext
         */
        public static final String ROWNUM_SUFFIX= "_rowNum";
        
        /**
         * Variabiles TableTag makes available in the pageContext
         * @param pData TagData
         * @return VariableInfo[]
         * @see javax.servlet.jsp.tagext.TagData
         * @see javax.servlet.jsp.tagext.VariableInfo
         */
        public VariableInfo[] getVariableInfo(TagData pData)
        {
                // if id is null don't define anything
                if (pData.getId() == null)
                {
                        return new VariableInfo[] {
                        };
                }

                // current row
                VariableInfo lInfo1= new VariableInfo(pData.getId(), 
"java.lang.Object", true, VariableInfo.NESTED);

                // current row number
                VariableInfo lInfo2=
                        new VariableInfo(pData.getId() + ROWNUM_SUFFIX, 
"java.lang.Integer", true, VariableInfo.NESTED);

                return new VariableInfo[] { lInfo1, lInfo2 };
        }

}

--- NEW FILE: TableTagParameters.java ---
package org.apache.taglibs.display.tags;

/**
 * @author fgiust
 * @version $Revision: 1.1 $ ($Author: fgiust $)
 */
public interface TableTagParameters
{

        /**
         * Field PARAMETER_SORT
         */
        static final String PARAMETER_SORT= "sort";
        /**
         * Field PARAMETER_PREVIOUSSORT
         */
        static final String PARAMETER_PREVIOUSSORT= "psort";
        /**
         * Field PARAMETER_PAGE
         */
        static final String PARAMETER_PAGE= "page";
        /**
         * Field PARAMETER_ORDER
         */
        static final String PARAMETER_ORDER= "order";
        /**
         * Field PARAMETER_PREVIOUSORDER
         */
        static final String PARAMETER_PREVIOUSORDER= "porder";
        /**
         * Field PARAMETER_EXPORTTYPE
         */
        static final String PARAMETER_EXPORTTYPE= "exportType";

        /**
         * Field EXPORT_TYPE_NONE
         */
        static final int EXPORT_TYPE_NONE= -1;
        /**
         * Field EXPORT_TYPE_CSV
         */
        static final int EXPORT_TYPE_CSV= 1;
        /**
         * Field EXPORT_TYPE_EXCEL
         */
        static final int EXPORT_TYPE_EXCEL= 2;
        /**
         * Field EXPORT_TYPE_XML
         */
        static final int EXPORT_TYPE_XML= 3;
        
        /**
         * Field SORT_AMOUNT_PAGE
         */
        static final String SORT_AMOUNT_PAGE= "page";
        
        /**
         * Field SORT_AMOUNT_LIST
         */
        static final String SORT_AMOUNT_LIST= "list";

        /**
         * Field VALUE_SORT_DESCENDING
         */
        static final int VALUE_SORT_DESCENDING= 1;
        /**
         * Field VALUE_SORT_ASCENDING
         */
        static final int VALUE_SORT_ASCENDING= 2;

        /**
         * Field CSS_ODDROW
         */
        static final String CSS_ODDROW= "odd";
        /**
         * Field CSS_EVENROW
         */
        static final String CSS_EVENROW= "even";
        /**
         * Field CSS_EMPTYLIST
         */
        static final String CSS_EMPTYLIST= "empty";

}
--- NEW FILE: TemplateTag.java ---
package org.apache.taglibs.display.tags;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.BodyTagSupport;

import org.apache.taglibs.display.util.LookupUtil;

/**
 * Base template class
 * @author bgsmith
 * @version $Revision: 1.1 $ ($Author: fgiust $)
 */
public abstract class TemplateTag extends BodyTagSupport
{

        /**
         * Utility method. Write a string to the default out
         * @param pString String
         * @throws JspTagException if an IOException occurs
         */
        public void write(String pString) throws JspTagException
        {
                try
                {
                        JspWriter lOut= pageContext.getOut();
                        lOut.write(pString);
                }
                catch (IOException e)
                {
                        throw new JspTagException("Writer Exception: " + 
e.getMessage());
                }
        }

        /**
         * Utility method. Write a string to the default out
         * @param pString StringBuffer
         * @throws JspTagException if an IOException occurs
         */
        public void write(StringBuffer pString) throws JspTagException
        {
                this.write(pString.toString());
        }

        /**
         * <p>evaluate an expression in a way similar to LE in jstl.</p>
         * <p>the first token is supposed to be an object in the page scope (default 
scope) or one of the following:</p>
         * <ul>
         *      <li>pageScope</li>
         *      <li>requestScope</li>
         *      <li>sessionScope</li>
         *      <li>applicationScope</li>
         * </ul>
         * <p>Tokens after the object name are interpreted as javabean properties 
(accessed through getters), mapped or
         * indexed properties, using the jakarta common-beans library</p>
         * @param pExpression expression to evaluate
         * @return Object result
         * @throws JspException generic exception
         */
        protected Object evaluateExpression(String pExpression) throws JspException
        {

                String lExpression= pExpression;

                // default scope = request
                // this is for compatibility with the previous version, probably 
default should be PAGE
                int lScope= PageContext.REQUEST_SCOPE;

                if (pExpression.startsWith("pageScope."))
                {
                        lScope= PageContext.PAGE_SCOPE;
                        lExpression= lExpression.substring(lExpression.indexOf('.') + 
1);
                }
                else if (pExpression.startsWith("requestScope."))
                {
                        lScope= PageContext.REQUEST_SCOPE;
                        lExpression= lExpression.substring(lExpression.indexOf('.') + 
1);

                }
                else if (pExpression.startsWith("sessionScope."))
                {
                        lScope= PageContext.SESSION_SCOPE;
                        lExpression= lExpression.substring(lExpression.indexOf('.') + 
1);

                }
                else if (pExpression.startsWith("applicationScope."))
                {
                        lScope= PageContext.APPLICATION_SCOPE;
                        lExpression= lExpression.substring(lExpression.indexOf('.') + 
1);

                }

                return LookupUtil.getBeanValue(pageContext, lExpression, lScope);

        }
        
}




-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to