Re: Direclty using parent's compoundpropertymodel not possible ?
I think we're talking about two different things: I was talking about trying to access the model of a parent component, it sounds like you're talking about trying to access the model of a superclass. In the case I'm talking about, you can't access the inherited model in your constructor because your object hasn't been added to the parent component yet (it will be added after the constructor runs). Therefore you need to wait until onBeforeRender to do initialization that depends on inspecting the inherited model. Hope that helps, Alex On Jul 31, 2008, at 5:39 PM, Daniel Freitas wrote: I think I might be missing something here. I assume you don't create your components in the parent's constructor right? Or you call a different super constructor perhaps? Because java executes the parent constructor before calling a subclass constructor and for what I've seen so far in the examples, the components are usually created and added in the constructor, so you would have created your components and models before getting to the subclass initialization. 2008/7/31 ZedroS [EMAIL PROTECTED] hi Sorry for the delay, holidays went in the way ;) Alex Jacoby-2 wrote: More than once I've tried accessing my inherited model from within a constructor, forgetting that since the component hasn't been added yet it can't access its inherited model there. That's not your problem, right? Alex hum, Alex, thanks a lot !! It's something I hadn't figured out by myself and most probably stuck my head against more than once without even realizing it ! Thanks a lot (and shame on me) ! It would be nice for it to be included in the Working with Wicket models wiki page for people like me... I'll definitely makes more tries of it, since I'm not sure I properly get how compound property models are shared among inheritors. And the day I'm sure of it, I'll update the wiki page if noone has done it before me. ++ zedros -- View this message in context: http://www.nabble.com/Direclty-using-parent%27s-compoundpropertymodel-not-possible---tp18356056p18763687.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Direclty using parent's compoundpropertymodel not possible ?
hi Sorry for the delay, holidays went in the way ;) Alex Jacoby-2 wrote: More than once I've tried accessing my inherited model from within a constructor, forgetting that since the component hasn't been added yet it can't access its inherited model there. That's not your problem, right? Alex hum, Alex, thanks a lot !! It's something I hadn't figured out by myself and most probably stuck my head against more than once without even realizing it ! Thanks a lot (and shame on me) ! It would be nice for it to be included in the Working with Wicket models wiki page for people like me... I'll definitely makes more tries of it, since I'm not sure I properly get how compound property models are shared among inheritors. And the day I'm sure of it, I'll update the wiki page if noone has done it before me. ++ zedros -- View this message in context: http://www.nabble.com/Direclty-using-parent%27s-compoundpropertymodel-not-possible---tp18356056p18763687.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Direclty using parent's compoundpropertymodel not possible ?
I think I might be missing something here. I assume you don't create your components in the parent's constructor right? Or you call a different super constructor perhaps? Because java executes the parent constructor before calling a subclass constructor and for what I've seen so far in the examples, the components are usually created and added in the constructor, so you would have created your components and models before getting to the subclass initialization. 2008/7/31 ZedroS [EMAIL PROTECTED] hi Sorry for the delay, holidays went in the way ;) Alex Jacoby-2 wrote: More than once I've tried accessing my inherited model from within a constructor, forgetting that since the component hasn't been added yet it can't access its inherited model there. That's not your problem, right? Alex hum, Alex, thanks a lot !! It's something I hadn't figured out by myself and most probably stuck my head against more than once without even realizing it ! Thanks a lot (and shame on me) ! It would be nice for it to be included in the Working with Wicket models wiki page for people like me... I'll definitely makes more tries of it, since I'm not sure I properly get how compound property models are shared among inheritors. And the day I'm sure of it, I'll update the wiki page if noone has done it before me. ++ zedros -- View this message in context: http://www.nabble.com/Direclty-using-parent%27s-compoundpropertymodel-not-possible---tp18356056p18763687.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Direclty using parent's compoundpropertymodel not possible ?
More than once I've tried accessing my inherited model from within a constructor, forgetting that since the component hasn't been added yet it can't access its inherited model there. That's not your problem, right? Alex On Jul 11, 2008, at 3:17 AM, Joseph P. wrote: I did already. My issue is more about model sharing with sub components and especially how to access it easily in a sub component (like for example in a panel whose representation depends on the data in the model attached to some form way above in the hierarchy). Thanks nonetheless for your help ++ zedros - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Direclty using parent's compoundpropertymodel not possible ?
Newgro wrote: Did you check http://cwiki.apache.org/WICKET/working-with-wicket-models.html already? It's explained realy well. I did already. My issue is more about model sharing with sub components and especially how to access it easily in a sub component (like for example in a panel whose representation depends on the data in the model attached to some form way above in the hierarchy). Thanks nonetheless for your help ++ zedros -- View this message in context: http://www.nabble.com/Direclty-using-parent%27s-compoundpropertymodel-not-possible---tp18356056p18398127.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Direclty using parent's compoundpropertymodel not possible ?
and that sub component must have the complete object? or does the panel only have to have a property of that object? If it has to have the complete object you can always make your own model give the panel this kind of model: public class SuperObjectModel implements IModel, IComponentAssignedModel { public Object getObject() { return null; } public void setObject(Object object) { } public void detach() { } public IWrapModel wrapOnAssignment(final Component component) { return new IWrapModel() { public void detach(){ } public void setObject(Object object){ } public Object getObject() { MarkupContainer parent = component.getParent(); while (parent != null !(parent.getModel() instanceof IComponentInheritedModel)) { return parent.getModelObject(); } return null; } public IModel getWrappedModel() { return SuperObjectModel.this; } }; } } On Fri, Jul 11, 2008 at 9:17 AM, Joseph P. [EMAIL PROTECTED] wrote: Newgro wrote: Did you check http://cwiki.apache.org/WICKET/working-with-wicket-models.html already? It's explained realy well. I did already. My issue is more about model sharing with sub components and especially how to access it easily in a sub component (like for example in a panel whose representation depends on the data in the model attached to some form way above in the hierarchy). Thanks nonetheless for your help ++ zedros -- View this message in context: http://www.nabble.com/Direclty-using-parent%27s-compoundpropertymodel-not-possible---tp18356056p18398127.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Direclty using parent's compoundpropertymodel not possible ?
oeps loop has to be something like this ofcourse Component parent = component; while ( (parent = parent.getParent()) != null !(parent.getModel() instanceof IComponentInheritedModel)) { return parent.getModelObject(); } return null; On Fri, Jul 11, 2008 at 9:28 AM, Johan Compagner [EMAIL PROTECTED] wrote: and that sub component must have the complete object? or does the panel only have to have a property of that object? If it has to have the complete object you can always make your own model give the panel this kind of model: public class SuperObjectModel implements IModel, IComponentAssignedModel { public Object getObject() { return null; } public void setObject(Object object) { } public void detach() { } public IWrapModel wrapOnAssignment(final Component component) { return new IWrapModel() { public void detach(){ } public void setObject(Object object){ } public Object getObject() { MarkupContainer parent = component.getParent(); while (parent != null !(parent.getModel() instanceof IComponentInheritedModel)) { return parent.getModelObject(); } return null; } public IModel getWrappedModel() { return SuperObjectModel.this; } }; } } On Fri, Jul 11, 2008 at 9:17 AM, Joseph P. [EMAIL PROTECTED] wrote: Newgro wrote: Did you check http://cwiki.apache.org/WICKET/working-with-wicket-models.html already? It's explained realy well. I did already. My issue is more about model sharing with sub components and especially how to access it easily in a sub component (like for example in a panel whose representation depends on the data in the model attached to some form way above in the hierarchy). Thanks nonetheless for your help ++ zedros -- View this message in context: http://www.nabble.com/Direclty-using-parent%27s-compoundpropertymodel-not-possible---tp18356056p18398127.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Direclty using parent's compoundpropertymodel not possible ?
Thanks a lot for your answer. One question though : Johan Compagner wrote: CPM is used that child components can have sub objects/properties of that main object by using the child components id as the property how can I easily get the CPM in sub component ? For example, if I have a family object with children in itm and a panel displaying the basic family info with a subpanel displaying the children info, how would you do to give/get the CPM's children in there ? thanks again ! zedros -- View this message in context: http://www.nabble.com/Direclty-using-parent%27s-compoundpropertymodel-not-possible---tp18356056p18377171.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Direclty using parent's compoundpropertymodel not possible ?
Am Donnerstag, 10. Juli 2008 09:08:08 schrieb ZedroS: Thanks a lot for your answer. One question though : Johan Compagner wrote: CPM is used that child components can have sub objects/properties of that main object by using the child components id as the property how can I easily get the CPM in sub component ? For example, if I have a family object with children in itm and a panel displaying the basic family info with a subpanel displaying the children info, how would you do to give/get the CPM's children in there ? thanks again ! zedros Did you check http://cwiki.apache.org/WICKET/working-with-wicket-models.html already? It's explained realy well. Cheers Per - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Direclty using parent's compoundpropertymodel not possible ?
Hi I have a compoundpropertymodel (cpm for the rest of the mail) set on my first level panel, then in one added second level panel I tried to do getModelObject(); which returned null. How comes ? I was expecting the cpm to be inherited in all my sub components... Is it possible to do so ? How should I do otherwise ? For the time being, I give a reference to the model at each sub component (panels, forms...) and directly access it, but I find it kind of not proper. Thanks in advance ++ zedros -- View this message in context: http://www.nabble.com/Direclty-using-parent%27s-compoundpropertymodel-not-possible---tp18356056p18356056.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Direclty using parent's compoundpropertymodel not possible ?
the second level panel does inherit it yet But it will not give you the object thats inside the first panel. CPM is used that child components can have sub objects/properties of that main object by using the child components id as the property if you want to inherited really the same component over all the childs you have to create your own InheritedModel johan On Wed, Jul 9, 2008 at 9:35 AM, ZedroS [EMAIL PROTECTED] wrote: Hi I have a compoundpropertymodel (cpm for the rest of the mail) set on my first level panel, then in one added second level panel I tried to do getModelObject(); which returned null. How comes ? I was expecting the cpm to be inherited in all my sub components... Is it possible to do so ? How should I do otherwise ? For the time being, I give a reference to the model at each sub component (panels, forms...) and directly access it, but I find it kind of not proper. Thanks in advance ++ zedros -- View this message in context: http://www.nabble.com/Direclty-using-parent%27s-compoundpropertymodel-not-possible---tp18356056p18356056.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]