• 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: Passing parameters on a binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing parameters on a binding


  • Subject: Re: Passing parameters on a binding
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 21 Oct 2004 18:23:32 -0700

Another good solution!

At 09:17 PM 21/10/2004 -0400, Jean-François Veillette wrote:
>> the last couple of days and have been
>>> trying to extend his validation solution a bit. What I have done is
>>> added a method to my super component:
>>>
>>> 	public boolean hasFailedValidationNamed(String key) {
>>> 		return validationData.objectForKey(key) != null;
>>> 	}
>>>
>>> What I want to do is have a WOConditional in the page that can be
>>> bound
>>> to hasFailedValidationNamed and pass it in the key. Is this at all
>>> possible?
>> Yes and no.  It is not possible with plain old key-value coding.  It is
>> possible using OGNL (ask Google), there is a framework in Project
>> Wonder
>> (WOOGNL) that wraps the OGNL library up for WO.  I like it and it is
>> powerful, but it does add the potential for the binding version of
>> spaghetti code.  You have been warned.
>
>You can also use KVC to do what you want, without going fully with
>OGNL, you can easily implement a working solution.
>
>1-
>in your binding, you could have
>aCondition: WOConditional { condition = validationData.aKey; }
>
>That would work if 'validationData' is a NSDictionary. without any
>further work on your part.  That's because NSDictionary does kvc by
>giving value for a given key.
>
>2-
>If validationData is not a dictionary, you can overload kvc in your
>component  :
>
>Object valueForKeyPath(String kp) {
>if(kp.startWith("validationData.") {
>String key = kp.substring(/* logic to get the key part after the
>"validationData." part*/);
>	return validationData.objectForKey(key) != null;
>}
>else
>return super.valueForKeyPath(kp);
>}
>
>Last time I looked at OGNL it was really big, kvc on serious steroid.
>I didn't like how we needed to integrate our code with it, and didn't
>need that much,  so I decided to extend kvc in a different simpler
>manner.
>
>- jfv
>
>

--

Chuck Hill                                 email@hidden
Global Village Consulting Inc.             http://www.global-village.net
 _______________________________________________
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: 
 >Re: Passing parameters on a binding (From: Chuck Hill <email@hidden>)
 >Re: Passing parameters on a binding (From: Jean-François Veillette <email@hidden>)

  • Prev by Date: Re: Reusable components
  • Next by Date: [NEWBIE] Need some help getting started with a local dev environment
  • Previous by thread: Re: Passing parameters on a binding
  • Next by thread: [NEWBIE] Need some help getting started with a local dev environment
  • Index(es):
    • Date
    • Thread