KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > patterns > listdata > www > ListDataPageSizeTag


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: ListDataPageSizeTag.java,v 1.2 2007/02/20 04:18:18 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21  
22 package org.opensubsystems.patterns.listdata.www;
23
24 import org.opensubsystems.patterns.listdata.data.ListOptions;
25
26
27 /**
28  * Custom tag to generate hyperlink that can invoke instance of
29  * ListBrowserServlet and display the current page with specific number of items.
30  * This class implements functionality similar to methods in listdata.js but
31  * only based on the data available at the time when the page is generated. If
32  * the page dynamically changes some of the list data pattern variables for
33  * example based on users' action, you should use methods in the listdata.js
34  * instead. Keep this functionality synchronized with the one provided by the
35  * JavaScript file.
36  *
37  * @version $Id: ListDataPageSizeTag.java,v 1.2 2007/02/20 04:18:18 bastafidli Exp $
38  * @author Miro Halas
39  * @code.reviewer Miro Halas
40  * @code.reviewed Initial revision
41  */

42 public class ListDataPageSizeTag extends ListDataActionTag
43 {
44    // Attributes ///////////////////////////////////////////////////////////////
45

46    /**
47     * Generated serial version UID
48     */

49    private static final long serialVersionUID = -4307881770865628980L;
50    
51    /**
52     * Number of items to display on a page at once. Required.
53     */

54    protected String JavaDoc m_strPageSize;
55
56    // Constructors /////////////////////////////////////////////////////////////
57

58    /**
59     * Constructor for custom tag.
60     */

61    public ListDataPageSizeTag()
62    {
63       super();
64    }
65    
66    // Accessors ////////////////////////////////////////////////////////////////
67

68    /**
69     * {@inheritDoc}
70     */

71    public String JavaDoc getCommand()
72    {
73       return ListBrowserServlet.ACTION_PAGE_SIZE_NAME;
74    }
75
76    /**
77     * {@inheritDoc}
78     */

79    public void setCommand(
80       String JavaDoc strCommand
81    )
82    {
83       throw new UnsupportedOperationException JavaDoc("");
84    }
85
86    /**
87     * Get the number of items to display at the page at once.
88     */

89    public String JavaDoc getPageSize()
90    {
91       return m_strPageSize;
92    }
93
94    /**
95     * Set the number of items to display at the page at once.
96     *
97     * @param strPageSize - page to display
98     */

99    public void setPageSize(
100       String JavaDoc strPageSize
101    )
102    {
103       m_strPageSize = strPageSize;
104    }
105    
106    /**
107     * Set the number of items to display at the page at once.
108     *
109     * @param iPageSize - page to display
110     */

111    public void setPageSize(
112       int iPageSize
113    )
114    {
115       m_strPageSize = Integer.toString(iPageSize);
116    }
117    
118    // Overwritten methods //////////////////////////////////////////////////////
119

120    /**
121     * {@inheritDoc}
122     */

123    protected String JavaDoc getPageSize(
124       ListOptions listoptions
125    )
126    {
127       return m_strPageSize;
128    }
129 }
130
Popular Tags