Re: DropDownChoice does not push value into Model
); this.setModelObject(newOne);//Set it with the new model object with the study that was selected //The studyReference instance always refers to the original study that was used to populate the drop down never changes String studyRefDetails = studyReference.getStudyName() + + studyReference.getStudyStatus().getName(); System.out.println(\n: 2:+ studyRefDetails); } }; lookupForm.initForm(); add(lookupForm); } } public class StudyContainer implements Serializable{ private Study study; private ListStudy studyList; /** * Constructor */ public StudyContainer(){ study = new Study(); studyList = new ArrayListStudy(); } //Accessor for study public Study getStudy() { return study; } public void setStudy(Study study) { this.study = study; } //Accessor for study List public ListStudy getStudyList() { return studyList; } public void setStudyList(ListStudy studyList) { this.studyList = studyList; } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2328046.html Sent from the Wicket - User mailing list archive at Nabble.com.
Re: DropDownChoice does not push value into Model
that was used to populate the drop down never changes String studyRefDetails = studyReference.getStudyName() + + studyReference.getStudyStatus().getName(); System.out.println(\n: 2:+ studyRefDetails); } }; lookupForm.initForm(); add(lookupForm); } } public class StudyContainer implements Serializable{ private Study study; private ListStudy studyList; /** * Constructor */ public StudyContainer(){ study = new Study(); studyList = new ArrayListStudy(); } //Accessor for study public Study getStudy() { return study; } public void setStudy(Study study) { this.study = study; } //Accessor for study List public ListStudy getStudyList() { return studyList; } public void setStudyList(ListStudy studyList) { this.studyList = studyList; } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2328046.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DropDownChoice does not push value into Model
(); System.out.println(status.getName()); //Simulate a user's select operation and reset the study StudyContainer newOne = new StudyContainer(); Study selectedStudy = new Study(); selectedStudy.setChiefName(Testing); selectedStudy.setStudyName(Testing); newOne.setStudy(selectedStudy); this.setModelObject(newOne);//Set it with the new model object with the study that was selected //The studyReference instance always refers to the original study that was used to populate the drop down never changes String studyRefDetails = studyReference.getStudyName() + + studyReference.getStudyStatus().getName(); System.out.println(\n: 2:+ studyRefDetails); } }; lookupForm.initForm(); add(lookupForm); } } public class StudyContainer implements Serializable{ private Study study; private ListStudy studyList; /** * Constructor */ public StudyContainer(){ study = new Study(); studyList = new ArrayListStudy(); } //Accessor for study public Study getStudy() { return study; } public void setStudy(Study study) { this.study = study; } //Accessor for study List public ListStudy getStudyList() { return studyList; } public void setStudyList(ListStudy studyList) { this.studyList = studyList; } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2328046.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DropDownChoice does not push value into Model
James Could you please clarify this for me, I noticed is that with PropertyModel usage in the above context. I have to define one(PropertyModel instance) for each of the form component explicitly, like so 1. ModelStudyModel studyModel = new ModelStudyModel(new StudyModel());/Top level Model In the Form: I associate the studyModel above in the constructor and ModelStudyModel pModel = (Model)getModel(); 2. firstName = new TextField(studyName,new PropertyModelStudy(pModel.getObject().getStudyName(),studyName)); // I am manually telling it to navigate to a property ..thought it will be nice if its automatic based on the expression I am unable to create a single instance like PropertyModelStudy propertyModel = new PropertyModelStudy(studyModel, study); And then use propertyModel instance for each component. Am I missing something here? Thanks again Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2326600.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DropDownChoice does not push value into Model
On Mon, Aug 16, 2010 at 5:42 AM, nivs shravann...@gmail.com wrote: 2. firstName = new TextField(studyName,new PropertyModelStudy(pModel.getObject().getStudyName(),studyName)); It should be: new PropertyModelString(pModel, studyName). The first argument to PropertyModel's constructor is the root for the property expression. If it's a model, Wicket knows to get the model's object and apply the property expression to that. What you're doing is telling Wicket to set up a property model where a String is the root and the propertyExpression is studyName. There is no studyName property on the String class, so that won't work. Also, your expression and your model type (Study) don't match here. You're telling it to traverse to the study name (which is a String I assume) and you're saying the model is of type Study. The property navigation you're trying to do won't work either. All that does is traverse the property before the method is called and passes its value in to the method as a parameter. It's not recording anything. I would just go with the simplest solution for now to get you going. Don't try to get too fancy too fast. Walk before you run. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DropDownChoice does not push value into Model
Why are you using CPMs and PropertyModels together? I would go one way or the other. In your case, since you're just starting out it seems, I'd just use a regular model for the main object and use explicit property models to bind its properties to your components. The CPM is just too magicy and it can get confusing for beginners. So what you want is: ModelStudyModel studyModel = new ModelStudyModel(new StudyModel()); PropertyModelStudy propertyModel = new PropertyModelStudy(studyModel, study); See how I use the studyModel as the root of my PropertyModel rather than the StudyModel object contained in the studyModel itself? That's perfectly okay. What you're telling the PropertyModel is go to this model and ask for its object and then ask for its 'study' property. So, when you change the object that the studyModel points to, the propertyModel can still get to it. Does that make sense? With this approach, you can feel free to do setModelObject(new StudyModel()) and it will work. On Fri, Aug 13, 2010 at 9:14 AM, nivs shravann...@gmail.com wrote: James Thanks for pointing it out. Later in the code I have added, so the study object/instance in the initial model should be in synch right? Correct me if I am wrong. Let me also think about this point u made. But yeah do let me know if i have made a mistake. cpm = (CompoundPropertyModelStudyModel)this.getModel();reset the original one Cheers On Fri, Aug 13, 2010 at 7:49 PM, James Carman [via Apache Wicket] ml-node+2324076-505065694-32...@n4.nabble.comml-node%2b2324076-505065694-32...@n4.nabble.com wrote: Your DDC is bound to the original StudyModel's study with the lines: PropertyModel propertyModel = new PropertyModel(studyModel.getStudy(),Constants.STUDY_STATUS); studyStatusDpChoices = new DropDownChoice(Constants.STUDY_DROP_DOWN_CHOICE,propertyModel,studyStatusList,defaultChoiceRenderer); Then, you're replacing the StudyModel with this line: this.setModelObject(new StudyModel()); Thus, they get out of synch. On Fri, Aug 13, 2010 at 3:30 AM, nivs [hidden email]http://user/SendEmail.jtp?type=nodenode=2324076i=0 wrote: Hi All, http://apache-wicket.1842946.n4.nabble.com/file/n2323809/Code.txthttp://apache-wicket.1842946.n4.nabble.com/file/n2323809/Code.txt?by-user=t Code.txt I have a drop down choice control on the search panel and its selected choices are pushed to the model only once or the first time. Please have a look at the attached code: As part of this code, I noticed that when I uncomment the following line, the drop down choice works every time.(as it is supposed to) public void initialise(String id){ //cpm.getObject().setStudy(searchCriteria);///Set the search criteria object back in order for status to be filled in the next submit/search } However, this will not resolve my issue, because if I refreshed the study in the model when the details page is loaded, the problem re-occurs. Not sure why this is hapenning, I tried to debug as much as I can, all i can get to is, when i re-set the model's study instance after the search results have arrived , then it works. If I do not, then it fails to capture the value from DDC. Thank you again Cheers Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2323809.htmlhttp://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2323809.html?by-user=t Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=2324076i=1 For additional commands, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=2324076i=2 - To unsubscribe, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=2324076i=3 For additional commands, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=2324076i=4 -- View message @ http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2324076.html To unsubscribe from DropDownChoice does not push value into Model, click herehttp://apache-wicket.1842946.n4.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_codenode=2323809code=c2hyYXZhbm5pdmVAZ21haWwuY29tfDIzMjM4MDl8LTkwOTU2NzkzNA==. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2324176.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
DropDownChoice does not push value into Model
Hi All, http://apache-wicket.1842946.n4.nabble.com/file/n2323809/Code.txt Code.txt I have a drop down choice control on the search panel and its selected choices are pushed to the model only once or the first time. Please have a look at the attached code: As part of this code, I noticed that when I uncomment the following line, the drop down choice works every time.(as it is supposed to) public void initialise(String id){ //cpm.getObject().setStudy(searchCriteria);///Set the search criteria object back in order for status to be filled in the next submit/search } However, this will not resolve my issue, because if I refreshed the study in the model when the details page is loaded, the problem re-occurs. Not sure why this is hapenning, I tried to debug as much as I can, all i can get to is, when i re-set the model's study instance after the search results have arrived , then it works. If I do not, then it fails to capture the value from DDC. Thank you again Cheers Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2323809.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DropDownChoice does not push value into Model
Your DDC is bound to the original StudyModel's study with the lines: PropertyModel propertyModel = new PropertyModel(studyModel.getStudy(),Constants.STUDY_STATUS); studyStatusDpChoices = new DropDownChoice(Constants.STUDY_DROP_DOWN_CHOICE,propertyModel,studyStatusList,defaultChoiceRenderer); Then, you're replacing the StudyModel with this line: this.setModelObject(new StudyModel()); Thus, they get out of synch. On Fri, Aug 13, 2010 at 3:30 AM, nivs shravann...@gmail.com wrote: Hi All, http://apache-wicket.1842946.n4.nabble.com/file/n2323809/Code.txt Code.txt I have a drop down choice control on the search panel and its selected choices are pushed to the model only once or the first time. Please have a look at the attached code: As part of this code, I noticed that when I uncomment the following line, the drop down choice works every time.(as it is supposed to) public void initialise(String id){ //cpm.getObject().setStudy(searchCriteria);///Set the search criteria object back in order for status to be filled in the next submit/search } However, this will not resolve my issue, because if I refreshed the study in the model when the details page is loaded, the problem re-occurs. Not sure why this is hapenning, I tried to debug as much as I can, all i can get to is, when i re-set the model's study instance after the search results have arrived , then it works. If I do not, then it fails to capture the value from DDC. Thank you again Cheers Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2323809.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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: DropDownChoice does not push value into Model
James Thanks for pointing it out. Later in the code I have added, so the study object/instance in the initial model should be in synch right? Correct me if I am wrong. Let me also think about this point u made. But yeah do let me know if i have made a mistake. cpm = (CompoundPropertyModelStudyModel)this.getModel();reset the original one Cheers On Fri, Aug 13, 2010 at 7:49 PM, James Carman [via Apache Wicket] ml-node+2324076-505065694-32...@n4.nabble.comml-node%2b2324076-505065694-32...@n4.nabble.com wrote: Your DDC is bound to the original StudyModel's study with the lines: PropertyModel propertyModel = new PropertyModel(studyModel.getStudy(),Constants.STUDY_STATUS); studyStatusDpChoices = new DropDownChoice(Constants.STUDY_DROP_DOWN_CHOICE,propertyModel,studyStatusList,defaultChoiceRenderer); Then, you're replacing the StudyModel with this line: this.setModelObject(new StudyModel()); Thus, they get out of synch. On Fri, Aug 13, 2010 at 3:30 AM, nivs [hidden email]http://user/SendEmail.jtp?type=nodenode=2324076i=0 wrote: Hi All, http://apache-wicket.1842946.n4.nabble.com/file/n2323809/Code.txthttp://apache-wicket.1842946.n4.nabble.com/file/n2323809/Code.txt?by-user=t Code.txt I have a drop down choice control on the search panel and its selected choices are pushed to the model only once or the first time. Please have a look at the attached code: As part of this code, I noticed that when I uncomment the following line, the drop down choice works every time.(as it is supposed to) public void initialise(String id){ //cpm.getObject().setStudy(searchCriteria);///Set the search criteria object back in order for status to be filled in the next submit/search } However, this will not resolve my issue, because if I refreshed the study in the model when the details page is loaded, the problem re-occurs. Not sure why this is hapenning, I tried to debug as much as I can, all i can get to is, when i re-set the model's study instance after the search results have arrived , then it works. If I do not, then it fails to capture the value from DDC. Thank you again Cheers Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2323809.htmlhttp://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2323809.html?by-user=t Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=2324076i=1 For additional commands, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=2324076i=2 - To unsubscribe, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=2324076i=3 For additional commands, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=2324076i=4 -- View message @ http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2324076.html To unsubscribe from DropDownChoice does not push value into Model, click herehttp://apache-wicket.1842946.n4.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_codenode=2323809code=c2hyYXZhbm5pdmVAZ21haWwuY29tfDIzMjM4MDl8LTkwOTU2NzkzNA==. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2324176.html Sent from the Wicket - User mailing list archive at Nabble.com.