• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: binding trouble
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: binding trouble


  • Subject: Re: binding trouble
  • From: Jean-François Veillette <email@hidden>
  • Date: Mon, 27 Jun 2005 15:23:50 -0400

If you want to do the binding like
	src = imgPath.myImageName.gif
then what you can do is overwrite valueforKeyPath like so :

public Object valueForKeyPath(String kp) {
if(kp.startWith("imgPath.")) {
	String filename = kp.substring(8, kp.length());
	return imgPath(filename);
} else {
return super.valueForKeyPath(kp);
}
}

public String imgPath(String filename) {
    return "myPath" + filename;
}

You will need to adjust the string management so consider this as pseudo-code ( you get the idea ).

- jfv

Le 05-06-27, à 15:02, Amedeo Mantica a écrit :

Yes Arturo, but doing this I need a Java method for each image...

I'm trying to do it in an unique Java method, but I need to pass it the variable.
Amedeo


On 27/giu/05, at 20:55, Arturo Perez wrote:

Hi Amedeo,

You bind to a Java method
public String imgPath() {
    return "myPath" + filename;
}

No where did I say you bind to what you wrote. I said to set the binding as David suggested.

Do the above then reread my email.

Amedeo Mantica wrote:

thanks Arturo, but this binding in not permitted:
"myPath" + filename
Amedeo
On 25/giu/05, at 16:11, Arturo Pérez wrote:

Dunno if anyone else answered this.

You have a repetition with a list binding and an item binding. Call the item binding filename.

For you image use the src binding as David says. WORepetition will make sure that the filename is the one used for that particular loop of the repetition. Here's an example.

Loop one
filename set to "britneyspears.jpg"
create WOimage
bind filename to imgSrc => "myPath" + filename => myPath/ britneyspears.jpg
Loop two
filename set to "halleberry.jpg"
create WOimage
bind filename to imgSrc => "myPath" + filename => myPath/ halleberry.jpg
Loop three ...


See, the repetition takes care of making sure that value of the bind variable for the nested content (as they say in Struts-land) is correct. But it also does it on form submit so that if you had a link next to each image, when the link is clicked the filename binding will be set to the value used to generate the link.

HTH

-arturo

On Jun 24, 2005, at 11:24 AM, Amedeo Mantica wrote:



thanks David, but this works fine If i have only an image in my item object, but i have more images, so i need to pass to the function the image name...

for example, following your example:

public String imgSrc(String aFileName) {
        return "myPath" + aFileName;
}

and bind the WOImage to imgSrc(listItem.theFileName())

But this won't work...
Any help?

Thanks
Amedeo


On 24/giu/05, at 17:06, David LeBer wrote:



On 24-Jun-05, at 10:57 AM, Amedeo Mantica wrote:




Hi

This is my problem...

I have a WORepetition...

the list item is an object containing a some stringa, strings are image names.

I need to display the images using WOImage, but I need to prepend a path to the image name.

I tried to make a binding line "myPath"+theFileName, but is not accepted...

can I bind the WOImage src to a function thet return the String path?

How to pass theFileName to that function?






public String imgSrc() { return "myPath" + listItem.theFileName(); }

Bind this to the WOImage src binding.

;david

-- David LeBer
Codebase Software Systems
site: http://www.codebase.ca
blog: http://david.codebase.ca







_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40ethicist.net


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:
email@hidden


This email sent to email@hidden


__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ 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
References: 
 >binding trouble (From: Amedeo Mantica <email@hidden>)
 >Re: binding trouble (From: David LeBer <email@hidden>)
 >Re: binding trouble (From: Amedeo Mantica <email@hidden>)
 >Re: binding trouble (From: Arturo Pérez <email@hidden>)
 >Re: binding trouble (From: Amedeo Mantica <email@hidden>)

  • Prev by Date: Re: binding trouble
  • Next by Date: Re: binding trouble
  • Previous by thread: Re: binding trouble
  • Next by thread: Re: binding trouble
  • Index(es):
    • Date
    • Thread