setSortOrderings? -A dirty solution-

Ricardo Strausz <[email protected]>
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
There were two problems indeed:
1. How to create the NSSelector with name CompareDescending (a static 
value of EOSortOrdering).
2. There are two classes named NSArray; one in the pakage 
com.apple.cocoa.foundation and the other in com.webobjects.foundation; 
worse, they are not compatible and the morphing of the Java-bridge does 
not work well in this case.

So, I had to create a java class and call it from my ObjC class with 
the following code (if some one find a better ---purely ObjC--- 
solution, please let me know):

public class Util {

     public Util(){
         super();
     }

     public EOSortOrdering sortOrderingDescending(String key){
         return (EOSortOrdering)EOSortOrdering.sortOrderingWithKey(key, 
EOSortOrdering.CompareDescending);
     }

     public void setSortOrdering(EODisplayGroup dg, EOSortOrdering so){
         com.webobjects.foundation.NSArray nsa = new 
com.webobjects.foundation.NSArray(so);
         dg.setSortOrderings(nsa);
     }

}

@interface AlmacenA : NSObject
{
     IBOutlet id dgArt;	// EODisplayGroup
     IBOutlet id util;	// Util.java
}

@implementation AlmacenA

- (void)awakeFromNib
{
     id so = nil;

     so = [util sortOrderingDescending:@"detalle"];
     [util setSortOrdering:dgMov :so];

}


I hope there are still developer in Apple trying to bring back 
Cocoa/EOF apps into support and, may be some one else, try to fix these 
errors (bugs?).

DINO


On miércoles, febr 19, 2003, at 17:39 America/Mexico_City, Ricardo 
Strausz wrote:

> Hola amigos!
>
> I am trying to sort the contents of a displayGroup; I'd try the 
> following
>
> EOSortOrdernig = 
> NSClassFromString(@"com.webobjects.eocontrol.EOSortOrdering");
> EODisplayGroup* dg; //suppose this exists
>
> [dg setSortORdering:[NSArray arrayWithObject:[EOSortOrdering 
> sortOrderingWithKey:@"detalle" :@selector(CompareDescending)]]];
>
> it does not work.... worse than that: the app exists with signal 11 
> (SIGSEGV)
>
> Any clue???
>
> I think that the problem is with the @selector(CompareDescending) but 
> I do not know how to jump the Java-Bridge with such a kind of 
> paramater.
> PLS HELP
>
> (I am using OSX 10.2.3 and WO 5.2 ---previous to december relase---)
>
> Dino
> http://homepage.mac.com/strausz
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.