Re: Nested component communication
Re: Nested component communication
- Subject: Re: Nested component communication
- From: David Holt <email@hidden>
- Date: Wed, 11 Aug 2004 09:25:39 -0700
Thanks Zak,
Your response makes me think that I should clarify my problem a little
better.
Variables pass from the component content to the Wrapper component
perfectly. I am using a pageTitle dynamically generated from the
componentContent binding.
My problem seems to be how to pass the variable from the
componentContent to its nested navigation bar and from the navigation
bar to its nested menu elements. Should I be using setter methods
explicitly? I think that the variable value is passing, but then is it
possible it is getting reset during the response loop? There is an
example in the old WebObjects Developer's Guide for version WO4.5 that
shows a parent component synchronizing to a child, and a child
synchronizing to the parent. The book says (on page 148): "For
instance, it's sufficient in the example shown in Figure 35 to simply
declare a childValue instance variable in the child component and a
parentValue instance variable in the parent." on the following page it
says: "Component synchronization can sometimes lead to values being set
when you don't want time to be set. You have no control over when, or
how often a value is passed to and from the parent."
Is there a better way for a nested element to know where it is (i.e.
which page level component is displaying it) and base its behaviour on
where it is?
On 11 Aug 2004, at 5:44 AM, Zak Burke wrote:
David,
Yeah, I've had a hard time tracking down details about inter-component
communication. Here's what works for me: In the api file of the
component which is being wrapped, you can directly set the wrapper's
variables like this:
WebObjectTagName: WrapperComponent {
var1 = "static string value";
var2 = aMethodValue;
}
This assumes that:
* the class WrapperComponent has variables var1 and var2. set-methods
probably work too, but I haven't tried
* the inner component's class has a method aMethodValue()
* var2 and the value returned by aMethodValue() are the same type
In your case, it sounds like you should be able to set the wrapper
class's "tabOne" variable from the wrapped pages, just like setting
var1 in the example above.
Good luck --
zak.
David Holt wrote on 8/10/04 6:52 PM:
Hello,
I am trying to get a navigation bar to work so that an image changes
when the user is on the page (like the tabs on Apple's site).
The way I have set it up is to have a page wrapper containing a
WOComponentContent and a NavigationBar Component made up of Rollover
components. In my API for the wrapper I have set a boolean variable
called "tabOne" and for all of the components that fill the
"WOComponentContent" under "tabOne" I have set their "tabOne" binding
to "true".
I have also placed "tabOne" variables in the wrapper component, the
NavigationBar component and the Rollover component. I have wrapped
the rollover button for tabOne in a conditional to display the
rollover when the boolean is false (i.e. not on a page that is in
tabOne) and a static image when the boolean is true. My problem is
that the boolean is always evaluating to false on pages where
"tabOne" is true and as a result only the rollover is displayed in
its conditional. From my reading, it seems that the component
communication is automatic from the parent components to child
components so long as the variables are named the same thing.
Am I misunderstanding something about how the communication would
occur from ComponentContent>Wrapper>NavigationBar>Rollover ? If so,
what would be a better way to implement this? Thanks,
David
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.