+1

Ruwan

Anjana Fernando wrote:
> Hi,
>
> Just a thought, by looking at the interface, the method
> "setNumberOfPages" .. isn't that suppose to be something like
> "setItemsPerPage", to set the number of items available in a page,
> because since we are setting the list with "set" method, the number of
> pages are suppose to be only queried from the interface.
>
> Cheers,
> Anjana.
>
> On Thu, May 6, 2010 at 10:12 AM, Afkham Azeez <[email protected]> wrote:
>   
>> Hi folks,
>> I have introduced a method into org.wso2.carbon.utils.Utils;
>> /**
>>      * A reusable generic method for doing item paging
>>      *
>>      * @param pageNumber The page required. Page number starts with 0.
>>      * @param sourceList The original list of items
>>      * @param pageable          The type of Pageable item
>>      * @return Returned page
>>      */
>>     public static <C> List<C> doPaging(int pageNumber, List<C> sourceList,
>> Pageable pageable) ;
>> This will set & return a page (a sub-list) of items of the sourceList. You
>> need to pass in a class implementing org.wso2.carbon.utils.Pageable. This
>> interface is as follows:
>> public interface Pageable {
>>     /**
>>      * Get the total number of pages
>>      *
>>      * @return  the total number of pages
>>      */
>>     public int getNumberOfPages();
>>     /**
>>      * Set the total number of pages
>>      *
>>      * @param numberOfPages The total number of pages
>>      */
>>     public void setNumberOfPages(int numberOfPages);
>>     /**
>>      * Set the paged items
>>      *
>>      * @param t The collection
>>      * @param <T> The type of objects in the collection
>>      */
>>     public <T extends Object> void set(List<T> t);
>> }
>> Please make sure that you reuse this code to do item paging. This is
>> generally done at the BE.
>> --
>> Afkham Azeez
>> Software Architect & Product Manager, WSO2 WSAS; WSO2, Inc.;
>> http://wso2.com, Lean . Enterprise . Middleware
>> Member; Apache Software Foundation; http://www.apache.org/
>> email: [email protected] cell: +94 77 3320919
>> blog: http://blog.afkham.org
>> twitter: http://twitter.com/afkham_azeez
>> linked-in: http://lk.linkedin.com/in/afkhamazeez
>>
>> _______________________________________________
>> Carbon-dev mailing list
>> [email protected]
>> https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>
>>
>>     
>
>
>
>   


-- 
Ruwan Linton
Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.com

Lean . Enterprise . Middleware

phone: +1 408 754 7388 ext 51789
email: [email protected]; cell: +94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
tweet: http://twitter.com/ruwanlinton


_______________________________________________
Carbon-dev mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to