org.sakaiproject.javax
Class PagingPosition

java.lang.Object
  extended byorg.sakaiproject.javax.PagingPosition
All Implemented Interfaces:
Cloneable

public class PagingPosition
extends Object
implements Cloneable

PagingPosition models a current position in a paging display, with a first and last item value, 1 based.

Implementation note: the default Object.equals() is fine for this class.

Version:
$Revision: 632 $
Author:
University of Michigan, Sakai Software Development Team

Field Summary
protected  int m_first
          The first item position on the current page, 1 based.
protected  int m_last
          The last item position on the current page, 1 based.
protected  boolean m_paging
          If true, paging is ebabled, otherwise all items should be used.
 
Constructor Summary
PagingPosition()
          Construct, setting position to select all possible items.
PagingPosition(int first, int last)
          Construct, setting the first and last.
 
Method Summary
 void adjustPostition(int distance)
          Adjust the first and list item position by distance, positive or negative.
 Object clone()
          
 int getFirst()
          Access the first item position, 1 based.
 int getLast()
          Access the last item position, 1 based.
 boolean isPaging()
          Check if we have paging enabled.
 void setPaging(boolean paging)
          Set the paging enabled value.
 void setPosition(int first, int last)
          Set the first and last positions.
protected  void validate()
          Adjust the first and last to be valid.
 void validate(int biggestLast)
          Adjust the first and last to be valid and within the range 1..biggestLast
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_first

protected int m_first
The first item position on the current page, 1 based.


m_last

protected int m_last
The last item position on the current page, 1 based.


m_paging

protected boolean m_paging
If true, paging is ebabled, otherwise all items should be used.

Constructor Detail

PagingPosition

public PagingPosition()
Construct, setting position to select all possible items.


PagingPosition

public PagingPosition(int first,
                      int last)
Construct, setting the first and last.

Parameters:
first - The first item position, 1 based.
last - The last item position, 1 based.
Method Detail

adjustPostition

public void adjustPostition(int distance)
Adjust the first and list item position by distance, positive or negative.

Parameters:
distance - The positive or negative distance to move the first and last item positions.

clone

public Object clone()


getFirst

public int getFirst()
Access the first item position, 1 based.

Returns:
the first item position, 1 based.

getLast

public int getLast()
Access the last item position, 1 based.

Returns:
the last item position, 1 based.

isPaging

public boolean isPaging()
Check if we have paging enabled.

Returns:
true if paging is enabled, false if not.

setPaging

public void setPaging(boolean paging)
Set the paging enabled value.

Parameters:
paging - the new paging enabled value.

setPosition

public void setPosition(int first,
                        int last)
Set the first and last positions.

Parameters:
first - The new first item position, 1 based.
last - The new last item position, 1 based.

validate

protected void validate()
Adjust the first and last to be valid.


validate

public void validate(int biggestLast)
Adjust the first and last to be valid and within the range 1..biggestLast

Parameters:
biggestLast - The largest valid value for last