Re: ListMultipleChoice Update Model from Choices
Hi Yep, I got it now. Thanks. I now create a new instance of the Model itself. This satisfies the comparison. if (!getModelComparator().compare(this, object)){ ... } Earlier I was only resetting the contained object within the Model. Thank You ! Niv On Tue, Jul 27, 2010 at 3:27 PM, Martin Makundi < martin.maku...@koodaripalvelut.com> wrote: > Hi! > > > 'Note: componentInstance.setModelObject will call modelChanged from > within > > if the model is actually changed' > > > > If the model is actually changed. That is what I am not sure, when does > it > > get notified that a change has happened.?Setting of an entirely new > instance > > in the model should do that isn't it. Please see code below. > > Not necessarily. Look at setmodelobject implementation: > > public final Component setDefaultModelObject(final Object object) >... >if (!getModelComparator().compare(this, object)) >{ >modelChanging(); >model.setObject(object); >modelChanged(); >} > > ** > Martin > > > On Tue, Jul 27, 2010 at 3:05 PM, Martin Makundi < > > martin.maku...@koodaripalvelut.com> wrote: > > > >> Hi! > >> > >> > componentInstance.modelChanged(); > >> > componentInstance.setModelObject(selectedChoice); > >> > >> Note: componentInstance.setModelObject will call modelChanged from > >> within if the model is actually changed > >> > >> > 1. On the Form the user types in some information and then hits Save. > >> > 2. The form comes back with validation error messages. > >> > 3. The user now clicks on Cancel button to discard the form > >> > 4. The user clicks the New button and a form is loaded with the old > data( > >> I > >> > had the data typed in the previous form repeated even though I cleared > >> the > >> > input form.clearInput.) > >> > 5. I add the form.modelChanged() and now it clears completely or takes > >> into > >> > account that its a fresh form. > >> > >> I could comment more if I saw the code. > >> > >> ** > >> Martin > >> > >> > > >> > > >> > > >> > > >> > On Sat, Jul 24, 2010 at 2:42 AM, Nivedan Nadaraj < > shravann...@gmail.com > >> >wrote: > >> > > >> >> Cheers mate thanks for that. Only I thought it was one step closer to > >> >> building my own component and know the details of it. But yeah point > >> taken. > >> >> > >> >> Cheers > >> >> Nive > >> >> > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >> For additional commands, e-mail: users-h...@wicket.apache.org > >> > >> > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: ListMultipleChoice Update Model from Choices
Hi! > 'Note: componentInstance.setModelObject will call modelChanged from within > if the model is actually changed' > > If the model is actually changed. That is what I am not sure, when does it > get notified that a change has happened.?Setting of an entirely new instance > in the model should do that isn't it. Please see code below. Not necessarily. Look at setmodelobject implementation: public final Component setDefaultModelObject(final Object object) ... if (!getModelComparator().compare(this, object)) { modelChanging(); model.setObject(object); modelChanged(); } ** Martin > On Tue, Jul 27, 2010 at 3:05 PM, Martin Makundi < > martin.maku...@koodaripalvelut.com> wrote: > >> Hi! >> >> > componentInstance.modelChanged(); >> > componentInstance.setModelObject(selectedChoice); >> >> Note: componentInstance.setModelObject will call modelChanged from >> within if the model is actually changed >> >> > 1. On the Form the user types in some information and then hits Save. >> > 2. The form comes back with validation error messages. >> > 3. The user now clicks on Cancel button to discard the form >> > 4. The user clicks the New button and a form is loaded with the old data( >> I >> > had the data typed in the previous form repeated even though I cleared >> the >> > input form.clearInput.) >> > 5. I add the form.modelChanged() and now it clears completely or takes >> into >> > account that its a fresh form. >> >> I could comment more if I saw the code. >> >> ** >> Martin >> >> > >> > >> > >> > >> > On Sat, Jul 24, 2010 at 2:42 AM, Nivedan Nadaraj > >wrote: >> > >> >> Cheers mate thanks for that. Only I thought it was one step closer to >> >> building my own component and know the details of it. But yeah point >> taken. >> >> >> >> Cheers >> >> Nive >> >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListMultipleChoice Update Model from Choices
Hi Yeah I did have only the setModelObject() but it did not clear it that is why I added this. Maybe I have not used it correctly.Since you mentioned 'Note: componentInstance.setModelObject will call modelChanged from within if the model is actually changed' If the model is actually changed. That is what I am not sure, when does it get notified that a change has happened.?Setting of an entirely new instance in the model should do that isn't it. Please see code below. FYI: StudyModel is the bean that contains other objects. It is bound to a form using CPM. onNew(){ StudyModel studyModel; if(form != null && form.getModelObject() != null){ studyModel = form.getModelObject(); studyModel.setStudy(new Study());//a hibernate entity form.setModelObject(studyModel); form.modelChanged();//--> added this one to clear the data. form.clearInput(); } Thanks again Niv On Tue, Jul 27, 2010 at 3:05 PM, Martin Makundi < martin.maku...@koodaripalvelut.com> wrote: > Hi! > > > componentInstance.modelChanged(); > > componentInstance.setModelObject(selectedChoice); > > Note: componentInstance.setModelObject will call modelChanged from > within if the model is actually changed > > > 1. On the Form the user types in some information and then hits Save. > > 2. The form comes back with validation error messages. > > 3. The user now clicks on Cancel button to discard the form > > 4. The user clicks the New button and a form is loaded with the old data( > I > > had the data typed in the previous form repeated even though I cleared > the > > input form.clearInput.) > > 5. I add the form.modelChanged() and now it clears completely or takes > into > > account that its a fresh form. > > I could comment more if I saw the code. > > ** > Martin > > > > > > > > > > > On Sat, Jul 24, 2010 at 2:42 AM, Nivedan Nadaraj >wrote: > > > >> Cheers mate thanks for that. Only I thought it was one step closer to > >> building my own component and know the details of it. But yeah point > taken. > >> > >> Cheers > >> Nive > >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: ListMultipleChoice Update Model from Choices
Hi! > componentInstance.modelChanged(); > componentInstance.setModelObject(selectedChoice); Note: componentInstance.setModelObject will call modelChanged from within if the model is actually changed > 1. On the Form the user types in some information and then hits Save. > 2. The form comes back with validation error messages. > 3. The user now clicks on Cancel button to discard the form > 4. The user clicks the New button and a form is loaded with the old data( I > had the data typed in the previous form repeated even though I cleared the > input form.clearInput.) > 5. I add the form.modelChanged() and now it clears completely or takes into > account that its a fresh form. I could comment more if I saw the code. ** Martin > > > > > On Sat, Jul 24, 2010 at 2:42 AM, Nivedan Nadaraj wrote: > >> Cheers mate thanks for that. Only I thought it was one step closer to >> building my own component and know the details of it. But yeah point taken. >> >> Cheers >> Nive >> - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListMultipleChoice Update Model from Choices
Just wanted to update, I have checked out the Palette too and looks cool. However wanted to share this bit. Adding the following componentInstance.modelChanged(); componentInstance.setModelObject(selectedChoice); ie, I get the choices selected and add it to the Model. By invoking modelChanged() I noticed that the changes are pushed into the Model. Which is what I was looking for The other usage of the modelChanged() I noticed was when 1. On the Form the user types in some information and then hits Save. 2. The form comes back with validation error messages. 3. The user now clicks on Cancel button to discard the form 4. The user clicks the New button and a form is loaded with the old data( I had the data typed in the previous form repeated even though I cleared the input form.clearInput.) 5. I add the form.modelChanged() and now it clears completely or takes into account that its a fresh form. Is this a valid approach? Any thoughts on it for similar scenario? Thanks Niv On Sat, Jul 24, 2010 at 2:42 AM, Nivedan Nadaraj wrote: > Cheers mate thanks for that. Only I thought it was one step closer to > building my own component and know the details of it. But yeah point taken. > > Cheers > Nive > > > On Fri, Jul 23, 2010 at 5:43 PM, Martin Makundi < > martin.maku...@koodaripalvelut.com> wrote: > >> Hi! >> >> Yeah, if you look at the Palette you can se it is not trivial so it >> will save you a lot of time ;) >> >> ** >> Martin >> >> 2010/7/23 Nivedan Nadaraj : >> > Hey Mate!!, >> > >> > That is classic. Will check it out, great. Again if you do know how I >> can >> > address the issue I had will be good to know even if I dont use it since >> the >> > Pallete offers it. >> > Thanks !! >> > Niv >> > >> > On Fri, Jul 23, 2010 at 5:31 PM, Martin Makundi < >> > martin.maku...@koodaripalvelut.com> wrote: >> > >> >> Hi! >> >> >> >> Did you notice wicket has a built-in component called palette that can >> >> do this for you? >> >> >> >> >> >> >> http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.PalettePage >> >> >> >> ** >> >> Martin >> >> >> >> 2010/7/23 Nivedan Nadaraj : >> >> > Hi All, >> >> > >> >> > I use the ListMultipleChoice(LMC) in a different way. I have one >> control >> >> > (LMC) on the left representing a list of items Available (roles for >> >> example) >> >> > I have another LMC to represent Selected items(roles) >> >> > >> >> > The ADD and ADD ALL buttons move the "selected items' from Available >> LMC >> >> to >> >> > Selected LMC. >> >> > >> >> > Now when I hit Save, the Selected LMC's Choices are not pushed into >> the >> >> > Model and is empty. However, when I literally selected few items in >> the >> >> > Selected LMC choice list and hit save then >> >> > I have the items in the Model.Which is fine, but as a user he has >> done >> >> that >> >> > act already so ...guess am missing something here. >> >> > >> >> > What I would like is for the Select LMC Model to be updated (either I >> do >> >> it >> >> > or automatically) from the choices list. Has anyone used this in the >> way >> >> I >> >> > am using it? How do we get around this? >> >> > >> >> > Thanks in advance. >> >> > Cheers >> >> > >> >> >> >> - >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> >> >> >> > >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> >
Re: ListMultipleChoice Update Model from Choices
Cheers mate thanks for that. Only I thought it was one step closer to building my own component and know the details of it. But yeah point taken. Cheers Nive On Fri, Jul 23, 2010 at 5:43 PM, Martin Makundi < martin.maku...@koodaripalvelut.com> wrote: > Hi! > > Yeah, if you look at the Palette you can se it is not trivial so it > will save you a lot of time ;) > > ** > Martin > > 2010/7/23 Nivedan Nadaraj : > > Hey Mate!!, > > > > That is classic. Will check it out, great. Again if you do know how I can > > address the issue I had will be good to know even if I dont use it since > the > > Pallete offers it. > > Thanks !! > > Niv > > > > On Fri, Jul 23, 2010 at 5:31 PM, Martin Makundi < > > martin.maku...@koodaripalvelut.com> wrote: > > > >> Hi! > >> > >> Did you notice wicket has a built-in component called palette that can > >> do this for you? > >> > >> > >> > http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.PalettePage > >> > >> ** > >> Martin > >> > >> 2010/7/23 Nivedan Nadaraj : > >> > Hi All, > >> > > >> > I use the ListMultipleChoice(LMC) in a different way. I have one > control > >> > (LMC) on the left representing a list of items Available (roles for > >> example) > >> > I have another LMC to represent Selected items(roles) > >> > > >> > The ADD and ADD ALL buttons move the "selected items' from Available > LMC > >> to > >> > Selected LMC. > >> > > >> > Now when I hit Save, the Selected LMC's Choices are not pushed into > the > >> > Model and is empty. However, when I literally selected few items in > the > >> > Selected LMC choice list and hit save then > >> > I have the items in the Model.Which is fine, but as a user he has done > >> that > >> > act already so ...guess am missing something here. > >> > > >> > What I would like is for the Select LMC Model to be updated (either I > do > >> it > >> > or automatically) from the choices list. Has anyone used this in the > way > >> I > >> > am using it? How do we get around this? > >> > > >> > Thanks in advance. > >> > Cheers > >> > > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >> For additional commands, e-mail: users-h...@wicket.apache.org > >> > >> > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: ListMultipleChoice Update Model from Choices
Hi! Yeah, if you look at the Palette you can se it is not trivial so it will save you a lot of time ;) ** Martin 2010/7/23 Nivedan Nadaraj : > Hey Mate!!, > > That is classic. Will check it out, great. Again if you do know how I can > address the issue I had will be good to know even if I dont use it since the > Pallete offers it. > Thanks !! > Niv > > On Fri, Jul 23, 2010 at 5:31 PM, Martin Makundi < > martin.maku...@koodaripalvelut.com> wrote: > >> Hi! >> >> Did you notice wicket has a built-in component called palette that can >> do this for you? >> >> >> http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.PalettePage >> >> ** >> Martin >> >> 2010/7/23 Nivedan Nadaraj : >> > Hi All, >> > >> > I use the ListMultipleChoice(LMC) in a different way. I have one control >> > (LMC) on the left representing a list of items Available (roles for >> example) >> > I have another LMC to represent Selected items(roles) >> > >> > The ADD and ADD ALL buttons move the "selected items' from Available LMC >> to >> > Selected LMC. >> > >> > Now when I hit Save, the Selected LMC's Choices are not pushed into the >> > Model and is empty. However, when I literally selected few items in the >> > Selected LMC choice list and hit save then >> > I have the items in the Model.Which is fine, but as a user he has done >> that >> > act already so ...guess am missing something here. >> > >> > What I would like is for the Select LMC Model to be updated (either I do >> it >> > or automatically) from the choices list. Has anyone used this in the way >> I >> > am using it? How do we get around this? >> > >> > Thanks in advance. >> > Cheers >> > >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListMultipleChoice Update Model from Choices
Hey Mate!!, That is classic. Will check it out, great. Again if you do know how I can address the issue I had will be good to know even if I dont use it since the Pallete offers it. Thanks !! Niv On Fri, Jul 23, 2010 at 5:31 PM, Martin Makundi < martin.maku...@koodaripalvelut.com> wrote: > Hi! > > Did you notice wicket has a built-in component called palette that can > do this for you? > > > http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.PalettePage > > ** > Martin > > 2010/7/23 Nivedan Nadaraj : > > Hi All, > > > > I use the ListMultipleChoice(LMC) in a different way. I have one control > > (LMC) on the left representing a list of items Available (roles for > example) > > I have another LMC to represent Selected items(roles) > > > > The ADD and ADD ALL buttons move the "selected items' from Available LMC > to > > Selected LMC. > > > > Now when I hit Save, the Selected LMC's Choices are not pushed into the > > Model and is empty. However, when I literally selected few items in the > > Selected LMC choice list and hit save then > > I have the items in the Model.Which is fine, but as a user he has done > that > > act already so ...guess am missing something here. > > > > What I would like is for the Select LMC Model to be updated (either I do > it > > or automatically) from the choices list. Has anyone used this in the way > I > > am using it? How do we get around this? > > > > Thanks in advance. > > Cheers > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: ListMultipleChoice Update Model from Choices
Hi! Did you notice wicket has a built-in component called palette that can do this for you? http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.PalettePage ** Martin 2010/7/23 Nivedan Nadaraj : > Hi All, > > I use the ListMultipleChoice(LMC) in a different way. I have one control > (LMC) on the left representing a list of items Available (roles for example) > I have another LMC to represent Selected items(roles) > > The ADD and ADD ALL buttons move the "selected items' from Available LMC to > Selected LMC. > > Now when I hit Save, the Selected LMC's Choices are not pushed into the > Model and is empty. However, when I literally selected few items in the > Selected LMC choice list and hit save then > I have the items in the Model.Which is fine, but as a user he has done that > act already so ...guess am missing something here. > > What I would like is for the Select LMC Model to be updated (either I do it > or automatically) from the choices list. Has anyone used this in the way I > am using it? How do we get around this? > > Thanks in advance. > Cheers > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
ListMultipleChoice Update Model from Choices
Hi All, I use the ListMultipleChoice(LMC) in a different way. I have one control (LMC) on the left representing a list of items Available (roles for example) I have another LMC to represent Selected items(roles) The ADD and ADD ALL buttons move the "selected items' from Available LMC to Selected LMC. Now when I hit Save, the Selected LMC's Choices are not pushed into the Model and is empty. However, when I literally selected few items in the Selected LMC choice list and hit save then I have the items in the Model.Which is fine, but as a user he has done that act already so ...guess am missing something here. What I would like is for the Select LMC Model to be updated (either I do it or automatically) from the choices list. Has anyone used this in the way I am using it? How do we get around this? Thanks in advance. Cheers