Re: WOImage
Re: WOImage
- Subject: Re: WOImage
- From: "Jonathan Fleming" <email@hidden>
- Date: Fri, 14 Feb 2003 03:17:20 +0000
Hello Art, although you had me laughing I felt pin size, severely scolded
and thoughtless having read your now obvious comments.
However, had I not asked I'd most likely still be thoughtless and
none-the-wiser.
Yes, it all makes sense now.
Kind regards
Jonathan
From: Art Isbell <email@hidden>
To: email@hidden
Subject: Re: WOImage
Date: Thu, 13 Feb 2003 16:02:02 -1000
On Thursday, February 13, 2003, at 02:53 PM, Jonathan Fleming wrote:
Can someone please inform me as to why I have to link to an image through
an aggregate key when using a path through your EOModel entities to get my
image to show in a WOImage?
If I understand what you're doing, you are occasionally getting an image
through an aggregate key because aggregate keys, unlike the arrays upon
which they act, return a single object. A WOImage requires a single NSData
object, so just because you *can* bind a path to a WOImage key doesn't mean
doing so is correct.
What sense does tbClient.tbClientDatas.thumbnail make as a value to bind
to a key that requires a single object? tbClient.tbClientDatas is an array
of multiple objects, so what do you expect tbClient.tbClientDatas.thumbnail
to be? It's an array of thumbnail objects, not a single thumbnail object
which is what a WOImage key requires.
When bound through @avg i get:
java.lang.IllegalStateException: URL may only contain 8-Bit characters!
What sense does taking the average of an array of TbClientData objects
make?! Are you really surprised that this didn't work?
When bound through @count, I get:
java.lang.ClassCastException
What do you suppose the count of an array is? An integer, yet you're
binding this to a NSData key. An int or Integer cannot be cast to an
NSData object, so you get a ClassCastException.
When bound through @max, I get the loaded picture
When bound through @min, I get the loaded picture
You're just getting lucky, then, because how do you define the min or max
of an array of TbClientData objects? The implementation of min and max
must just punt and return either the first or last object in the array.
When bound through @sum, I get error as in @avg
Are you surprised?!
WO requires some exercise of one's gray matter. You can't just bind any
value to any key just because WOB allows you to do so. You've got to think
about what you're doing. Certainly the meanings of @avg, @count, @max,
@min, @sum should be pretty obvious to any English-speaker.
If a path available in WOB doesn't resolve to what a key requires, then
you'll have to write some Java code to get the necessary value and bind
either the component instance variable set by this code or returned by a
method you write. Or you could bind tbClient.tbClientDatas.thumbnail to
the "list" key of a WORepetition containing a WOImage such that all
tbClient's images will be displayed at once.
Think before you bind!!
Art
http://homepage.mac.com/aisbell/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger
http://messenger.msn.co.uk
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.