Re: Problems with manual synchronization of variable
Re: Problems with manual synchronization of variable
- Subject: Re: Problems with manual synchronization of variable
- From: Anjo Krank <email@hidden>
- Date: Mon, 14 Feb 2005 18:21:12 +0100
Gosh,
so many errors, so little time:)
Am 12.02.2005 um 14:27 schrieb Jean-François Veillette:
if by non-synchronized component, you mean the
'synchronizeVariablesWIthBinding(){return false;}, then what it really
mean is that it won't push <form> elements values from the request to
your bound variables.
This is wrong. Form values are always pushed. Repetition values are
always pushed. At least into the direct parent.
Inter-Component synchronization are always running, before / after
each of RR-Loop. This is to give you the right context (wo-repetition
make synchronization even more often).
What does *not* happen is that a parent pushes its values on each stage
in the RR loop into the child component and vice-versa. So if that's
what you mean with "Inter-Component synchronization",
synchronizesVariablesWithBindings() exists to prevent exactly that. So
basically you get a chance to step in and pull this binding only once
for all three phases.
If in your sub-component, you make direct call to
parent().setSomething(...), then this will most likely fail if the
parent.something is bound to a variable that will get synchronized
later.
You shouldn't use parent().getFoo() or parent().setFoo() in a
component. This makes for terrible reuse. Rather use
this.valueForBinding("foo") and this.setValueForBinding(x, "foo");
Note that if you want to store temporary RR-Loop value you can always
use the context.request.userInfo dictionary, this dictionary will be
valid for the whole request. Your sub-component could store value in
there and your parent could take it from there whenever it need it.
However, it's not there and not mutable until you actually set or
initialize it to a NSMutableDictionary.
and finally:
I have a stateless subcomponent with manual synchronization who
display some results to the user.
I discovered a problem when I invoke an action on a link under this
subcomponent; before my action is invoked, the subcomponent call
valueForBinding for synchronization (after the WORepetition inside it
called invokeAction). After that WebObjects execute the action
invoked by the user and the variables are synchronized again.
Before invokeAction, takeValuesFromRequest is called and this may or
may be what tells your component to pull the bindings. That's all I can
say until you post some more info.
Cheers, Anjo
PS: you might check if you spelled the method correctly... it's
"synchronizesVariablesWithBindings"
_______________________________________________
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