Re: Manual syncing question
Re: Manual syncing question
- Subject: Re: Manual syncing question
- From: Chuck Hill <email@hidden>
- Date: Thu, 14 Sep 2006 18:12:29 -0700
public User user() {
if (user == null) user = (User)valueForBinding(USER_BINDING_NAME);
return user;
}
Not one one, but one important line. Is that close enough? :-)
Chuck
On Sep 14, 2006, at 5:19 PM, Miguel Arroz wrote:
Hi!
I'm trying to follow the advice I received on WWDC from
experienced people to avoid using components that auto-synch their
values (ie, the normal way WO works). I was open to this suggestion
because I was having some problems that were clearly related to
auto-syncing.
So, I'm trying to make some subcomponents that do not use auto-
sync. It works great for some stuff (like binding actions, yahoo!)
but there are some other stuff that I guess I'm not doing right.
Imagine I have on the top component an object, say, an User. I
want to bind the User object to a subcomponent inside the top
component. The subcomponent does not auto-sync.
So, I override the synchronizesVariablesWithBindings method on
the subcomponent, and I create a method, called user:
public User user() {
return (User)valueForBinding(USER_BINDING_NAME);
}
Well, but this is stupid. I'm actually doing a lot more work
(with valueForBinding) than what was done on auto-synch. Every time
I access the user, WO goes and grabs the binding. This is a waste
of cycles and does not solve one of the problems that lead me to
try to write non-auto-synching componentes - to control exactly
when is the stuff synced.
I thought about using the subcomponent constructor, but I tested,
and when I regenerate the page with another user (imagine I click
on a "Next" link that shows me another user, but the parent
component it's the same - the method binded to the link returns
null) WO apparently re-uses the subcomponent too, so no constructor
is called.
So... basically... how do you solve this?
<Waiting for a one line reply with a really obvious answer that I
totally missed>
Yours
Miguel Arroz
"The world lies in the hands of evil
And we pray it would last" -- Apocalyptica, Life Burns!
Miguel Arroz
http://www.ipragma.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/practical_webobjects
_______________________________________________
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