Re: T5 loop sort

2009-11-27 Thread Joost Schouten (ml)
In your setupRender method of your page take the Set of beans add them 
in a List and sort acordingly. Pass the list as the source for the loop.


Cheers,
Joost

Like:

@SetupRender
private void setup() {
   Set mySet = ... whereverItComesFrom;
   List myList = new ArrayList();
   myList.addAll(mySet);
   Collections.sort(myList, DATE_COMPERATOR);
}

/**
* This comperator will place the latest entry at the top
*/
   public final static Comparator DATE_COMPERATOR = new 
Comparator() {


   public int compare(MyBean bean1, MyBean bean2) {
   return bean1.getPostDate().compareTo(bean2.getPostDate());
   }
  
   };


blueboy6 wrote:

Hi everyone,

I have a question,

I have a set of beans that I'm parsing to loop component to generate divs
and populate them with data and other components that I'm using, now in this
beens i have date property.

What is best way to sort this set by date???

I was thinking to apply sorter from grid, but I'm not sure how...

Does anyone have idea what to do here? 


Thank you in advance :)
Bojan
  



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



T5 loop sort

2009-11-27 Thread blueboy6

Hi everyone,

I have a question,

I have a set of beans that I'm parsing to loop component to generate divs
and populate them with data and other components that I'm using, now in this
beens i have date property.

What is best way to sort this set by date???

I was thinking to apply sorter from grid, but I'm not sure how...

Does anyone have idea what to do here? 

Thank you in advance :)
Bojan
-- 
View this message in context: 
http://old.nabble.com/T5-loop-sort-tp26544856p26544856.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org