KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > displaytag > pagination > NumberedPage


1 /**
2  * Licensed under the Artistic License; you may not use this file
3  * except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  * http://displaytag.sourceforge.net/license.html
7  *
8  * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
9  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
10  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11  */

12 package org.displaytag.pagination;
13
14 import org.apache.commons.lang.builder.ToStringBuilder;
15 import org.apache.commons.lang.builder.ToStringStyle;
16
17
18 /**
19  * Object representing a page.
20  * @author Fabrizio Giustina
21  * @version $Revision: 851 $ ($Author: fgiust $)
22  */

23 public class NumberedPage
24 {
25
26     /**
27      * page number.
28      */

29     private int number;
30
31     /**
32      * is the page selected?
33      */

34     private boolean selected;
35
36     /**
37      * Creates a new page with the specified number.
38      * @param pageNumber page number
39      * @param isSelected is the page selected?
40      */

41     public NumberedPage(int pageNumber, boolean isSelected)
42     {
43         this.number = pageNumber;
44         this.selected = isSelected;
45     }
46
47     /**
48      * Returns the page number.
49      * @return the page number
50      */

51     public int getNumber()
52     {
53         return this.number;
54     }
55
56     /**
57      * is the page selected?
58      * @return true if the page is slected
59      */

60     public boolean getSelected()
61     {
62         return this.selected;
63     }
64
65     /**
66      * @see java.lang.Object#toString()
67      */

68     public String JavaDoc toString()
69     {
70         return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) //
71
.append("selected", this.selected) //$NON-NLS-1$
72
.append("number", this.number) //$NON-NLS-1$
73
.toString();
74     }
75 }
Popular Tags