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
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 = (CompoundPropertyModel)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.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=node&node=2324076&i=0>> > wrote: > > > > > Hi All, > > > > http://apache-wicket.1842946.n4.nabble.com/file/n2323809/Code.txt<http://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.html<http://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=node&node=2324076&i=1> > > For additional commands, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=2324076&i=2> > > > > > > - > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2324076&i=3> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2324076&i=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 > here<http://apache-wicket.1842946.n4.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_code&node=2323809&code=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.
Re Wicket Web Beans
Hi Would like to know if some one has used Wicket Web Beans in their wicket projects? One of our requirements is to add fields at runtime and be able to render it on the front end. So in this case , I have no control of building the panels for some fields that are 'yet' to be created and to infer what UI component(textfield, drop downs, radio box) should be rendered when I try to view those fields on the front end. Also will I be able to add validation rules to these fields at the same time the field is defined? I am using Wicket as the primary framework for the web layer and hibernate for the backend. I am hoping that this toolkit will be helpful in addressing this requirement. If anyone of you have used this toolkit would like to hear about your experiences. I am yet to embark on this path but in the meantime welcome your thoughts. Thanks Reg Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-Wicket-Web-Beans-tp2326481p2326481.html Sent from the Wicket - User mailing list archive at Nabble.com.
Re: DropDownChoice does not push value into Model
James, Thanks for that. I am trying to implement what you have mentioned using Model and PropertyModel. Let me get back to you after I have done this bit. Appreciate your time and advice. Thanks Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-does-not-push-value-into-Model-tp2323809p2326586.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. Model studyModel = new Model(new StudyModel());/Top level Model In the Form: I associate the studyModel above in the constructor and Model pModel = (Model)getModel(); 2. firstName = new TextField("studyName",new PropertyModel(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 PropertyModel propertyModel = new PropertyModel(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
Hi James Point(s) noted. I have got something going here and it is working but is this what you meant? Please see attached code and do bear with my questions. The variable studyReference which is the one that is wrapped within a PropertyModel, remains or maintains the same reference even if the object model is changed. So that is the key I suppose not to change the study reference bound to the DDC any time and we wrap this in a property model. Still have to get to grips with Models. Thanks for the help Cheers Niv /* Form that contains the dropdown other form fields*/ public class LookupForm extends Form{ private TextField studyName; private TextField chiefName; private AjaxButton lookupButton; private DropDownChoice studyStatusDpChoices; public LookupForm(String id,Model model){ super(id,model); } public void initForm(){ Model studyContainerModel = (Model)getModel(); //Create a propertyModel to bind the components of this form, the root which is StudyContainer PropertyModel pm = new PropertyModel(studyContainerModel,"study"); //Just to know what the initial study reference is final Study studyReference = pm.getObject(); studyName = new TextField("studyName",new PropertyModel(pm,"studyName"));//Create another new PropertyModel of type Study chiefName = new TextField("chiefName", new PropertyModel(pm,"chiefName")); lookupButton = new AjaxButton("search"){ @Override protected void onSubmit(AjaxRequestTarget target, Form form) { Model iModel = (Model)getModel(); doLookup(target,studyReference); } }; ChoiceRenderer defaultChoiceRenderer = new ChoiceRenderer("name", "studyStatusKey"); //Another PropertyModel for rendering the DropDowns and pass in the Property Model instance of type Study PropertyModel pmStudyStatus = new PropertyModel(pm,"studyStatus"); //Static list List studyStatusList = new ArrayList(); StudyStatus ss = new StudyStatus(); ss.setName("Active"); ss.setStudyStatusKey(new Long("1")); studyStatusList.add(ss); ss = new StudyStatus(); ss.setName("Inactive"); ss.setStudyStatusKey(new Long("2")); studyStatusList.add(ss); studyStatusDpChoices = new DropDownChoice("studyStatusDDC",pmStudyStatus,studyStatusList,defaultChoiceRenderer); add(studyName); add(chiefName); add(studyStatusDpChoices); add(lookupButton); } protected void doLookup(AjaxRequestTarget target, Study study){} } public class Lookup extends Panel{ Model studyContainerModel; public Lookup(String id) { super(id); } public void initialise(){ studyContainerModel = new Model( new StudyContainer()); LookupForm lookupForm = new LookupForm("lookupForm", studyContainerModel){ protected void doLookup(AjaxRequestTarget target, Study studyReference){ StudyContainer studyContainer = (StudyContainer)this.getModelObject(); //Get the currently populates study info Study currentStudy = studyContainer.getStudy(); System.out.println(currentStudy.getChiefName()); StudyStatus status = currentStudy.getStudyStatus(); 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
Re: Asynchronous File Uploads
Thanks mate, I will investigate more on this, but can you elaborate it a little bit? I can think of the following 1. When the application starts up, the servlet will be loaded up. 2. In its init(), I would have to create a process that is more like a daemon and waits for it to be requested or invoked. 3. From the GUI, actor uploads a file - this has to delegate the request to the servlet.Which then does the job Am i on the right track? Cheers -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Asynchronous-File-Uploads-tp2541855p2543316.html Sent from the Users forum 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: Asynchronous File Uploads
Thanks for the time. Will give that a shot. Many thanks (will keep it simple) Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Asynchronous-File-Uploads-tp2541855p2543362.html Sent from the Users forum 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: How to Update contents of a child component?
Sorry for the delay in response. I had fixed this issue and it was to do with my model. The Multiselect was not properly bound to a model. Infact I started using Palette control which is very good. And as for hiding and unhiding I found that sometimes just using setOutputMarkupId does not work all the time but using the above as you suggested the setOutputMarkupPlaceholderTag(boolean) works. Might post a thread on why and what the difference is between them. Cheers -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-Update-contents-of-a-child-component-tp2307756p2543535.html Sent from the Users forum 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
Application of setOutputMarkupPlaceholderTag and setOutputMarkupId
Hi All I want to get this clear can someone let me know the behavior when we say setOutputMarkupPlaceholderTag and setOutputMarkupId. I found that, when I have a WebMarkupContainer for a component set to true initially and set the markupContainer to setOutputMarkupId(true). Now when I on an event I set the markupContainer's visibility to false. This hides the component. So far its good. Clicking another button I want the hidden panel to be visible and when i set the visibility to true and attach the markupContainer to the ajaxRequest, it does not repaint it and I got an error saying the component was not found. I changed it to setOutputMarkupPlaceholderTag and this time it works. I understand that Wicket does not have any reference to the component if we used setOutputMarkupid but why is this and when do we use the methods? Thanks for time Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Application-of-setOutputMarkupPlaceholderTag-and-setOutputMarkupId-tp2543555p2543555.html Sent from the Users forum 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: SV: Application of setOutputMarkupPlaceholderTag and setOutputMarkupId
Hi Thanks for your thoughts. It is clearer now. Re-iterating from what you mentioned, my understanding is that when 1. "toggling invisibility via Ajax you need to use the placeholder tag" - 2.and we don't toggle visibility and want that component to be re-painted then we need setOutputMarkupId. Thanks guys Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Application-of-setOutputMarkupPlaceholderTag-and-setOutputMarkupId-tp2543555p2543665.html Sent from the Users forum 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: Re Palette
Hi Just wanted to make some corrections to the above snippet. private Palette initialiseRolePalette(ContainerForm containerForm, ModuleVO selectedModuleVO, ModuleVO availableModuleVO){ IChoiceRenderer renderer = new ChoiceRenderer("roleName", "roleName"); PropertyModel> availableRoleChoicesPM = new PropertyModel> (availableModuleVO,"roleName"); PropertyModel> selectedRolesPM = new PropertyModel>(selectedModuleVO,"roleName"); return new Palette("role", selectedRolesPM, availableRoleChoicesPM,renderer, 5, false); } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-Palette-tp2720154p2720183.html Sent from the Users forum 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: Putting together two seperate wicket projects into a multi-module maven project
Hi Sometime back I did something similar. The thread is here see if this helps. http://apache-wicket.1842946.n4.nabble.com/Re-Using-Wicket-to-build-Application-Portal-td2248912.html#a2258389 Multiple Mave Projects -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Putting-together-two-seperate-wicket-projects-into-a-multi-module-maven-project-tp4096207p4103152.html Sent from the Users forum 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
Set with PageableListView
Hi I have a question related to using a collection (Set) within a PageableListView. At runtime I get an exception java.lang.ClassCastException: org.hibernate.collection.PersistentSet cannot be cast to java.util.List at org.apache.wicket.markup.html.list.ListView.getList(ListView.java:177) The entity structure is like this public class Subject{ String firstName; Set phones; } I guess it expects only a List type object. I can work around this by converting the Set into a List and then provide it but felt somehow this is a limitation. How can I work with generic collections? Any thoughts much appreciated thank you Regards -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Set-Object-with-PageableListView-tp3064906p3064906.html Sent from the Users forum 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
PageableListView to work with Set
Hi I have a question related to using a collection (Set) within a PageableListView. At runtime I get an exception java.lang.ClassCastException: org.hibernate.collection.PersistentSet cannot be cast to java.util.List at org.apache.wicket.markup.html.list.ListView.getList(ListView.java:177) The entity structure is like this public class Subject{ String firstName; Set phones; } I guess it expects only a List type object. I can work around this by converting the Set into a List and then provide it but felt somehow this is a limitation. How can I work with generic collections? Any thoughts much appreciated thank you Regards -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-to-work-with-Set-tp3064909p3064909.html Sent from the Users forum 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: SV: PageableListView to work with Set
So I gather from your response that I should use a list type object only. Since PageableListView uses it for indexing,sorting etc. Am I right then to convert either the entity to use a List or on the front end to map from a Set into a List. Thanks for the time Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-to-work-with-Set-tp3064909p3064992.html Sent from the Users forum 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: SV: PageableListView to work with Set
Hi Thanks for the link. Would have to use a repeater to support more generic ones. Thanks niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-to-work-with-Set-tp3064909p3068641.html Sent from the Users forum 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: Wicket-Hibernate Related LazyInitializationException
Hi Dan, I guess you were right with the thought process - nivs wrote: > > If you're still getting an LIE,> there may be another association at play > (a child of Phone?). > I noticed that when I navigated, it was only when the PhoneType which was an entity (if not a collection on Phone) of Phone; when it was rendered threw the exception. public class Phone{ String phoneNumber; PhoneType phoneType; //This one } So in the initial fetch, i got back 10 items and the List view rendered 5 of them. The OpenSessionInViewFilter closed the session after I rendered 5 Phone items along with PhoneType. When i hit the next page button, since I resorted to pulling the items of the Model(CPM), when it came to PhoneType it threw the exception. The Set was available since I had manually iterated them in the DAO, so that was not a problem. Apologies for not pondering deeper from your thoughts. So now I fetch items for every pagination this opens a Session now I need to optimize it in terms of hitting the back end. Mm well...thank you one and all for your thoughts. I still have to get around how I can add multiple phone numbers using this design. Many thanks again Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Hibernate-Related-LazyInitializationException-tp3068534p3075946.html Sent from the Users forum 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: Wicket-Hibernate Related LazyInitializationException
Eelco Thanks again for your thoughts. Inline with this, I will look at optimizing it and intend to switch to using LDM's. Cheers Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Hibernate-Related-LazyInitializationException-tp3068534p3076005.html Sent from the Users forum 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: DatePicker to pick a year
Hi If your getting the date format error from the Model side and it is expecting a timestamp , then you might get that issue. Are you using a TimeStamp field or pure date? If I wanted only to store date in the backend without timestamp details my model has to be decorated like @Temporal(TemporalType.DATE) //This is important @Column(name = "DATE_OF_APPLICATION", length = 7) public Date getDateOfApplication() { return this.dateOfApplication; } If for instance it was @Temporal(TemporalType.TIMESTAMP) It will fail validation based on the format. Hope that helps Cheers -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DatePicker-to-pick-a-year-tp3063856p3077604.html Sent from the Users forum 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-Choose One Selected Item
Hi, Thank you for the thoughts. We managed to get around this in the following way for completness class TestVO{ public Country selected= countryList.get(0);//I get the first item can be any other way } countryChoice = new DropDownChoice("voName.country", new PropertyModel(new TestVO(),"selected"),countryList, defaultChoiceRenderer); Doing this..sets the Choose One to the default value that was set in the TestVO. Reference: https://cwiki.apache.org/WICKET/dropdownchoice-examples.html https://cwiki.apache.org/WICKET/dropdownchoice-examples.html Thanks Nive -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Choose-One-Selected-Item-tp3298535p3320479.html Sent from the Users forum 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: Validating a Number using a Validator
Thanks Martin, So I do have to build a CustomValidator that is established. I would have thought this was a basic one that would be off the shelf.No worries thank you for the time, will look at the NumberValidator.MinimumValidator implementation. Cheers Niv -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validating-a-Number-using-a-Validator-tp3320671p3320691.html Sent from the Users forum 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