Eelco Hillenius,您好! thanks a lot ~~~
======= 2005-05-21 22:00:39 您在来信中写道:======= >You could create a custom component for this if you want to. The whole >idea of Wicket is to make it super easy for users to create their own >components and add the behaviour they want themselves without bloating >the core project too much. > >Personally, I would take a different approach though: > >Use a variable (like a list) to store your order: > >private List componentOrder = new ArrayList(); > >Override method add to automatically add the order: > >/** >* @see wicket.MarkupContainer#add(wicket.Component) >*/ >public MarkupContainer add(Component component) >{ >super.add(component); >componentOrder.add(component); >return (MarkupContainer)component; >} > >Create a comparator that uses this and set it on the FeedbackPanel: > >feedback.setSortingComparator(new Comparator() >{ >public int compare(Object o1, Object o2) >{ >FeedbackMessage m1 = (FeedbackMessage)o1; >FeedbackMessage m2 = (FeedbackMessage)o2; >int ix1 = componentOrder.indexOf(m1.getReporter()); >int ix2 = componentOrder.indexOf(m2.getReporter()); >return ix1 - ix2; >} >}); > >I have attached the complete example (an altered version of InputForm >which I am not going to check in) to this email. > >Good luck, > >Eelco > > >叶卫国 wrote: > >>Eelco Hillenius,您好! >> >> emm.... so can you add a member variable(e.g. "order" or something >> else) to Component class, thus i can set >>the order manually >> >>======= 2005-05-21 19:28:37 您在来信中写道:======= >> >> >> >>>Well... I've discussed this with Johan offline, but that is very hard to >>>do. Even if we had ordering in the child maps, that doesn't mean that >>>that's the order you're going to use them in your markup. And even if >>>you did, by using CSS, the order could be even different from what is in >>>your markup. >>> >>>So, I'm afraid you have to do any sorting this manually, which means >>>that you have to keep track of the order as you want it somewhere. >>> >>>Regards, >>> >>>Eelco >>> >>> >>> >>>叶卫国 wrote: >>> >>> >>> >>>>Eelco Hillenius,您好! >>>> >>>> Adding a sort() method is flexible, but how to sort by the occurrence >>>> order of the form fields ? >>>> >>>> >>>> >>>> >>>>======= 2005-05-17 20:46:42 您在来信中写道:======= >>>> >>>> >>>> >>>> >>>> >>>>>I refactored FeedbackMessages, FeedbackPanel and >>>>>FormComponentFeedbackBorder so that it is easier to use and to extend. >>>>>One of the things I added is that you can now set a comparator on >>>>>FeedbackPanel for any sorting you want. >>>>> >>>>>Good luck, >>>>> >>>>>Eelco >>>>> >>>>> >>>>>------------------------------------------------------- >>>>>This SF.Net email is sponsored by Oracle Space Sweepstakes >>>>>Want to be the first software developer in space? >>>>>Enter now for the Oracle Space Sweepstakes! >>>>>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click >>>>>_______________________________________________ >>>>>Wicket-user mailing list >>>>>Wicket-user@lists.sourceforge.net >>>>>https://lists.sourceforge.net/lists/listinfo/wicket-user >>>>> >>>>> >>>>> >>>>> >>>>= = = = = = = = = = = = = = = = = = = = >>>> >>>> >>>> 致 >>>>礼! >>>> >>>> >>>> 叶卫国 >>>>[EMAIL PROTECTED] >>>> 2005-05-21 >>>> >>>>N?S^甸?X??'????%y*Zq浒y?旦?Ф?z?~*於???庄zZ)z抚??I?硅龙+???%y*Zq浒y?旦?m????,vw(??秀]?Z??8??'$Z'$z郜z???X?h??标????玷????????(悍~?zw?X?襄?b???'$z郜er== >>>> >>>> >>>> >>> >>>------------------------------------------------------- >>>This SF.Net email is sponsored by Oracle Space Sweepstakes >>>Want to be the first software developer in space? >>>Enter now for the Oracle Space Sweepstakes! >>>http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click >>>_______________________________________________ >>>Wicket-user mailing list >>>Wicket-user@lists.sourceforge.net >>>https://lists.sourceforge.net/lists/listinfo/wicket-user >>> >>> > > = = = = = = = = = = = = = = = = = = = = 致 礼! 叶卫国 [EMAIL PROTECTED] 2005-05-21