package com.eactive.eai.rms.onl.vo;

import com.eactive.eai.rms.common.util.CommonConstants;

/**
 * The Class AbstractPagingSupportVo.
 * <ul>
 * <li>1. Function :</li>
 * <li>2. Summary :</li>
 * <li>3. Notification :</li>
 * </ul>
 * 
 * @author  : $Author: ¹Ú±â¼· $
 * @version : $Revision: 1.3 $
 */
public abstract class AbstractPagingSupportVo implements PagingSupportVo {

    /** The total count. */
    private int totalCount;

    /** The current page num. */
    private int currentPageNum;

    /** The display count. */
    private int displayCount;

    /* (non-Javadoc)
     * @see com.eactive.eai.rms.vo.PagingSupportVo#getDisplayCount()
     */
    public int getDisplayCount() {
        return displayCount > 0 ? displayCount : CommonConstants.DISPLAY_COUNT;
    }

    /* (non-Javadoc)
     * @see com.eactive.eai.rms.vo.PagingSupportVo#setDisplayCount(int)
     */
    public void setDisplayCount(int pagingSize) {
        this.displayCount = pagingSize;
    }

    /* (non-Javadoc)
     * @see com.eactive.eai.rms.vo.PagingSupportVo#getCurrentPageNum()
     */
    public int getCurrentPageNum() {
        return currentPageNum == 0 ? 1 : currentPageNum;
    }

    /* (non-Javadoc)
     * @see com.eactive.eai.rms.vo.PagingSupportVo#setCurrentPageNum(int)
     */
    public void setCurrentPageNum(int currentPage) {
        this.currentPageNum = currentPage;
    }

    /* (non-Javadoc)
     * @see com.eactive.eai.rms.vo.PagingSupportVo#getStartNum()
     */
    public int getStartNum() {
        return (getCurrentPageNum() - 1) * getDisplayCount() + 1;
    }

    /* (non-Javadoc)
     * @see com.eactive.eai.rms.vo.PagingSupportVo#getEndNum()
     */
    public int getEndNum() {
        return getCurrentPageNum() * getDisplayCount();
    }

    /* (non-Javadoc)
     * @see com.eactive.eai.rms.vo.PagingSupportVo#getTotalCount()
     */
    public int getTotalCount() {
        return totalCount;
    }

    /* (non-Javadoc)
     * @see com.eactive.eai.rms.vo.PagingSupportVo#setTotalCount(int)
     */
    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

}
