KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > mlw > vlh > adapter > AbstractValueListAdapter


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.adapter;
22
23 import net.mlw.vlh.ValueListAdapter;
24 import net.mlw.vlh.ValueListInfo;
25
26 /**
27  * Default abstract implementation of a ValueListAdapter.
28  *
29  * @author mwilson
30  */

31 public abstract class AbstractValueListAdapter implements ValueListAdapter
32 {
33   /** @see net.mlw.vlh.ValueListAdapter#getAdapterType() */
34   private int adapterType = DO_NOTHING;
35
36   /** The default number of entries per page. * */
37   private int defaultNumberPerPage = Integer.MAX_VALUE;
38
39   /** The default column to sort by. * */
40   private String JavaDoc defaultSortColumn;
41
42   /** The default column to sort by. * */
43   private Integer JavaDoc defaultSortDirection = ValueListInfo.ASCENDING;
44
45   /**
46    * @see net.mlw.vlh.ValueListAdapter#getAdapterType()
47    */

48   public int getAdapterType()
49   {
50     return adapterType;
51   }
52
53   /** Sets the adatper type.
54    *
55    * @see net.mlw.vlh.ValueListAdapter#getAdapterType()
56    */

57   public void setAdapterType(int adapterType)
58   {
59     this.adapterType = adapterType;
60   }
61
62   /** Sets the default number of entries per page.
63    *
64    * @param defaultNumberPerPage
65    * The default number of entries per page.
66    */

67   public void setDefaultNumberPerPage(int defaultNumberPerPage)
68   {
69     this.defaultNumberPerPage = defaultNumberPerPage;
70   }
71
72   /** Gets the default number of entries per page.
73    *
74    * @return Returns the defaultNumberPerPage.
75    */

76   public int getDefaultNumberPerPage()
77   {
78     return defaultNumberPerPage;
79   }
80
81   /** Sets the default sortColumn if none is present in the filters.
82    *
83    * @param defaultSortColumn
84    * The defaultSortColumn to set.
85    */

86   public void setDefaultSortColumn(String JavaDoc defaultSortColumn)
87   {
88     this.defaultSortColumn = defaultSortColumn;
89   }
90
91   /**
92    * @return Returns the defaultSortColumn.
93    */

94   public String JavaDoc getDefaultSortColumn()
95   {
96     return defaultSortColumn;
97   }
98
99   /**
100    * Sets the default sort directon is none is supplied in the Map. Valid
101    * values: asc|desc
102    *
103    * @param defaultSortDirection
104    * The defaultSortDirection to set.
105    */

106   public void setDefaultSortDirection(String JavaDoc defaultSortDirection)
107   {
108     this.defaultSortDirection = "desc".equals(defaultSortDirection) ? ValueListInfo.DESCENDING : ValueListInfo.ASCENDING;
109   }
110
111   /** Gets the sort direction defined as the default.
112    *
113    * @return Returns the defaultSortDirection.
114    */

115   public Integer JavaDoc getDefaultSortDirectionInteger()
116   {
117     return defaultSortDirection;
118   }
119 }
Popular Tags