Re: One last Question: Components on a page question...
Re: One last Question: Components on a page question...
- Subject: Re: One last Question: Components on a page question...
- From: Jonathan Rochkind <email@hidden>
- Date: Mon, 29 Mar 2004 17:11:17 -0600
At 4:57 PM -0600 3/29/04, James Cicenia wrote:
OK --
One last question....
When I have a master component Page with theItem in it and I want the children
components to have access to it?
Yes, you need to pass it into each child as a binding. "Bindings"
are always the answer to "how can my parent component send info to or
get info from a child component".
How do I do this? I would think that I could just
drag theItem to the star icon of the child component and create new binding.
Um. Well. See, there are two parts. Setting up the binding definition
(a binding called "someBinding" in the child, has a value of the key
"theItem" in the parent). But the child needs to accept a binding of
the name given too. For default WO-framework-controlled binding
synchronization, this means the child needs a variable with the same
name as the binding's name, or methods bindingName() and
setBindingName().
Whether WOBuilder shows you all bindings defined by the child or not
(which, by the way, has NOTHING to do with your applications actual
runtime behavior; this is just a convenience for the developer. It is
very convenient) has to do with you setting the "API" properly in
WOBuilder (or by hand in the .api file for the child component). And
with WOBuilder working properly---it seems to frequently malfunction
and now show bindings even if they are defined in the api. Again,
this is just a convenience for the developer, it won't effect your
applications behavior.
I've never used the feature where you can just drag a value to the
"*" icon for a custom component---I don't really know what that will
do. I always click "get info" with the custom component, and then add
the bindings manually----either typing a value for bindings WOBuilder
already displays blanks for, or clicking the "+/-" button to add a
binding, if WOBuilder isn't already showing it. But even adding a
binding with the "+/-" button---okay, now you've defined that this
particular use of the child component should be given a binding with
that name/value, but that doens't mean the child will actually
accept/use such a binding! That depends on your .java code. In the
default standard setup, you just need a variable or methods with the
right name, as described above.
But when I now go to the child component I can's see theItem. What
am I doing wrong?
I don't understand what you mean by "go to the child component" and
"I can't see theItem". I have no idea if you are doing anything
wrong. I think you should read up on how bindings work, although I'm
afraid I have no particular text to reccomend at the moment, dont'
know where this is covered.
--Jonathan
OR, is this an eclipse/WOLips issue?
-James Cicenia
_______________________________________________
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.