Re: Custom EOSortOrdering for a WODisplayGroup
Re: Custom EOSortOrdering for a WODisplayGroup
- Subject: Re: Custom EOSortOrdering for a WODisplayGroup
- From: Paul Hoadley <email@hidden>
- Date: Thu, 6 May 2010 19:59:27 +0930
On 06/05/2010, at 4:41 PM, Timo Hoepfner wrote:
> I did something similar before. I basically took the "Strings" class from here:
>
> <http://weblogs.java.net/blog/skelvin/archive/2006/01/natural_string.html>
>
> and wired it up in a EOSortOrdering.ComparisonSupport subclass derived from ERXComparisonSupport. I attached a cleaned up version of the file.
>
> Then add something like this to your Application (if it extends ERXApplication):
>
> @Override
> public void finishInitialization() {
> super.finishInitialization();
> NaturalOrderStringSortSupport.initialize();
> }
>
>
> As Johann pointed out before, this is then globally used for all String sorting.
Thanks Timo. Very helpful.
If the list could just bear with me for a little longer... I take it that I've fundamentally misunderstood what an EOSortOrdering is doing. When I wanted to create an EOSortOrdering that sorts in some particular way _on some particular EO's attribute_, there's actually no such thing—right? An EOSortOrdering takes a key, but then sorts in a pre-defined way based on the type of the key (and the NSSelector supplied)—right? So I've really only got the following options:
1. Take Timo and Johann's advice, and implement a custom sorting algorithm that would be used globally for all Strings.
2. Change the Java type of that attribute to some custom type (that presumably includes a String by composition), implement the sorting algorithm for that type, and register that for global use as described. (Is that even feasible? Sounds like a lot of work.)
3. Stick with the current hack that will break if the attribute value can't be cast to an Integer.
Any other options? Or do I sound completely insane?
--
Paul.
http://logicsquad.net/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden