Re: [Wicket-user] Playing with models:)/wicket.extensions.markup.html.form.palette.Palette;
Ill like to take you up on the discussion. I see the following pros and cons with this approach: Pro setObject: Allows the user to implement logic into the model If so desired Special conversions to satishfy wicket components needs, for example, wicket component needs one list but you have three, so join them in the get operator and split them in the set Logic, etc disable other components, notify Hold the standard implicitly directed by having a set object method Feels the right wayJ Con setObject: Performance could be slightly improved? I do think that that using setObject on the model is something that always should be done; it creates a lot of flexibility and why have setObject if not to use it, if not it will only cause confusion. -regards Nino From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Igor Vaynberg Sent: 17. juli 2006 17:32 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:)/wicket.extensions.markup.html.form.palette.Palette; components whose model is backed by a collection do not always call setobject() because they work on the collection directly so there is no need to call Collection c=model.getObject(); c.clear(); //refill c model.setObject(c); == NOOP and also in wicket there is a guard component.setObject(c) { if (c.equals(model.getobject()) { //noop } else { //clone for version tracking; model.setObject (c); } } the above saves on unnecessary cloning. just a few things to be aware of, whether or not we should call setobject() anyways is still up for discussion. i kinda think we should even though sometimes the objects are the same. -Igor On 7/17/06, Nino Wael [EMAIL PROTECTED] wrote: Strange then, it seems as the extension palette does not update on a submit? Does it somehow detach from its model? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Eelco Hillenius Sent: 17. juli 2006 12:14 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) /wicket.extensions.markup.html.form.palette.Palette; When is setObject supposed to get called, Cause I only see it get called during construct? Whenever a (form)component has to update it's modelcontents. Or if you call setObject explicitly of course :() Typically, a component update is done by Form, which visits all it's children and calls updateModel on them. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:)/wicket.extensions.markup.html.form.palette.Palette;
yes you are right.But in 1.2 this couldn't be done because of some code that was sitting in the way (modelChanging/changed double called and so on)in 2.0 we pretty much have fixed that part i believe. now. Have to look at it further. johanOn 7/18/06, Nino Wael [EMAIL PROTECTED] wrote: I'll like to take you up on the discussion. I see the following pros and cons with this approach: Pro setObject: Allows the user to implement logic into the model If so desired Special conversions to satishfy wicket components needs, for example, wicket component needs one list but you have three, so join them in the get operator and split them in the set Logic, etc disable other components, notify … Hold the standard implicitly directed by having a set object method Feels the right way J Con setObject: Performance could be slightly improved? I do think that that using setObject on the model is something that always should be done; it creates a lot of flexibility and why have setObject if not to use it, if not it will only cause confusion. -regards Nino From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Igor Vaynberg Sent: 17. juli 2006 17:32 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:)/wicket.extensions.markup.html.form.palette.Palette; components whose model is backed by a collection do not always call setobject() because they work on the collection directly so there is no need to call Collection c=model.getObject(); c.clear(); //refill c model.setObject(c); == NOOP and also in wicket there is a guard component.setObject(c) { if (c.equals(model.getobject()) { //noop } else { //clone for version tracking; model.setObject (c); } } the above saves on unnecessary cloning. just a few things to be aware of, whether or not we should call setobject() anyways is still up for discussion. i kinda think we should even though sometimes the objects are the same. -Igor On 7/17/06, Nino Wael [EMAIL PROTECTED] wrote: Strange then, it seems as the extension palette does not update on a submit? Does it somehow detach from its model? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Eelco Hillenius Sent: 17. juli 2006 12:14 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) /wicket.extensions.markup.html.form.palette.Palette; When is setObject supposed to get called, Cause I only see it get called during construct? Whenever a (form)component has to update it's modelcontents. Or if you call setObject explicitly of course :() Typically, a component update is done by Form, which visits all it's children and calls updateModel on them. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:) / wicket.extensions.markup.html.form.palette.Palette;
When is setObject supposed to get called, Cause I only see it get called during construct? Whenever a (form)component has to update it's model contents. Or if you call setObject explicitly of course :() Typically, a component update is done by Form, which visits all it's children and calls updateModel on them. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:) /wicket.extensions.markup.html.form.palette.Palette;
Strange then, it seems as the extension palette does not update on a submit? Does it somehow detach from its model? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eelco Hillenius Sent: 17. juli 2006 12:14 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) /wicket.extensions.markup.html.form.palette.Palette; When is setObject supposed to get called, Cause I only see it get called during construct? Whenever a (form)component has to update it's model contents. Or if you call setObject explicitly of course :() Typically, a component update is done by Form, which visits all it's children and calls updateModel on them. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:) /wicket.extensions.markup.html.form.palette.Palette;
components whose model is backed by a collection do not always call setobject() because they work on the collection directly so there is no need to callCollection c=model.getObject();c.clear();//refill c model.setObject(c); == NOOPand also in wicket there is a guardcomponent.setObject(c) { if (c.equals(model.getobject()) { //noop } else { //clone for version tracking; model.setObject (c); }}the above saves on unnecessary cloning.just a few things to be aware of, whether or not we should call setobject() anyways is still up for discussion.i kinda think we should even though sometimes the objects are the same. -Igor On 7/17/06, Nino Wael [EMAIL PROTECTED] wrote: Strange then, it seems as the extension palette does not update on a submit? Does it somehow detach from its model?-Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Eelco HilleniusSent: 17. juli 2006 12:14To: wicket-user@lists.sourceforge.netSubject: Re: [Wicket-user] Playing with models:) /wicket.extensions.markup.html.form.palette.Palette; When is setObject supposed to get called, Cause I only see it get called during construct?Whenever a (form)component has to update it's modelcontents. Or ifyou call setObject explicitly of course :() Typically, a componentupdate is done by Form, which visits all it's children and calls updateModel on them.Eelco-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:)
Thanks;) From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Johan Compagner Sent: 14. juli 2006 15:07 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) Disableding/Enableing can be done with pull (attributemodifiers on C/D that are looking at A/B) Setting the defaults could be done by push so A/B pushing values ot C/D That last part could also be one by the backing bean ofcourse. So if you you have a bean where A sets its value on. Then when that value is set you also set the value of C and c then pulls that data. johan On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: Ok scratch what I send previously. I'll try to explain more clearly what Im trying to do. This picture describes show what I have, I'll now try to describe the flow http://www.badongo.com/pic/237253 This is what I got currently: The component which contains B are based on the Palette component from wicket extensions. A populates the component below as C does D So this is the functionality I need: When A or B is changed C needs to be repopulated and D needs to be emptied If B.size are different from 1 then C and D needs to be disabled If E is clicked then C and D needs to be disabled (this is partly working with an ajax call, however the backing model does not seem to be updated). If C is changed then D needs to be repopulated (this is working already with an ajax call). My original idea was to make the components A/B aware of C/D and make A/B make an direct repopulation on C/D. However looking at all the facilities with models I thought that I could make the C/D model aware of A/B instead. Would the correct thing to do make A/B model notify C/D model that a change had happend? Or would it be that the A/B component needs to be aware of the C/D component and make A/B call a populate on C/D? The last idea I got now and what I think should work is that the A/B model needs to be aware of the C/D component and repopulate/disable/enable when appropriate. Hopes this makes a bit sense? Regards Nino From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Johan Compagner Sent: 14. juli 2006 14:18 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) ok you just want to prefill it everytime the page/textarea is rendered? What happens then to the previous value the user just typed in?? If for example you used a normal detachable model (so not readonly) And the first time you load some default stuff. Then a user alters the textarea and submits. Then the page is rendered again. Then in your case the input he made is gone? Because you again do a load depending on the list. I would do this different. Just give the textarea a normal model that can be updated. Then do a onSelectionChange on the list and when the list changes you push the value that you want to set in the textarea. Of course this can also be done in an own textarea detachable model. But then you need to know the previous selected value of the list. johan On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: So heres what I do, code is possibly flawed. I've tried with the abstractmodel instead which works but gets multiple hits pr request which makes it hard to detect if I should repopulate, actually it seems as it hits on modelchanging and onmodelchanged... Basicly what Im trying to do is to have a dependency on a dropdown and a listbox, so if the dropdown is changed and one thing is selected in the listbox my LoadableDetachableModel should be populated with new values. If listbox.size!=1 then no values should be loaded. In the begining I based my example on Igors Ajax radiochoice example. LoadableDetachableModel detachdebugmodel = new LoadableDetachableModel() { public ItemContainer previous = new ItemContainer(); private boolean previousUpdate = false; private String value = ; protected Object load() { value = No Populate compare; if (reportModel.getOmraade().getDataItem() != null previous.getDataItem() != null) { if (!reportModel.getOmraade().getDataItem().equals( previous.getDataItem())) { previousUpdate = true; value = Repopulate AreaType changed!; return value; } } if (reportModel.getOmraade_selected().getDualModel().getFill() .size() == 1) { if (previous.getDataItem ().equals( reportModel.getOmraade().getDataItem()) == false || !previousUpdate) { value = Enable Populate compareTypes and enable compareTypes; previousUpdate = true; return value; } value = not changed no need to update; return value; } else { previous .setDataItem( reportModel.getOmraade().getDataItem()); value = EMPTY disable CompareTypes; previousUpdate = false; return value; } } }; TextArea myText = new TextArea(debugmodel, detachdebugmodel); -Original Message- From: [EMAIL PROTECTED] on behalf of Johan Compagner Sent: Fri 14-07-2006 13:37 To: wicket-user@lists.sourceforge.net Cc
Re: [Wicket-user] Playing with models:)
IModel#getObject is called anytime a component accesses it. Basically, you should never depend on that method getting called a fixed number of times; it is not designed for that. Typically if you need to do heavy operations such as loading data from a database, you should use detachable models. A good model for such things is LoadableDetachableModel. the #load method is only called once a request, and the loaded object is then reused throughout the request. At the end of the request, the model is detached and the temporary object is cleaned up. Eelco On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: Hah got your Attention there, though sadly enough its only abstractmodels. Im not sure when getObject are supposed to be called(what triggers a call). The following I can see are that my model are called on page construct(which makes sense to me). But on form submit the model are called two times, is that behaviour normal, also in what order are models called? My model are dependant on some of the other model on the page so I would always need for them to be updated first. Regards Nino - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:)
i wanna play with models too, but my wife wont let me :( -Igor On 7/14/06, Eelco Hillenius [EMAIL PROTECTED] wrote: IModel#getObject is called anytime a component accesses it. Basically,you should never depend on that method getting called a fixed numberof times; it is not designed for that. Typically if you need to doheavy operations such as loading data from a database, you should use detachable models. A good model for such things isLoadableDetachableModel. the #load method is only called once arequest, and the loaded object is then reused throughout the request.At the end of the request, the model is detached and the temporary object is cleaned up.EelcoOn 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: Hah got your Attention there, though sadly enough its only abstractmodels. Im not sure when getObject are supposed to be called(what triggers a call). The following I can see are that my model are called on page construct(which makes sense to me). But on form submit the model are called two times, is that behaviour normal, also in what order are models called? My model are dependant on some of the other model on the page so I would always need for them to be updated first. Regards Nino - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user- Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:)
Hi Eelco It seems as the LoadableDetachableModel do not support setobject? What should I use instead? -regards Nino -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eelco Hillenius Sent: 14. juli 2006 09:26 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) IModel#getObject is called anytime a component accesses it. Basically, you should never depend on that method getting called a fixed number of times; it is not designed for that. Typically if you need to do heavy operations such as loading data from a database, you should use detachable models. A good model for such things is LoadableDetachableModel. the #load method is only called once a request, and the loaded object is then reused throughout the request. At the end of the request, the model is detached and the temporary object is cleaned up. Eelco On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: Hah got your Attention there, though sadly enough its only abstractmodels. Im not sure when getObject are supposed to be called(what triggers a call). The following I can see are that my model are called on page construct(which makes sense to me). But on form submit the model are called two times, is that behaviour normal, also in what order are models called? My model are dependant on some of the other model on the page so I would always need for them to be updated first. Regards Nino - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:)
You'd normally set all the internal objects up during the initial load() processing, which is called once at the start of each request. If that's not suitable, you might want to expand on what you're trying to do during what phase of a request? /Gwyn On 14/07/06, Nino Wael [EMAIL PROTECTED] wrote: Hi Eelco It seems as the LoadableDetachableModel do not support setobject? What should I use instead? -regards Nino -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eelco Hillenius Sent: 14. juli 2006 09:26 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) IModel#getObject is called anytime a component accesses it. Basically, you should never depend on that method getting called a fixed number of times; it is not designed for that. Typically if you need to do heavy operations such as loading data from a database, you should use detachable models. A good model for such things is LoadableDetachableModel. the #load method is only called once a request, and the loaded object is then reused throughout the request. At the end of the request, the model is detached and the temporary object is cleaned up. Eelco On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: Hah got your Attention there, though sadly enough its only abstractmodels. Im not sure when getObject are supposed to be called(what triggers a call). The following I can see are that my model are called on page construct(which makes sense to me). But on form submit the model are called two times, is that behaviour normal, also in what order are models called? My model are dependant on some of the other model on the page so I would always need for them to be updated first. Regards Nino - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:)
That is indeed is suitable, but in the example im doing, I use the model in a wicket.markup.html.form.TextArea, which need a model where it can store an object in as well. So I guess I need a loadableDetachableModel which implements Abstractmodel instead of abstractreadonlymodel? Regards Nino -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gwyn Evans Sent: 14. juli 2006 12:39 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) You'd normally set all the internal objects up during the initial load() processing, which is called once at the start of each request. If that's not suitable, you might want to expand on what you're trying to do during what phase of a request? /Gwyn On 14/07/06, Nino Wael [EMAIL PROTECTED] wrote: Hi Eelco It seems as the LoadableDetachableModel do not support setobject? What should I use instead? -regards Nino -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eelco Hillenius Sent: 14. juli 2006 09:26 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) IModel#getObject is called anytime a component accesses it. Basically, you should never depend on that method getting called a fixed number of times; it is not designed for that. Typically if you need to do heavy operations such as loading data from a database, you should use detachable models. A good model for such things is LoadableDetachableModel. the #load method is only called once a request, and the loaded object is then reused throughout the request. At the end of the request, the model is detached and the temporary object is cleaned up. Eelco On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: Hah got your Attention there, though sadly enough its only abstractmodels. Im not sure when getObject are supposed to be called(what triggers a call). The following I can see are that my model are called on page construct(which makes sense to me). But on form submit the model are called two times, is that behaviour normal, also in what order are models called? My model are dependant on some of the other model on the page so I would always need for them to be updated first. Regards Nino - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:)
But what do you set then?another id?You can't set the object really. Because the object is loaded in the load method by i guess an id.So the id is the real object not the thing that you would get through setObject().. johanOn 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: That is indeed is suitable, but in the example im doing, I use the model in a wicket.markup.html.form.TextArea, which need a model where it can store an object in as well.So I guess I need a loadableDetachableModel which implements Abstractmodel instead of abstractreadonlymodel? Regards Nino-Original Message-From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Gwyn EvansSent: 14. juli 2006 12:39To: wicket-user@lists.sourceforge.netSubject: Re: [Wicket-user] Playing with models:) You'd normally set all the internal objects up during the initialload() processing, which is called once at the start of each request.If that's not suitable, you might want to expand on what you're trying to do during what phase of a request?/GwynOn 14/07/06, Nino Wael [EMAIL PROTECTED] wrote: Hi Eelco It seems as the LoadableDetachableModel do not support setobject? What should I use instead? -regards Nino -Original Message- From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Eelco Hillenius Sent: 14. juli 2006 09:26 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) IModel#getObject is called anytime a component accesses it. Basically, you should never depend on that method getting called a fixed number of times; it is not designed for that. Typically if you need to do heavy operations such as loading data from a database, you should use detachable models. A good model for such things is LoadableDetachableModel. the #load method is only called once a request, and the loaded object is then reused throughout the request. At the end of the request, the model is detached and the temporary object is cleaned up. Eelco On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: Hah got your Attention there, though sadly enough its only abstractmodels. Im not sure when getObject are supposed to be called(what triggers a call). The following I can see are that my model are called on page construct(which makes sense to me). But on form submit the model are called two times, is that behaviour normal, also in what order are models called? My model are dependant on some of the other model on the page so I would always need for them to be updated first. Regards Nino -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Playing with models:)
So heres what I do, code is possibly flawed. I've tried with the abstractmodel instead which works but gets multiple hits pr request which makes it hard to detect if I should repopulate, actually it seems as it hits on modelchanging and onmodelchanged... Basicly what Im trying to do is to have a dependency on a dropdown and a listbox, so if the dropdown is changed and one thing is selected in the listbox my LoadableDetachableModel should be populated with new values. If listbox.size!=1 then no values should be loaded. In the begining I based my example on Igors Ajax radiochoice example. LoadableDetachableModel detachdebugmodel = new LoadableDetachableModel() { public ItemContainer previous = new ItemContainer(); private boolean previousUpdate = false; private String value = ; protected Object load() { value = No Populate compare; if (reportModel.getOmraade().getDataItem() != null previous.getDataItem() != null) { if (!reportModel.getOmraade().getDataItem().equals( previous.getDataItem())) { previousUpdate = true; value = Repopulate AreaType changed!; return value; } } if (reportModel.getOmraade_selected().getDualModel().getFill() .size() == 1) { if (previous.getDataItem().equals( reportModel.getOmraade().getDataItem()) == false || !previousUpdate) { value = Enable Populate compareTypes and enable compareTypes; previousUpdate = true; return value; } value = not changed no need to update; return value; } else { previous .setDataItem(reportModel.getOmraade().getDataItem()); value = EMPTY disable CompareTypes; previousUpdate = false; return value; } } }; TextArea myText = new TextArea(debugmodel, detachdebugmodel); -Original Message- From: [EMAIL PROTECTED] on behalf of Johan Compagner Sent: Fri 14-07-2006 13:37 To: wicket-user@lists.sourceforge.net Cc: Subject:Re: [Wicket-user] Playing with models:) But what do you set then? another id? You can't set the object really. Because the object is loaded in the load method by i guess an id. So the id is the real object not the thing that you would get through setObject().. johan On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: That is indeed is suitable, but in the example im doing, I use the model in a wicket.markup.html.form.TextArea, which need a model where it can store an object in as well. So I guess I need a loadableDetachableModel which implements Abstractmodel instead of abstractreadonlymodel? Regards Nino -Original Message- From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Gwyn Evans Sent: 14. juli 2006 12:39 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) You'd normally set all the internal objects up during the initial load() processing, which is called once at the start of each request. If that's not suitable, you might want to expand on what you're trying to do during what phase of a request? /Gwyn On 14/07/06, Nino Wael [EMAIL PROTECTED] wrote: Hi Eelco It seems as the LoadableDetachableModel do not support setobject? What should I use instead? -regards Nino -Original Message- From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Eelco Hillenius Sent: 14. juli 2006 09:26 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) IModel#getObject is called anytime a component accesses it. Basically, you should never depend on that method getting called a fixed number of times; it is not designed for that. Typically if you need to do heavy operations such as loading data from a database
Re: [Wicket-user] Playing with models:)
Ok scratch what I send previously. Ill try to explain more clearly what Im trying to do. This picture describes show what I have, Ill now try to describe the flow http://www.badongo.com/pic/237253 This is what I got currently: The component which contains B are based on the Palette component from wicket extensions. A populates the component below as C does D So this is the functionality I need: When A or B is changed C needs to be repopulated and D needs to be emptied If B.size are different from 1 then C and D needs to be disabled If E is clicked then C and D needs to be disabled (this is partly working with an ajax call, however the backing model does not seem to be updated). If C is changed then D needs to be repopulated (this is working already with an ajax call). My original idea was to make the components A/B aware of C/D and make A/B make an direct repopulation on C/D. However looking at all the facilities with models I thought that I could make the C/D model aware of A/B instead. Would the correct thing to do make A/B model notify C/D model that a change had happend? Or would it be that the A/B component needs to be aware of the C/D component and make A/B call a populate on C/D? The last idea I got now and what I think should work is that the A/B model needs to be aware of the C/D component and repopulate/disable/enable when appropriate. Hopes this makes a bit sense? Regards Nino From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Johan Compagner Sent: 14. juli 2006 14:18 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) ok you just want to prefill it everytime the page/textarea is rendered? What happens then to the previous value the user just typed in?? If for example you used a normal detachable model (so not readonly) And the first time you load some default stuff. Then a user alters the textarea and submits. Then the page is rendered again. Then in your case the input he made is gone? Because you again do a load depending on the list. I would do this different. Just give the textarea a normal model that can be updated. Then do a onSelectionChange on the list and when the list changes you push the value that you want to set in the textarea. Of course this can also be done in an own textarea detachable model. But then you need to know the previous selected value of the list. johan On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: So heres what I do, code is possibly flawed. I've tried with the abstractmodel instead which works but gets multiple hits pr request which makes it hard to detect if I should repopulate, actually it seems as it hits on modelchanging and onmodelchanged... Basicly what Im trying to do is to have a dependency on a dropdown and a listbox, so if the dropdown is changed and one thing is selected in the listbox my LoadableDetachableModel should be populated with new values. If listbox.size!=1 then no values should be loaded. In the begining I based my example on Igors Ajax radiochoice example. LoadableDetachableModel detachdebugmodel = new LoadableDetachableModel() { public ItemContainer previous = new ItemContainer(); private boolean previousUpdate = false; private String value = ; protected Object load() { value = No Populate compare; if (reportModel.getOmraade().getDataItem() != null previous.getDataItem() != null) { if (!reportModel.getOmraade().getDataItem().equals( previous.getDataItem())) { previousUpdate = true; value = Repopulate AreaType changed!; return value; } } if (reportModel.getOmraade_selected().getDualModel().getFill() .size() == 1) { if (previous.getDataItem ().equals( reportModel.getOmraade().getDataItem()) == false || !previousUpdate) { value = Enable Populate compareTypes and enable compareTypes; previousUpdate = true; return value; } value = not changed no need to update; return value; } else { previous .setDataItem( reportModel.getOmraade().getDataItem()); value = EMPTY disable CompareTypes; previousUpdate = false; return value; } } }; TextArea myText = new TextArea(debugmodel, detachdebugmodel); -Original Message- From: [EMAIL PROTECTED] on behalf of Johan Compagner Sent: Fri 14-07-2006 13:37 To: wicket-user@lists.sourceforge.net Cc: Subject:Re: [Wicket-user] Playing with models:) But what do you set then? another id? You can't set the object really. Because the object is loaded in the load method by i guess an id. So the id is the real object not the thing that you would get through setObject().. johan On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: That is indeed is suitable, but in the example im doing, I use the model in a wicket.markup.html.form.TextArea, which need a model where it can store an object in as well. So I guess I need a loadableDetachableModel which implements Abstractmodel instead of abstractreadonlymodel? Regards Nino -Original Message- From
Re: [Wicket-user] Playing with models:)
Disableding/Enableing can be done with pull (attributemodifiers on C/D that are looking at A/B)Setting the defaults could be done by push so A/B pushing values ot C/DThat last part could also be one by the backing bean ofcourse. So if you you have a bean where A sets its value on. Then when that value is set you also set the value of Cand c then pulls that data.johanOn 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: Ok scratch what I send previously. I'll try to explain more clearly what Im trying to do. This picture describes show what I have, I'll now try to describe the flow http://www.badongo.com/pic/237253 This is what I got currently: The component which contains B are based on the Palette component from wicket extensions. A populates the component below as C does D So this is the functionality I need: When A or B is changed C needs to be repopulated and D needs to be emptied If B.size are different from 1 then C and D needs to be disabled If E is clicked then C and D needs to be disabled (this is partly working with an ajax call, however the backing model does not seem to be updated). If C is changed then D needs to be repopulated (this is working already with an ajax call). My original idea was to make the components A/B aware of C/D and make A/B make an direct repopulation on C/D. However looking at all the facilities with models I thought that I could make the C/D model aware of A/B instead. Would the correct thing to do make A/B model notify C/D model that a change had happend? Or would it be that the A/B component needs to be aware of the C/D component and make A/B call a populate on C/D? The last idea I got now and what I think should work is that the A/B model needs to be aware of the C/D component and repopulate/disable/enable when appropriate. Hopes this makes a bit sense? Regards Nino From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Johan Compagner Sent: 14. juli 2006 14:18 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Playing with models:) ok you just want to prefill it everytime the page/textarea is rendered? What happens then to the previous value the user just typed in?? If for example you used a normal detachable model (so not readonly) And the first time you load some default stuff. Then a user alters the textarea and submits. Then the page is rendered again. Then in your case the input he made is gone? Because you again do a load depending on the list. I would do this different. Just give the textarea a normal model that can be updated. Then do a onSelectionChange on the list and when the list changes you push the value that you want to set in the textarea. Of course this can also be done in an own textarea detachable model. But then you need to know the previous selected value of the list. johan On 7/14/06, Nino Wael [EMAIL PROTECTED] wrote: So heres what I do, code is possibly flawed. I've tried with the abstractmodel instead which works but gets multiple hits pr request which makes it hard to detect if I should repopulate, actually it seems as it hits on modelchanging and onmodelchanged... Basicly what Im trying to do is to have a dependency on a dropdown and a listbox, so if the dropdown is changed and one thing is selected in the listbox my LoadableDetachableModel should be populated with new values. If listbox.size!=1 then no values should be loaded. In the begining I based my example on Igors Ajax radiochoice example. LoadableDetachableModel detachdebugmodel = new LoadableDetachableModel() { public ItemContainer previous = new ItemContainer(); private boolean previousUpdate = false; private String value = ; protected Object load() { value = No Populate compare; if (reportModel.getOmraade().getDataItem() != null previous.getDataItem() != null) { if (!reportModel.getOmraade().getDataItem().equals( previous.getDataItem())) { previousUpdate = true; value = Repopulate AreaType changed!; return value; } } if (reportModel.getOmraade_selected().getDualModel().getFill() .size() == 1) { if (previous.getDataItem ().equals( reportModel.getOmraade().getDataItem()) == false || !previousUpdate) { value = Enable Populate compareTypes and enable compareTypes; previousUpdate = true; return value; } value = not changed no need to update; return value; } else { previous .setDataItem( reportModel.getOmraade().getDataItem()); value = EMPTY disable CompareTypes; previousUpdate = false; return value; } } }; TextArea myText = new TextArea(debugmodel, detachdebugmodel); -Original Message- From: [EMAIL PROTECTED] on behalf of Johan Compagner Sent: Fri 14-07-2006 13:37 To: wicket-user@lists.sourceforge.net Cc: Subject:Re: [Wicket-user] Playing with models:) But what do you set then? another id? You can't set the object really. Because the object is loaded in the load method by i guess an id. So the id is the real object not the thing