Re: AW: AW: DropDownChoice model is not updated when wantOnSelectionChangedNotifications is overriden
Any suggestion? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-model-is-not-updated-when-wantOnSelectionChangedNotifications-is-overriden-tp4031368p4033965.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: AW: AW: DropDownChoice model is not updated when wantOnSelectionChangedNotifications is overriden
Yes I checked the FormInput example..The only difference is that example has custem dropwdown component which stated in the same class..Also it uses the following in onSelectionChanged method.. // force re-render by setting the page to render to the bookmarkable // instance, so that the page will be rendered from scratch, // re-evaluating the input patterns etc setResponsePage(FormInput.class); When I put this line into my code, it renders the all page and all the model values are reset to default including my selectbox model value...is this normal? The point is, I used dropdown component hundred times in the forms and didnt face any problem like this. Because I did not need to override any methods to do some job after selecting something..This is the first time I didnt attach this component to a form...If I remove these two overriden methods, selectbox model value is updated in all selections accordingly.. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-model-is-not-updated-when-wantOnSelectionChangedNotifications-is-overriden-tp4031368p4034763.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
DropDownChoice model is not updated when wantOnSelectionChangedNotifications is overriden
Hi, I want to make a filter to update a table according to selected user. I am filling a hashmap to retrieve some data from database. To accomplish that I overrided wantOnSelectionChangedNotifications method. But the problem is; when I choose the user1, the model value is updated as it is exptected and hashmap is updated. But after that I am choosing user2 but neither the model value nor hashMap is not updated and the selectbox is still showing user1.. I put a a breakpoint into propertyModel constructer but it didnt stop there in debug mode. Any idea? Thanks private HashMapString, String criteriaMap= new HashMapString, String(); Criteria criteria = new Criteria(); List userFilter=new ArrayList(); userFilter.add(user1); userFilter.add(user2); add(new DropDownChoice(selectByUser, new PropertyModel(criteria, userCriteria),userFilter) { @Override protected boolean wantOnSelectionChangedNotifications() { criteriaMap.put(user,criteria.getUserCriteria()); return true; } }); public class Criteria implements Serializable{ private String userCriteria; public String getUserCriteria() { return userCriteria; } public void setUserCriteria(String userCriteria) { this.userCriteria = userCriteria; } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-model-is-not-updated-when-wantOnSelectionChangedNotifications-is-overriden-tp4031368p4031368.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: AW: DropDownChoice model is not updated when wantOnSelectionChangedNotifications is overriden
Thanks for the quick response Sven...But eclipse gives error for the code you suggested I changed it as below; @Override protected void onSelectionChanged(Object criteria) { criteriaMap.put(user,((Criteria) criteria).getUserCriteria()); } But using onSelectionChanged does not render the page..I need to reload table data from database according to the choice is made in selectBox..Because of that I used wantOnSelectionChangedNotifications final LoadableDetachableModel data= new LoadableDetachableModel() { @Override protected Object load() { ListData dataArrayList = dataDao.findAll(); return dataArrayList; } }; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-model-is-not-updated-when-wantOnSelectionChangedNotifications-is-overriden-tp4031368p4031416.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: AW: AW: DropDownChoice model is not updated when wantOnSelectionChangedNotifications is overriden
Ok I am overriding the both methods but still cannot update the userCriteria..It always contains the the value that I selected first.. new PropertyModel(criteria, userCriteria) The whole code is as following; public class ListQuestionsPage extends AdminBasePage { @SpringBean UserDao dataDao; private HashMapString, String criteriaMap= new HashMapString, String(); Criteria criteria = new Criteria(); public ListUsersPage() { final LoadableDetachableModel data= new LoadableDetachableModel() { @Override protected Object load() { ListData dataArrayList = dataDao.findAll(); return dataArrayList; } }; final WebMarkupContainer listContainer = new WebMarkupContainer(listContainer); add(listContainer); List userFilter=new ArrayList(); userFilter.add(user1); userFilter.add(user2); add(new DropDownChoice(selectByUser, new PropertyModel(criteria, userCriteria),userFilter) { @Override protected boolean wantOnSelectionChangedNotifications() { return true; } @Override protected void onSelectionChanged(Object newSelection) { criteriaMap.put(user,criteria.getUserCriteria()); } }); PageableListView userList = new PageableListView(userList,data ,10) { @Override protected void populateItem(final ListItem item) { final User user = (User) item.getModelObject(); item.add(new Label(id, Long.toString(user.getId(; item.add(new Label(user, user.getUser().getUsername())); item.add(new Label(details, user.getDetails())); } }; listContainer.add(userList); add(new PagingNavigator(navigator,questionList)); } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-model-is-not-updated-when-wantOnSelectionChangedNotifications-is-overriden-tp4031368p4031523.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: AW: AW: DropDownChoice model is not updated when wantOnSelectionChangedNotifications is overriden
I think I am doing something wrong or there is a bug..newSelection is not contain the new selected user..like model value.. If I dont override any methods, selectbox model value is updated as it is expected.. But the the both of them always show the first selection... new PropertyModel(criteria, userCriteria) and protected void onSelectionChanged(Object newSelection) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-model-is-not-updated-when-wantOnSelectionChangedNotifications-is-overriden-tp4031368p4031578.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: Bookmarkable link within AjaxLazyLoadPanel
I think you forgot to close the following link.add(new Label(+count)*)*; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Bookmarkable-link-within-AjaxLazyLoadPanel-tp3943587p3943617.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: creating a textarea with a radiobutton using Listview
Hi Manuelbarzi, I still cant figure out why the texts in the textareas are removed when I unset the checkbox that I selected. I think the following line is used to prevent this problem but it doesnt work. Do you have any idea? listView.setReuseItems(true); Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/creating-a-textarea-with-a-radiobutton-using-Listview-tp3829602p3899670.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: ajax form submit, loading gif and swap panels
Any comment or documentation to learn how to call jquery function inside of this methot? Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-form-submit-loading-gif-and-swap-panels-tp3876326p3881810.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: ajax form submit, loading gif and swap panels
Thanks guys..I overrided the methots and it worked. When I submit the form, animated gif appears until ajax request is completed. But I dont know javascripting so much so I couldnt remove animated gif and fade out form div block at the same time..I want to fade out the form area slowly and display a new message at the same place. Any tip? @Override protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() { @Override public CharSequence decorateScript(Component c, CharSequence script) { return document.getElementById('loading').style.display='inline'; + script; } @Override public CharSequence decorateOnSuccessScript(Component c, CharSequence script) { return document.getElementById('loading').style.display='none'; *document.getElementById('container').fadeOut();* + script; } @Override public CharSequence decorateOnFailureScript(Component c, CharSequence script) { return alert('Failed');; } }; }; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-form-submit-loading-gif-and-swap-panels-tp3876326p3879973.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
ajax form submit, loading gif and swap panels
Hi all, I want to remove the form component after hitting submit button and display a loading animated gif. After ajax submit operation finished, i want to display a new panel instead of form component which has a button to generate a new form page..I think I can swap the panels into onSubmit button but how can I check ajax request finished or not and display a animated gif ? form.add(new AjaxButton(submit) { @Override protected void onSubmit(AjaxRequestTarget ajaxRequestTarget,Form form) { Processing some data in here.. } @Override protected void onError(AjaxRequestTarget target, Form form) { super.onError(); target.addComponent(feedbackPanel); } }); Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-form-submit-loading-gif-and-swap-panels-tp3876326p3876326.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: creating a textarea with a radiobutton using Listview
BTW, i just figured out that changing selected checkbox removed the data in the textareas. First you need to save and then change the selected checkboxes. Rendering form in each ajax update behaviour deletes the model value..How can we solve this? Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/creating-a-textarea-with-a-radiobutton-using-Listview-tp3829602p3848282.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: creating a textarea with a radiobutton using Listview
I tried the following but couldnt get into onUpdate method while debugging. I need to use checkgroup to be able to use AjaxFormChoiceComponentUpdatingBehavior. So I created a checkgroup and added the checkboxes into it. So I guess in each iteration I am creating one text area, one check group and one checkbox that is attached to that checkgroup. What I am trying to do is when I select a checkbox, I want to re-render only the checkboxes by iterating the item list one by one. But it seems if I do this I need to add ajaxbehaviour on to listview?? I think what I am trying to do in here is a little bit tricky and this is not Listview is created for am i right? I am definitely stucked. If I dont use Listview, I need to do this by putting more lines of code and I dont want to do that. ListView listView = new ListView(list, data) { @Override protected void populateItem(final ListItem item) { NameWrapper wrapper = (NameWrapper)item.getModelObject(); item.add(new TextArea(name, new PropertyModel(wrapper, name))); final CheckGroup checkgroup = new CheckGroup (checkgroup, new PropertyModel(wrapper, selected)); item.add(checkgroup); CheckBox check = new CheckBox(checkbox,new Model()); checkgroup.setOutputMarkupId(true); checkgroup.add(check); checkgroup.add(new AjaxFormChoiceComponentUpdatingBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { info(We are here); for (Iterator iter = item.iterator(); iter.hasNext();) { // FIND THE SELECTED ONE and DE-SELECT the OTHER CHECKBOXES in the list } target.addComponent(checkgroup); } }); } }; listView.setReuseItems(true); add(listView); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/creating-a-textarea-with-a-radiobutton-using-Listview-tp3829602p3843288.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: creating a textarea with a radiobutton using Listview
Thanks a lot. I wish I have seen the obvious solution by myself but anyway everything is clear now..I should have iterated the Listview not the list item. My plan was iterating the list component and updating the model value in it. But you are right, iterating item wont give me the all the item list. And you updated data which is the model of Listview..You accessed the model value of Listview directly. I also noticed that you didnt set inputForm.setOutputMarkupId(true) but it didnt give any error while rendering page. How this can be possible? And also using ajaxcheckbox is the same like adding OnChangeAjaxBehavior onto a standart checkbox am i right? AjaxCheckBox a = new AjaxCheckBox(checkbox, new PropertyModel(wrapper, selected)) { protected void onUpdate(AjaxRequestTarget target) { if (wrapper.getSelected()) { for (NameWrapper entity : data) { if (!entity.equals(wrapper)) { entity.setSelected(Boolean.FALSE); } } } target.addComponent(inputForm); } }; item.add(a); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/creating-a-textarea-with-a-radiobutton-using-Listview-tp3829602p3844783.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: creating a textarea with a radiobutton using Listview
It is getting weird. I got your point. You are right, it is more logical to give boolean true or false value. I tried your suggestion but this time I had four radiobutton and all of them appeared as checked. How is it possible? And When I give Boolean.TRUE, this time all of them are displayed as unchecked. Shouldnt be the vice versa? And still I couldnt solve the problem. I want to be able to check only one radio. Right now it doesnt work. Radiobuttons are attached to the radigroup but creating one radiobutton in each iteration seems needs a different approach? adminRadioGroup.add(new Radio(radioCheck, new Model(Boolean.FALSE), adminRadioGroup)); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/creating-a-textarea-with-a-radiobutton-using-Listview-tp3829602p3833068.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: creating a textarea with a radiobutton using Listview
Oh ok I got it right now. In each listitem we should create at least two radio item to get true or false values for that field. I thought creating one radiobutton in each iteration, after 4 iteration, will give me 4 radiobuttons which all of them reacts as one group. And so, i wanted to be able to select only one radiobutton. But it didnt work in that way. First I created one checkbox and one textfield for each line. And when the user selects the checkbox I was able to set the related boolean values succesfuly. But I needed to put a restriction. Only one checkbox can be selected to submit the form in the followıng structure. Textarea checkbox Textarea checkbox Textarea checkbox Textarea checkbox So I decided to put radiobutton instead of checkboxes..So you are saying that this cant be done neither radiobuttons nor checkboxes. Do I have to implement some javascrıpt code to block selecting more than one checkboxes in a form? Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/creating-a-textarea-with-a-radiobutton-using-Listview-tp3829602p3834003.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
creating a textarea with a radiobutton using Listview
Hi, I want to create a form which contains textareas and radiobuttons line by line like; Textarea Radiobutton Textarea Radiobutton My object to fill via a form contains two fields; public Class Line () { private String textInput; private Boolean isSelected; } My aim is to take some input from the user for the textareas and force user to set the boolean attributes of the object attached to the form true for only one of them. When I use checkbox, there is one problem, user can check all checkboxes and set the related boolean value as true. To eliminate this, I need to use radio. But in this time, When I use radiogroup, it doesnt allow me to put textareas between wicket radigroup tags. Because right now I am adding the textareas into the form and it says me that i need to add all components to this radiogroup instead of form. I do not want to display radiobuttons as a row or as a column. I want one textarea and one radibutton next to it which the radiobuttons are in the same group. How can I create this structure by using ListView. Right now I am thinking to get Listitem index value of the selected radiobutton and use it in a switch to set the boolean values of the fields. Any comments? Thanks Arda -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/creating-a-textarea-with-a-radiobutton-using-Listview-tp3829602p3829602.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: creating a textarea with a radiobutton using Listview
Thanks but still couldnt figure out how will i set the boolean values according to the selected radiobutton in List? Can I do something with the index value? Is it stored in radiogroup that I attached my List into? Accessing the cell/row index: protected void populateItem(ListItem item) { // cell index item.getIndex(); // row index ((Item)item.getParent().getParent()).getIndex(); } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/creating-a-textarea-with-a-radiobutton-using-Listview-tp3829602p3829760.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: creating a textarea with a radiobutton using Listview
Hi manuelbarzi, Thanks for the usefull websites I reviewed all of them and I tried the following. I created a radiogroup but still i can select all radiobuttons right now..I just want to be able to select one radiobutton and set the boolean attribute true in related NameWrapper object. And also right now still cant understand how can i set a boolean value with radio buttons? İt gives me the index value of the radiobutton when i submit the form...I am a little bir stuck and cannot go forward public class FormInput extends WebPage { public FormInput() { final FeedbackPanel feedback = new FeedbackPanel(feedback); add(feedback); add(new InputForm(inputForm)); } private class InputForm extends Form { private List data; public InputForm(String name) { super(name); // add some dummy data data = new ArrayList(); data.add(new NameWrapper()); data.add(new NameWrapper()); data.add(new NameWrapper()); data.add(new NameWrapper()); ListView listView = new ListView(list, data) { @Override protected void populateItem(ListItem item) { NameWrapper wrapper = (NameWrapper)item.getModelObject(); item.add(new TextArea(name, new PropertyModel(wrapper, name))); final RadioGroup adminRadioGroup = new RadioGroup(radiogroup, new PropertyModel(wrapper, selected)); item.add(adminRadioGroup); adminRadioGroup.add(new Radio(radioCheck, new Model(item.getIndex()+1))); } }; listView.setReuseItems(true); add(listView); } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/creating-a-textarea-with-a-radiobutton-using-Listview-tp3829602p3831177.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