Re: Custom EOSortOrdering for a WODisplayGroup
Re: Custom EOSortOrdering for a WODisplayGroup
- Subject: Re: Custom EOSortOrdering for a WODisplayGroup
- From: Chuck Hill <email@hidden>
- Date: Thu, 6 May 2010 21:25:06 -0700
On May 6, 2010, at 3:29 AM, Paul Hoadley wrote:
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.)
I think I could make a good case for that being the right answer.
Maybe not the easy answer, but right.
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?
Completely is a little harsh. ;-)
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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