KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > mlw > vlh > web > tag > DefaultColumnsTag


1 /**
2  * Copyright (c) 2003 held jointly by the individual authors.
3  *
4  * This library is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published
6  * by the Free Software Foundation; either version 2.1 of the License, or
7  * (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; with out even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation,
16  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  *
18  * > http://www.gnu.org/copyleft/lesser.html
19  * > http://www.opensource.org/licenses/lgpl-license.php
20  */

21 package net.mlw.vlh.web.tag;
22
23 import java.util.ArrayList JavaDoc;
24 import java.util.Collection JavaDoc;
25
26 import javax.servlet.jsp.JspException JavaDoc;
27
28 import net.mlw.vlh.ValueListInfo;
29 import net.mlw.vlh.web.util.JspUtils;
30
31 /**
32  * @todo Document this tag.
33  *
34  * @author Matthew L. Wilson
35  * @version $Revision: 1.6 $ $Date: 2005/11/23 15:02:16 $
36  */

37 public abstract class DefaultColumnsTag extends ConfigurableTag
38 {
39    /** Commons logger. */
40    // private static final Log LOGGER = LogFactory.getLog(DefaultColumnsTag.class);
41

42    protected Integer JavaDoc defaultSort;
43
44    /** Holds the included properties. */
45    protected Collection JavaDoc include = new ArrayList JavaDoc();
46
47    /** Holds the excluded properties. */
48    protected Collection JavaDoc exclude = new ArrayList JavaDoc();
49
50    /**
51     * Sets the defaultSort property.
52     *
53     * @param value
54     * Valid values are "asc" and "desc".
55     */

56    public void setSortable(String JavaDoc value)
57    {
58       if ("asc".equals(value))
59       {
60          defaultSort = ValueListInfo.ASCENDING;
61       }
62       else if ("desc".equals(value))
63       {
64          defaultSort = ValueListInfo.DESCENDING;
65       }
66    }
67
68    /**
69     * Setter for the included properties
70     *
71     * @param included
72     * The included properties
73     */

74    public void setInclude(String JavaDoc included)
75    {
76       include = JspUtils.toCollection(included, "|");
77    }
78
79    /**
80     * Setter for the excluded properties
81     *
82     * @param excluded
83     * The excluded properties
84     */

85    public void setExclude(String JavaDoc excluded)
86    {
87       exclude = JspUtils.toCollection(excluded, "|");
88    }
89
90    /**
91     * @see javax.servlet.jsp.tagext.Tag#doEndTag()
92     */

93    public int doEndTag() throws JspException JavaDoc
94    {
95       int result = super.doEndTag();
96       reset();
97       return result;
98    }
99
100    private void reset()
101    {
102       this.defaultSort = null;
103       this.exclude.clear();
104       this.include.clear();
105    }
106
107    /**
108     * Called on a Tag handler to release state.
109     * The page compiler guarantees that JSP page implementation
110     * objects will invoke this method on all tag handlers,
111     * but there may be multiple invocations on doStartTag and doEndTag in between.
112     *
113     * @see javax.servlet.jsp.tagext.Tag#release()
114     */

115    public void release()
116    {
117       super.release();
118       reset();
119    }
120 }
Popular Tags