Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom display for WOToManyRelationship destinationDisplayKey



Hi Robert,
that work of course, my issue is to get to the key which stored the "human readable" value:
-I have a simple table with "code value" like "grey,blue,..."
-in my framework I have a .strings file with entries like:
blue= "bleu";
grey="gris";
...

that way I have only a simple table and can localized the .strings file more easily.

but it seems like I cannot access the key inside the framework using resourceManager...

I think if I subclass my custom class in my application, I'll be able to make it work, but I'd like to keep that in my framework if there's a way to access the keys in the .strings file...

But I didn't find it yet.

Xavier


You might try setting the destinationDisplayKey binding to "userPresentableDescription."  Then in your custom class for the destination entity you should be able to override userPresentableDescription to return whatever you want.

Like:

public String userPresentableDescription() {
// Return anything you want here
return lastName() + ", " + firstName();
}

On Aug 29, 2006, at 4:17 PM, Dev WO wrote:

Hello Lachlan,
Hello all,
I've been searching this week end on how to customize the display of a WOToManyRelationship destinationDisplayKey.
Here's what I have:
-a framework with my objects classes
-an application with a WOToManyRelationship

I suppose what you want could be done by your EO subclass. i.e., overriding the method indicated by destinationDisplayKey to return what you want.
If I use some of the attribute to compose the string it works perfectly.
But I need to access a key in a .string file (included in the framework).

So I tried WOApplication.application().resourceManager().stringForKey(anAttributeOfTheEntity, "NameOfTheStringFile", null, null, null)
but even if it compiles fine, I just get "null" when the values are displayed in the page.
So I'm assuming WOResourceManger isn't suppose to work in a Framework...but I may be wrong.

Later I'll also need to pass a value for the available language, and I'm not sure on how to "bind" that in the WOToManyRelationship..

So my second guess was to create the method that got to the .string file directly inside my component.java file.
But this time I don't know what to put for "anAttributeOfTheEntity" in stringForKey(anAttributeOfTheEntity, "NameOfTheStringFile", null, null, null)

I really don't know how to do this:(



I'd like to change the value of the display string, but I just can't find how to. Precisely I'd like to get the value from a .strings file using WOResourceManager.

My issue is that I cannot use a custom method in the framework as it appears WOResourceManager doesn't work, at least I couldn't make it work (I used WOApplication.application().resourceManager(), but I got null value,

That's weird.

So I tried adding a method to my application component class, but it looks like WOToManyRelationship doesn't even call my method!

What are you passing?

And I would have to pass the destination objet to this method to be able to extract the requested key(s) and create the display string...

Why?

with regards,
--

Lachlan Deck





_______________________________________________
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

--
Robert Walker



 _______________________________________________
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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/email@hidden

This email sent to email@hidden

References: 
 >custom display for WOToManyRelationship destinationDisplayKey (From: Dev WO <email@hidden>)
 >Re: custom display for WOToManyRelationship destinationDisplayKey (From: Lachlan Deck <email@hidden>)
 >Re: custom display for WOToManyRelationship destinationDisplayKey (From: Dev WO <email@hidden>)
 >Re: custom display for WOToManyRelationship destinationDisplayKey (From: Robert Walker <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.