• 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: synchronizesVariablesWithBindings()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: synchronizesVariablesWithBindings()


  • Subject: Re: synchronizesVariablesWithBindings()
  • From: WebObjects TORAcom <email@hidden>
  • Date: Tue, 21 Aug 2012 15:59:01 -0500

Thanks Chuck and Jesse.

I think I understand the term lazy synchronization and it makes totally sense.

But, how to handle a case like this:

Three entities and their relationships:

User  <-----> Address
Client <-----> Address

I create a reusable component named EditAddress and use it inside two other components: EditUser and EditClient. I would pass the Address object via a binding.

In the EditAddress I would use WOTextFields connected to the address' parameters: address.country, address.state, etc.

How could I do that with lazy synchronization?

Thanks.

Miguel Torres



On 21/08/2012, at 14:22, Chuck Hill <email@hidden> wrote:

Hi Miguel,

On 2012-08-21, at 11:19 AM, WebObjects TORAcom wrote:

Hi List,

I am trying to implement best practices in our applications, we want to take control of component's  binding syncrhonization.

First of all I understand that we should override the synchronizesVariablesWithBindings function like this:


public boolean synchronizesVariablesWithBindings() {
return false;
}



But where in the request - response loop should be the better place to synchronize our bindings, a lot of time ago (years) somewhere in the internet I found info that recommends Pull binding's values in the takeValuesFromRequest(WORequest r, WOContext c) method and Push binding's values in the appendToResponse(WOResponse r, WOContext c).

I am not sure about that, so we have been working with the automatic synchronization of our bindings.

I usually do lazy synchronization, and only do what I need.  Something like this:


private String exampleValue;

public void awake() {
super.awake();
exampleValue = null;
}

public String exampleValue() {
if (exampleValue == null) {
exampleValue = stringValueForBinding("exampleValue");
}
return exampleValue;
}

public void setExampleValue(String newValue) {
if (ERXExtensions.saveDifferent(exampleValue, newValue) {
setValueForBinding(newValue, "exampleValue");
exampleValue = newValue;
}
}


Chuck

--
Chuck Hill             Senior Consultant / VP Development

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/gvc/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

  • Follow-Ups:
    • Re: synchronizesVariablesWithBindings()
      • From: Chuck Hill <email@hidden>
References: 
 >synchronizesVariablesWithBindings() (From: WebObjects TORAcom <email@hidden>)
 >Re: synchronizesVariablesWithBindings() (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: synchronizesVariablesWithBindings()
  • Next by Date: Re: synchronizesVariablesWithBindings()
  • Previous by thread: Re: synchronizesVariablesWithBindings()
  • Next by thread: Re: synchronizesVariablesWithBindings()
  • Index(es):
    • Date
    • Thread