Changes for page Development-WO Component-Binding Synchronization
Last modified by Pascal Robert on 2010/09/19 10:29
From version 3.1
edited by Quinton Dolan
on 2007/07/12 20:04
on 2007/07/12 20:04
Change comment:
There is no comment for this version
To version 5.1
edited by Pascal Robert
on 2010/09/19 10:29
on 2010/09/19 10:29
Change comment:
There is no comment for this version
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - Programming__WebObjects-Web Applications-Development-WO Component-Binding Synchronization1 +Development-WO Component-Binding Synchronization - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. qdolan1 +XWiki.probert - Content
-
... ... @@ -1,4 +1,4 @@ 1 -== Overview 1 +== Overview == 2 2 3 3 When you create a subclass of WOComponent, the default configuration is to have all of your bindings automatically synchronized. Binding synchronization is the process of getting and setting parent and chldren .wod file bindings during the request-response loop. While binding synchronization is very convenient, the one downside is that your binding get and set methods can be called multiple times (as many as six) during the request-response loop. As a result, you should be careful about potential performance problems inside of get and set methods. If you would rather avoid the potential performance issues, it is possible to disable automatic binding synchronization in your component by simply overriding the synchronizesVariablesWithBindings method to return false as in the below example: 4 4 ... ... @@ -12,7 +12,7 @@ 12 12 13 13 If synchronizesVariablesWithBindings is false, you will use the valueForBinding(bindingName) and setValueForBinding(value, bindingName) methods to get and set the binding value manually. 14 14 15 -== WOComponentContent 15 +== WOComponentContent == 16 16 17 17 Because of the way WOComponentContent works, binding is often "backwards" from your intuition (often it ends up that your wrapper pushes its title value into your page instead of the other way around). One way to make your template wrapper component behave the way you expect is to turn off automatic binding synchronization: 18 18 ... ... @@ -28,7 +28,7 @@ 28 28 29 29 {{/code}} 30 30 31 -=== Kieran Kelleher 31 +=== Kieran Kelleher === 32 32 33 33 Have a look at WOComponent API valueForBinding and setValueForBinding methods. In your subcomponent, you can define the API (jigsaw icon in WOBuilder. Use lazy initialization to pull bindings on demand. Subcomponents in general pull from parent and push into parent through bindings. Here is an example of a simple manual pull and push of a 'customer' binding: 34 34 ... ... @@ -50,13 +50,11 @@ 50 50 51 51 Also look at synchronizeVariablesWithBindings to turn on manual binding synchronization (recommended to synchronize on demand rather than 6 times or so through the R-R loop) 52 52 53 -=== wojingo 53 +=== wojingo === 54 54 55 -If you use lazy initialization in your binding accessor methods as described above, you should also make the component 55 +If you use lazy initialization in your binding accessor methods as described above, you should also make the component 56 56 stateless. If you do not make the component stateless you will find that your component may display incorrect values when 57 57 used in a WORepetition. This situation occurs when the WORepetition's list is changed via a component action and null is returned. The existing nested component will be reused and the values in the original list will be displayed. 58 58 59 -Make the component stateless and override its reset method, setting all instance variables to null. This will make the 59 +Make the component stateless and override its reset method, setting all instance variables to null. This will make the 60 60 component behave as expected. 61 - 62 -Category:WebObjects