sorting glazed lists on Jcombo numerically

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

sorting glazed lists on Jcombo numerically

fpiergen
I am using the GlazedLists for a JCombo box in Java. The list is sorted alphabetically on numbers ( list Ids ). Is their a way to change this to a numerical sort?

My Code: placedBy is my JCombo object.

        TextFilterator<StaffInfo> textFilterator = GlazedLists.textFilterator(
                StaffInfo.class, "firstName");

        // install auto-completion
        AutoCompleteSupport support = AutoCompleteSupport.install(
                this.placedBy, GlazedLists.eventListOf(allStaffMembers),
                textFilterator, new StaffInfoFormat(this.placedBy));

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: sorting glazed lists on Jcombo numerically

James Lemieux
I can't remember any place that reorders the items in the ComboBoxModel, so you should be fine to simply order the original items according to a custom comparator that you define:

TextFilterator<StaffInfo> textFilterator = GlazedLists.textFilterator(StaffInfo.class, "firstName");
Format format = new StaffInfoFormat(this.placedBy);

// install auto-completion
EventList<StaffInfo> staffInfo = GlazedLists.eventListOf(allStaffMembers);
SortedList<StaffInfo> sortedStaffInfo = new SortedList<StaffInfo>(staffInfo, new StaffInfoIDComparator());
AutoCompleteSupport support = AutoCompleteSupport.install(this.placedBy, sortedStaffInfo, textFilterator, format);

James

On Fri, Dec 4, 2009 at 3:42 PM, fpiergen <[hidden email]> wrote:

I am using the GlazedLists for a JCombo box in Java. The list is sorted
alphabetically on numbers ( list Ids ). Is their a way to change this to a
numerical sort?

My Code: placedBy is my JCombo object.

       TextFilterator<StaffInfo> textFilterator =
GlazedLists.textFilterator(
               StaffInfo.class, "firstName");

       // install auto-completion
       AutoCompleteSupport support = AutoCompleteSupport.install(
               this.placedBy, GlazedLists.eventListOf(allStaffMembers),
               textFilterator, new StaffInfoFormat(this.placedBy));

Thanks

--
View this message in context: http://old.nabble.com/sorting-glazed-lists-on-Jcombo-numerically-tp26648472p26648472.html
Sent from the GlazedLists - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: sorting glazed lists on Jcombo numerically

fpiergen
Thank yo I will give it try.


James Lemieux wrote
I can't remember any place that reorders the items in the ComboBoxModel, so
you should be fine to simply order the original items according to a custom
comparator that you define:

TextFilterator<StaffInfo> textFilterator =
GlazedLists.textFilterator(StaffInfo.class, "firstName");
Format format = new StaffInfoFormat(this.placedBy);

// install auto-completion
EventList<StaffInfo> staffInfo = GlazedLists.eventListOf(allStaffMembers);
SortedList<StaffInfo> sortedStaffInfo = new SortedList<StaffInfo>(staffInfo,
new StaffInfoIDComparator());
AutoCompleteSupport support = AutoCompleteSupport.install(this.placedBy,
sortedStaffInfo, textFilterator, format);

James

On Fri, Dec 4, 2009 at 3:42 PM, fpiergen <fabiopiergentili@gmail.com> wrote:

>
> I am using the GlazedLists for a JCombo box in Java. The list is sorted
> alphabetically on numbers ( list Ids ). Is their a way to change this to a
> numerical sort?
>
> My Code: placedBy is my JCombo object.
>
>        TextFilterator<StaffInfo> textFilterator =
> GlazedLists.textFilterator(
>                StaffInfo.class, "firstName");
>
>        // install auto-completion
>        AutoCompleteSupport support = AutoCompleteSupport.install(
>                this.placedBy, GlazedLists.eventListOf(allStaffMembers),
>                textFilterator, new StaffInfoFormat(this.placedBy));
>
> Thanks
>
> --
> View this message in context:
> http://old.nabble.com/sorting-glazed-lists-on-Jcombo-numerically-tp26648472p26648472.html
> Sent from the GlazedLists - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@glazedlists.dev.java.net
> For additional commands, e-mail: dev-help@glazedlists.dev.java.net
>
>