WOSwitchComponent?https://wiki.wocommunity.org/display/documentation/WOSwitchComponentI used it with great success, once I figured out how to not use it.Right now I can’t remember what was the symptom, what what the cause and how I fixed it.All I remember is that it’s related to sharing instances your component instantiated by the switch component. So if you encounter a problem, keep that in mind.jfvOn May 29, 2015, at 5:22 PM, HOUNKPONOU Ronald <email@hidden> wrote:Hi everyone!!Thanks for all your response. Everything is now working for me. I was doing a mistake in the call of the component A in a third one (C) as if A require the binding value. (A is the template that all pages should use).But i have another question (I don't know if it is best to make a separate post):Question : What is the best way to make a dynamiq page inclusion system?I have a lot of custumized components those i would like to listed on a central page (this page use my template).And i want that depending of the clicked link the corresponding components is load in the content area ofmy central page.Thanks for your help.2015-05-29 16:57 GMT+01:00 Jean-François Veillette <email@hidden>:Hi Ronald,is your B component syncronizing bindings?If so, your B instance should receive a call equivalent to « b.takeValueForKey(session().authenticatedUser(), “userAccount”); » so you should comply to KVC for this key (public ivar, get/set method .. your choice) to get it assigned and available.If your B component is non-synchronized, then you have to get it whenever you need it: « User user = this.valueForBinding(“userAccount”); »Also, since your B component is in a framework and is aware of the concept of a userAccount, I would try to keep the dependency as loose as possible and NOT add coupling directly with the session object.But if you absolutely have to do it (last resort), it could be done with simple KVC: « User user = (User) session().valueForKey("authenticatedUser”); »or even: « User user = (User) valueForKeyPath(“session.authenticatedUser”); »Ways of passing generic/contextual objects from the front-end layer to the lower end without adding too much coupling is by going through the editingContext.userInfo dictionary, or through the current thread userInfo dictionary (see ERXThreadStorage). Those 2 objects are available in most lower level objects and can be set from the upper level just as easily.jfvOn May 29, 2015, at 9:11 AM, HOUNKPONOU Ronald <email@hidden> wrote:In A.html<webobject name = "template"></webobject>In A.woodtemplate : B { userAccount = session.authenticatedUser;}in B.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title></head><body><webobject name = "specialitemedicale"><label>Libellé</label><webobject name = "libelle"/><webobject name = "enregistrer"/></webobject></body></html>in B.woodspecialitemedicale : WOForm {}libelle : WOTextField { value = libelle;}enregistrer : WOSubmitButton {action="">value="Enregistrer";}2015-05-29 13:15 GMT+01:00 Johann Werner <email@hidden>:What is your HTML? You need to wire up your binding with the actual method/ivar of your component A: … <wo:B userAccount="$account" /> … and in A.java: public MyAccountClass account = …; > Am 29.05.2015 um 13:25 schrieb HOUNKPONOU Ronald <email@hidden>: > > I forgot the image. > > 2015-05-29 12:23 GMT+01:00 HOUNKPONOU Ronald <email@hidden>: > Hi everyone, > > Iam facing a problem with subcomponent binding. > > I have 2 componets A & B. B is to be include in A. > > But B need some information (eg. Authenticated user object). So i have create a binding as show in the attached picture and add its gette 7 setter in B.java. > > (I dont know how to specify Value Set to be my Objet Type. so i try with undefined & ressources) > > But the object is not passed to B. > > I got a NullPointerException when trying to access the passed vairable in B.java > > Thanks for your help. > > <Selection_005.png> _______________________________________________ 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 References: >Components binding with custom object (From: HOUNKPONOU Ronald <email@hidden>) >Re: Components binding with custom object (From: HOUNKPONOU Ronald <email@hidden>) >Re: Components binding with custom object (From: Jean-François Veillette <email@hidden>) >Re: Components binding with custom object (From: HOUNKPONOU Ronald <email@hidden>) >Re: Components binding with custom object (From: Jean-François Veillette <email@hidden>) Prev by Date: Re: Components binding with custom object Next by Date: Re: Components binding with custom object Previous by thread: Re: Components binding with custom object Next by thread: Re: Components binding with custom object Index(es): Date Thread
On May 29, 2015, at 5:22 PM, HOUNKPONOU Ronald <email@hidden> wrote:Hi everyone!!Thanks for all your response. Everything is now working for me. I was doing a mistake in the call of the component A in a third one (C) as if A require the binding value. (A is the template that all pages should use).But i have another question (I don't know if it is best to make a separate post):Question : What is the best way to make a dynamiq page inclusion system?I have a lot of custumized components those i would like to listed on a central page (this page use my template).And i want that depending of the clicked link the corresponding components is load in the content area ofmy central page.Thanks for your help.2015-05-29 16:57 GMT+01:00 Jean-François Veillette <email@hidden>:Hi Ronald,is your B component syncronizing bindings?If so, your B instance should receive a call equivalent to « b.takeValueForKey(session().authenticatedUser(), “userAccount”); » so you should comply to KVC for this key (public ivar, get/set method .. your choice) to get it assigned and available.If your B component is non-synchronized, then you have to get it whenever you need it: « User user = this.valueForBinding(“userAccount”); »Also, since your B component is in a framework and is aware of the concept of a userAccount, I would try to keep the dependency as loose as possible and NOT add coupling directly with the session object.But if you absolutely have to do it (last resort), it could be done with simple KVC: « User user = (User) session().valueForKey("authenticatedUser”); »or even: « User user = (User) valueForKeyPath(“session.authenticatedUser”); »Ways of passing generic/contextual objects from the front-end layer to the lower end without adding too much coupling is by going through the editingContext.userInfo dictionary, or through the current thread userInfo dictionary (see ERXThreadStorage). Those 2 objects are available in most lower level objects and can be set from the upper level just as easily.jfvOn May 29, 2015, at 9:11 AM, HOUNKPONOU Ronald <email@hidden> wrote:In A.html<webobject name = "template"></webobject>In A.woodtemplate : B { userAccount = session.authenticatedUser;}in B.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title></head><body><webobject name = "specialitemedicale"><label>Libellé</label><webobject name = "libelle"/><webobject name = "enregistrer"/></webobject></body></html>in B.woodspecialitemedicale : WOForm {}libelle : WOTextField { value = libelle;}enregistrer : WOSubmitButton {action="">value="Enregistrer";}2015-05-29 13:15 GMT+01:00 Johann Werner <email@hidden>:What is your HTML? You need to wire up your binding with the actual method/ivar of your component A: … <wo:B userAccount="$account" /> … and in A.java: public MyAccountClass account = …; > Am 29.05.2015 um 13:25 schrieb HOUNKPONOU Ronald <email@hidden>: > > I forgot the image. > > 2015-05-29 12:23 GMT+01:00 HOUNKPONOU Ronald <email@hidden>: > Hi everyone, > > Iam facing a problem with subcomponent binding. > > I have 2 componets A & B. B is to be include in A. > > But B need some information (eg. Authenticated user object). So i have create a binding as show in the attached picture and add its gette 7 setter in B.java. > > (I dont know how to specify Value Set to be my Objet Type. so i try with undefined & ressources) > > But the object is not passed to B. > > I got a NullPointerException when trying to access the passed vairable in B.java > > Thanks for your help. > > <Selection_005.png>
Hi Ronald,is your B component syncronizing bindings?If so, your B instance should receive a call equivalent to « b.takeValueForKey(session().authenticatedUser(), “userAccount”); » so you should comply to KVC for this key (public ivar, get/set method .. your choice) to get it assigned and available.If your B component is non-synchronized, then you have to get it whenever you need it: « User user = this.valueForBinding(“userAccount”); »Also, since your B component is in a framework and is aware of the concept of a userAccount, I would try to keep the dependency as loose as possible and NOT add coupling directly with the session object.But if you absolutely have to do it (last resort), it could be done with simple KVC: « User user = (User) session().valueForKey("authenticatedUser”); »or even: « User user = (User) valueForKeyPath(“session.authenticatedUser”); »Ways of passing generic/contextual objects from the front-end layer to the lower end without adding too much coupling is by going through the editingContext.userInfo dictionary, or through the current thread userInfo dictionary (see ERXThreadStorage). Those 2 objects are available in most lower level objects and can be set from the upper level just as easily.jfvOn May 29, 2015, at 9:11 AM, HOUNKPONOU Ronald <email@hidden> wrote:In A.html<webobject name = "template"></webobject>In A.woodtemplate : B { userAccount = session.authenticatedUser;}in B.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title></head><body><webobject name = "specialitemedicale"><label>Libellé</label><webobject name = "libelle"/><webobject name = "enregistrer"/></webobject></body></html>in B.woodspecialitemedicale : WOForm {}libelle : WOTextField { value = libelle;}enregistrer : WOSubmitButton {action="">value="Enregistrer";}2015-05-29 13:15 GMT+01:00 Johann Werner <email@hidden>:What is your HTML? You need to wire up your binding with the actual method/ivar of your component A: … <wo:B userAccount="$account" /> … and in A.java: public MyAccountClass account = …; > Am 29.05.2015 um 13:25 schrieb HOUNKPONOU Ronald <email@hidden>: > > I forgot the image. > > 2015-05-29 12:23 GMT+01:00 HOUNKPONOU Ronald <email@hidden>: > Hi everyone, > > Iam facing a problem with subcomponent binding. > > I have 2 componets A & B. B is to be include in A. > > But B need some information (eg. Authenticated user object). So i have create a binding as show in the attached picture and add its gette 7 setter in B.java. > > (I dont know how to specify Value Set to be my Objet Type. so i try with undefined & ressources) > > But the object is not passed to B. > > I got a NullPointerException when trying to access the passed vairable in B.java > > Thanks for your help. > > <Selection_005.png>
On May 29, 2015, at 9:11 AM, HOUNKPONOU Ronald <email@hidden> wrote:In A.html<webobject name = "template"></webobject>In A.woodtemplate : B { userAccount = session.authenticatedUser;}in B.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title></head><body><webobject name = "specialitemedicale"><label>Libellé</label><webobject name = "libelle"/><webobject name = "enregistrer"/></webobject></body></html>in B.woodspecialitemedicale : WOForm {}libelle : WOTextField { value = libelle;}enregistrer : WOSubmitButton {action="">value="Enregistrer";}2015-05-29 13:15 GMT+01:00 Johann Werner <email@hidden>:What is your HTML? You need to wire up your binding with the actual method/ivar of your component A: … <wo:B userAccount="$account" /> … and in A.java: public MyAccountClass account = …; > Am 29.05.2015 um 13:25 schrieb HOUNKPONOU Ronald <email@hidden>: > > I forgot the image. > > 2015-05-29 12:23 GMT+01:00 HOUNKPONOU Ronald <email@hidden>: > Hi everyone, > > Iam facing a problem with subcomponent binding. > > I have 2 componets A & B. B is to be include in A. > > But B need some information (eg. Authenticated user object). So i have create a binding as show in the attached picture and add its gette 7 setter in B.java. > > (I dont know how to specify Value Set to be my Objet Type. so i try with undefined & ressources) > > But the object is not passed to B. > > I got a NullPointerException when trying to access the passed vairable in B.java > > Thanks for your help. > > <Selection_005.png>
What is your HTML? You need to wire up your binding with the actual method/ivar of your component A: … <wo:B userAccount="$account" /> … and in A.java: public MyAccountClass account = …; > Am 29.05.2015 um 13:25 schrieb HOUNKPONOU Ronald <email@hidden>: > > I forgot the image. > > 2015-05-29 12:23 GMT+01:00 HOUNKPONOU Ronald <email@hidden>: > Hi everyone, > > Iam facing a problem with subcomponent binding. > > I have 2 componets A & B. B is to be include in A. > > But B need some information (eg. Authenticated user object). So i have create a binding as show in the attached picture and add its gette 7 setter in B.java. > > (I dont know how to specify Value Set to be my Objet Type. so i try with undefined & ressources) > > But the object is not passed to B. > > I got a NullPointerException when trying to access the passed vairable in B.java > > Thanks for your help. > > <Selection_005.png>
_______________________________________________ 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