[Wicket-user] OnChangeAjaxBehavior and Repeater issue on FireFox
Greetings. I have a page that uses the new OnChangeAjaxBehavior. When values are typed into the text field, it updates a RepeaterView. It works with the first key press but, almost always, it doesn't fire the onUpdate() event on subsequent key presses, but only on FireFox (I'm using 2.0.0.5). It works fine with IE 7. To make sure I didn't configure anything incorrectly, I copied the OnChangeAjaxBehaviorPage sample to my project and ran it. That works fine for both IE and FireFox. Since I can reasonably eliminate environment, it seems like the probable issue has something to do with the repeater code, or its container. In looking at the AJAX DEBUG window it looks like the ajax is completing successfully. I'm using the wicket 1.3.0-beta2 build. I also tried now with the snapshot from today (561103). The same results. I put up a test page at http://24.248.103.44/pages/TestAjax. The page has the java code on it. IE works fine, but FF fails after the first key press. I also have the sample from examples too: http://24.248.103.44/pages/OnChangeAjaxBehaviorPage That works for IE and FF. I'd appreciate any insight into what I may be doing wrong. -- View this message in context: http://www.nabble.com/OnChangeAjaxBehavior-and-Repeater-issue-on-FireFox-tf4178944.html#a11883174 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ IMPORTANT NOTICE: This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: users-subscribe at wicket.apache.org and follow the instructions. ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] OnChangeAjaxBehavior and Repeater issue on FireFox
Ah! That fixed it. Thank you, kind sir! igor.vaynberg wrote: try changing to div id=.. you shouldnt nest block elements (table/div) in inline elements. -igor On 7/30/07, Flavius [EMAIL PROTECTED] wrote: Greetings. I have a page that uses the new OnChangeAjaxBehavior. When values are typed into the text field, it updates a RepeaterView. It works with the first key press but, almost always, it doesn't fire the onUpdate() event on subsequent key presses, but only on FireFox (I'm using 2.0.0.5). It works fine with IE 7. To make sure I didn't configure anything incorrectly, I copied the OnChangeAjaxBehaviorPage sample to my project and ran it. That works fine for both IE and FireFox. Since I can reasonably eliminate environment, it seems like the probable issue has something to do with the repeater code, or its container. In looking at the AJAX DEBUG window it looks like the ajax is completing successfully. I'm using the wicket 1.3.0-beta2 build. I also tried now with the snapshot from today (561103). The same results. I put up a test page at http://24.248.103.44/pages/TestAjax. The page has the java code on it. IE works fine, but FF fails after the first key press. I also have the sample from examples too: http://24.248.103.44/pages/OnChangeAjaxBehaviorPage That works for IE and FF. I'd appreciate any insight into what I may be doing wrong. -- View this message in context: http://www.nabble.com/OnChangeAjaxBehavior-and-Repeater-issue-on-FireFox-tf4178944.html#a11883174 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ IMPORTANT NOTICE: This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: users-subscribe at wicket.apache.org and follow the instructions. ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ IMPORTANT NOTICE: This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: users-subscribe at wicket.apache.org and follow the instructions. ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/OnChangeAjaxBehavior-and-Repeater-issue-on-FireFox-tf4178944.html#a11884152 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ IMPORTANT NOTICE: This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: users-subscribe at wicket.apache.org and follow the instructions. ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] setVisible on Fragment with AjaxFormComponentUpdatingBehavior
There are no errors. I did try setting the outputMarkupId to true for the fragment. In the examples (and in my own code with just the TextField), setting the container was sufficient. Adding this to the Fragment had no effect. Here is the Ajax output from the console: INFO: INFO: Initiating Ajax POST request on /;jsessionid=32444A7415B3D15E1792F255AFB8C5BE?wicket:interface=:0:inputForm:dropDown:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=truerandom=0.8983050159419032 INFO: Invoking pre-call handler(s)... INFO: Received ajax response (181 characters) INFO: ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent id=inputForm_container ![CDATA[ ]]/component/ajax-response INFO: Response parsed. Now invoking steps... INFO: Response processed successfully. INFO: Invoking post-call handler(s)... Like I mentioned, if I just add a TextField (or any other form component) it works great. But my pages need to remove the control and label. In a couple of places, it needs to remove several controls, a prime candidate for a fragment or panel, imho. I've read other threads discussing setting the visibility like this: http://www.nabble.com/Changing-visibility-via-ajax-tf1974532.html#a5418508 So I must conclude I'm doing something wrong. Timo Rantalaiho wrote: On Tue, 22 May 2007, Flavius wrote: I am trying to setVisible on a Fragment using the AjaxFormComponentUpdatingBehavior object. It doesn't seem to work. I've also tried this with a Panel and that's not working either. How does it not work? What does the Ajax debug console say? What is the error message / stack trace, if any? Looking quickly it occurs to me that maybe you should set outputMarkupId(true) to the Fragment. If this is the case, it should be obvious from the error message on Ajax debug console. - Timo -- Timo Rantalaiho +358-45-6709709 Reaktor Innovations OyURL: http://www.ri.fi/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/setVisible-on-Fragment-with-AjaxFormComponentUpdatingBehavior-tf3800038.html#a10764129 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] setVisible on Fragment with AjaxFormComponentUpdatingBehavior
The fragment contents appear fine. When I change the value on the dropdown, I expect the AjaxFormComponentUpdatingBehavior.onUpdate() to set the visibility to false. My dropdown has this added: dropDown.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { target.addComponent(container); text2Fragment.setVisible(false); } }); Now if I substitute a TextField instead of a fragment (or panel), it correctly sets the visibility to false. But with the fragment, it stays visible when the onchange event fires. I put up a couple of test pages, if you want to see: http://24.248.103.44/pages/Test (this is just the component, which works) http://24.248.103.44/pages/Test2 (this is with the fragment, which does not) I included the java source on each page. Johan Compagner wrote: so whats in the fragment doesnt disappear? looking at the ajax code we see an empty component comming up. I guess the ajax console is saying exatly the same stuff when you do it for the textfield? On 5/23/07, Flavius [EMAIL PROTECTED] wrote: There are no errors. I did try setting the outputMarkupId to true for the fragment. In the examples (and in my own code with just the TextField), setting the container was sufficient. Adding this to the Fragment had no effect. Here is the Ajax output from the console: INFO: INFO: Initiating Ajax POST request on /;jsessionid=32444A7415B3D15E1792F255AFB8C5BE?wicket:interface=:0:inputForm:dropDown:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=truerandom=0.8983050159419032 INFO: Invoking pre-call handler(s)... INFO: Received ajax response (181 characters) INFO: ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent id=inputForm_container ![CDATA[ ]]/component/ajax-response INFO: Response parsed. Now invoking steps... INFO: Response processed successfully. INFO: Invoking post-call handler(s)... Like I mentioned, if I just add a TextField (or any other form component) it works great. But my pages need to remove the control and label. In a couple of places, it needs to remove several controls, a prime candidate for a fragment or panel, imho. I've read other threads discussing setting the visibility like this: http://www.nabble.com/Changing-visibility-via-ajax-tf1974532.html#a5418508 So I must conclude I'm doing something wrong. Timo Rantalaiho wrote: On Tue, 22 May 2007, Flavius wrote: I am trying to setVisible on a Fragment using the AjaxFormComponentUpdatingBehavior object. It doesn't seem to work. I've also tried this with a Panel and that's not working either. How does it not work? What does the Ajax debug console say? What is the error message / stack trace, if any? Looking quickly it occurs to me that maybe you should set outputMarkupId(true) to the Fragment. If this is the case, it should be obvious from the error message on Ajax debug console. - Timo -- Timo Rantalaiho +358-45-6709709 Reaktor Innovations OyURL: http://www.ri.fi/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/setVisible-on-Fragment-with-AjaxFormComponentUpdatingBehavior-tf3800038.html#a10764129 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https
Re: [Wicket-user] setVisible on Fragment with AjaxFormComponentUpdatingBehavior
I didn't think about that. However, I changed the spans to divs and still the same result. :-( I put a new build out at the same urls. Johan Compagner wrote: can a span have other block elements? try to make the span a div johan On 5/23/07, Flavius [EMAIL PROTECTED] wrote: The fragment contents appear fine. When I change the value on the dropdown, I expect the AjaxFormComponentUpdatingBehavior.onUpdate() to set the visibility to false. My dropdown has this added: dropDown.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { target.addComponent(container); text2Fragment.setVisible(false); } }); Now if I substitute a TextField instead of a fragment (or panel), it correctly sets the visibility to false. But with the fragment, it stays visible when the onchange event fires. I put up a couple of test pages, if you want to see: http://24.248.103.44/pages/Test (this is just the component, which works) http://24.248.103.44/pages/Test2 (this is with the fragment, which does not) I included the java source on each page. Johan Compagner wrote: so whats in the fragment doesnt disappear? looking at the ajax code we see an empty component comming up. I guess the ajax console is saying exatly the same stuff when you do it for the textfield? On 5/23/07, Flavius [EMAIL PROTECTED] wrote: There are no errors. I did try setting the outputMarkupId to true for the fragment. In the examples (and in my own code with just the TextField), setting the container was sufficient. Adding this to the Fragment had no effect. Here is the Ajax output from the console: INFO: INFO: Initiating Ajax POST request on /;jsessionid=32444A7415B3D15E1792F255AFB8C5BE?wicket:interface=:0:inputForm:dropDown:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=truerandom= 0.8983050159419032 INFO: Invoking pre-call handler(s)... INFO: Received ajax response (181 characters) INFO: ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent id=inputForm_container ![CDATA[ ]]/component/ajax-response INFO: Response parsed. Now invoking steps... INFO: Response processed successfully. INFO: Invoking post-call handler(s)... Like I mentioned, if I just add a TextField (or any other form component) it works great. But my pages need to remove the control and label. In a couple of places, it needs to remove several controls, a prime candidate for a fragment or panel, imho. I've read other threads discussing setting the visibility like this: http://www.nabble.com/Changing-visibility-via-ajax-tf1974532.html#a5418508 So I must conclude I'm doing something wrong. Timo Rantalaiho wrote: On Tue, 22 May 2007, Flavius wrote: I am trying to setVisible on a Fragment using the AjaxFormComponentUpdatingBehavior object. It doesn't seem to work. I've also tried this with a Panel and that's not working either. How does it not work? What does the Ajax debug console say? What is the error message / stack trace, if any? Looking quickly it occurs to me that maybe you should set outputMarkupId(true) to the Fragment. If this is the case, it should be obvious from the error message on Ajax debug console. - Timo -- Timo Rantalaiho +358-45-6709709 Reaktor Innovations OyURL: http://www.ri.fi/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/setVisible-on-Fragment-with-AjaxFormComponentUpdatingBehavior-tf3800038.html#a10764129 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] setVisible on Fragment with AjaxFormComponentUpdatingBehavior
Btw, I am running wicket 1.2.6 on Tomcat 6. Johan Compagner wrote: can a span have other block elements? try to make the span a div johan On 5/23/07, Flavius [EMAIL PROTECTED] wrote: The fragment contents appear fine. When I change the value on the dropdown, I expect the AjaxFormComponentUpdatingBehavior.onUpdate() to set the visibility to false. My dropdown has this added: dropDown.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { target.addComponent(container); text2Fragment.setVisible(false); } }); Now if I substitute a TextField instead of a fragment (or panel), it correctly sets the visibility to false. But with the fragment, it stays visible when the onchange event fires. I put up a couple of test pages, if you want to see: http://24.248.103.44/pages/Test (this is just the component, which works) http://24.248.103.44/pages/Test2 (this is with the fragment, which does not) I included the java source on each page. Johan Compagner wrote: so whats in the fragment doesnt disappear? looking at the ajax code we see an empty component comming up. I guess the ajax console is saying exatly the same stuff when you do it for the textfield? On 5/23/07, Flavius [EMAIL PROTECTED] wrote: There are no errors. I did try setting the outputMarkupId to true for the fragment. In the examples (and in my own code with just the TextField), setting the container was sufficient. Adding this to the Fragment had no effect. Here is the Ajax output from the console: INFO: INFO: Initiating Ajax POST request on /;jsessionid=32444A7415B3D15E1792F255AFB8C5BE?wicket:interface=:0:inputForm:dropDown:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=truerandom= 0.8983050159419032 INFO: Invoking pre-call handler(s)... INFO: Received ajax response (181 characters) INFO: ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent id=inputForm_container ![CDATA[ ]]/component/ajax-response INFO: Response parsed. Now invoking steps... INFO: Response processed successfully. INFO: Invoking post-call handler(s)... Like I mentioned, if I just add a TextField (or any other form component) it works great. But my pages need to remove the control and label. In a couple of places, it needs to remove several controls, a prime candidate for a fragment or panel, imho. I've read other threads discussing setting the visibility like this: http://www.nabble.com/Changing-visibility-via-ajax-tf1974532.html#a5418508 So I must conclude I'm doing something wrong. Timo Rantalaiho wrote: On Tue, 22 May 2007, Flavius wrote: I am trying to setVisible on a Fragment using the AjaxFormComponentUpdatingBehavior object. It doesn't seem to work. I've also tried this with a Panel and that's not working either. How does it not work? What does the Ajax debug console say? What is the error message / stack trace, if any? Looking quickly it occurs to me that maybe you should set outputMarkupId(true) to the Fragment. If this is the case, it should be obvious from the error message on Ajax debug console. - Timo -- Timo Rantalaiho +358-45-6709709 Reaktor Innovations OyURL: http://www.ri.fi/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/setVisible-on-Fragment-with-AjaxFormComponentUpdatingBehavior-tf3800038.html#a10764129 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2
[Wicket-user] setVisible on Fragment with AjaxFormComponentUpdatingBehavior
I am trying to setVisible on a Fragment using the AjaxFormComponentUpdatingBehavior object. It doesn't seem to work. I've also tried this with a Panel and that's not working either. However, if I use a component, like a TextField, that works. In my java, this is the pertinent code for my Form: DropDownChoice dropDown = new DropDownChoice(dropDown, new Model(), choiceList); add(dropDown); final WebMarkupContainer container = new WebMarkupContainer(container); container.setOutputMarkupId(true); final Text2Fragment text2Fragment = new Text2Fragment(text2Fragment, text2FragmentId); container.add(text2Fragment); add(container); dropDown.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { target.addComponent(container); text2Fragment.setVisible(false); } }); My fragment: private class Text2Fragment extends Fragment { public Text2Fragment(String id, String markupId) { super(id, markupId); TextField text2 = new TextField(text2); add(text2); } } My HTML: tr tdDropDown:/td tdselect wicket:id = dropDown/select/td /tr tr tdText 1/td tdinput wicket:id=text1/td /tr --spaces in span are for nabble sp an wicket:id=container sp an wicket:id=text2Fragment/sp an /sp an tr tdText 3/td tdinput wicket:id=text3/td /tr My Fragment: wicket:fragment wicket:id=text2FragmentId tr tdText 2/td tdinput wicket:id=text2/td /tr /wicket:fragment If I put the text2 TextField in place of the fragment, the control successfully disappears. I want a fragment so I can also remove labels, et al. I'd appreciate any feedback on what I'm doing wrong. -- View this message in context: http://www.nabble.com/setVisible-on-Fragment-with-AjaxFormComponentUpdatingBehavior-tf3800038.html#a10751154 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Receive event when user navigates away from current page
Thanks Martijn. getBodyContainer().getBodyContainer().add(new AjaxEventBehavior(onunload) { protected void onEvent(AjaxRequestTarget target) { //handle cleanup here } }); This works well, except it doesn't fire when the browser is closed. I'm keeping a ref to uploaded files in a list on the session. When valueUnbound fires in my session, any remaining files that have not been handled can be removed then. That should cover BSOD, and any other client issues. Martijn Dashorst wrote: body.onunload could be your friend However, don't depend on this behavior to be a failsafe: kill -9 will not trigger the body onunload in the browser, or a power failure on the client side, or a BSOD, or ... Martijn On 5/18/07, Flavius [EMAIL PROTECTED] wrote: I would like to receive an event when the user tries to navigate away from the current page. So if the user is on the page and navigates to any other page, closes the window, etc., I'll get an event. I have a page that allows the user to upload files to a record. I store the physical file in a temp location until the record is saved. If they navigate away / close the window without saving, I want to be able to delete the uploaded files on the fly. Also, later, I may want to keep a dirty flag on the page. So if the user has not made any changes, it will just navigate away. But if they have dirty changes, it will prompt them with an alert box. I was looking at the source for ModalWindow. It seems that I can probably attach a behavior to page. I'd thought I'd ask to see if that's the best approach. Currently I am using wicket 1.2.6 on Tomcat 5.5 -- View this message in context: http://www.nabble.com/Receive-event-when-user-navigates-away-from-current-page-tf3779542.html#a10688196 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- Learn Wicket at ApacheCon Europe: http://apachecon.com Join the wicket community at irc.freenode.net: ##wicket Wicket 1.2.6 contains a very important fix. Download Wicket now! http://wicketframework.org - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/Receive-event-when-user-navigates-away-from-current-page-tf3779542.html#a10723397 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Receive event when user navigates away from current page
I would like to receive an event when the user tries to navigate away from the current page. So if the user is on the page and navigates to any other page, closes the window, etc., I'll get an event. I have a page that allows the user to upload files to a record. I store the physical file in a temp location until the record is saved. If they navigate away / close the window without saving, I want to be able to delete the uploaded files on the fly. Also, later, I may want to keep a dirty flag on the page. So if the user has not made any changes, it will just navigate away. But if they have dirty changes, it will prompt them with an alert box. I was looking at the source for ModalWindow. It seems that I can probably attach a behavior to page. I'd thought I'd ask to see if that's the best approach. Currently I am using wicket 1.2.6 on Tomcat 5.5 -- View this message in context: http://www.nabble.com/Receive-event-when-user-navigates-away-from-current-page-tf3779542.html#a10688196 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] ajax libraries wicket
Is the DatesComparatorValidator object something you wrote or is that something coming in wicket 1.3? -- View this message in context: http://www.nabble.com/-Wicket-user--ajax-libraries---wicket-tf3191437.html#a10129826 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] DropDownChoice binding question
ok, I see where you're going with this. very cool. My enum is in a helper class and I started writing conversion methods in the helper class. But I like the way you wrapped your conversion methods in a class to use on the Page class. I also gave some thought last night to using a MapInteger, String with the same conversion technique. Then my dropdown uses Integers and I can do a map.get() in getDisplayValue() for the String. Thanks for your help, Igor. igor.vaynberg wrote: you are passing a list of enum objects into the list model of the dropdown choice, that means the one selected object out of that list - of type enum - will be set into the model object. so there are two ways to do this you can pass in a list of ints into the choice component, that way the selected int will be set into your model or you can write a model decorator that does the transform class SizeEnumToIntModel extends Model { private final IModel delegate; public SizeEnumToIntModel(IModel delegate) { this.delegate=delegate; } public Object getObject(Component c) {return Size.forValue( delegate.getObject(c); // convert int to enum } public void setObject(Component c, Object o) { delegate.setObject(((Size)o).getintvalue(); // convert enum to int } public void detach() { delegate.detach(); } } then new DropDownChoice(id, new SizeEnumToIntModel(new PropertyModel(form, size)) you lose the nice compound model syntax, but oh well you might also be able to use a convert to accomplish the same, but i havent looked into that -igor -- View this message in context: http://www.nabble.com/DropDownChoice-binding-question-tf2900580.html#a8108551 Sent from the Wicket - User mailing list archive at Nabble.com. - 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
[Wicket-user] DropDownChoice binding question
Greetings, I am trying to take the value (only) of a DropDownChoice and put it in a model set on the Form. Ideally, I'd like to use a (java 5) enum, but any type of name value pair will work. For example, if I'm trying to set the size of a Shirt class, here is my Shirt, and a sample enum: public class Shirt { private int size; private int color; //. . . //(setters and getters removed to compact) } public static enum SIZE { Small(2), Medium(4), Large(6), private String id; SIZE(String id) { this.id = id; } public String getId() { return id; } public String getName() { return id + - + this.toString(); } } Now, in my Form, I set the shirt as a model. When I add my size DropDownChoice to the form, I am binding it to the size field of my Shirt class: private class InputForm extends Form { public InputForm(String name) { super(name, new CompoundPropertyModel(new Shirt())); DropDownChoice sizeChoice = new DropDownChoice(size, Arrays.asList(SIZE.values()), new ChoiceRenderer(name, id)); sizeChoice.setRequired(true); add(sizeChoice); //. . . } } When I submit this form, it fails because I get a Small, Medium, or Large object back. What I want is the id of the selected object. I looked at the examples in DropDownChoicePage.java in the compref package of the wicket examples and I could do that: create a list of Integers and use a switch or other technique to get the display value. What I really want to do is bind the id property of the enum to the Shirt.size property. I've done this in reverse with a PropertyModel, binding a property of the model to a field on the page. I having some trouble doing it this way. I read through a number of the posts on DropDownChoice as a search item. None seem to hit the nail on the head. One poster mentioned using ChoiceRenderer, but I'm not following how that would work. Any suggestions would be greatly appreciated! I'm using Wicket 1.2.3 and java 5 in Tomcat. -- View this message in context: http://www.nabble.com/DropDownChoice-binding-question-tf2900580.html#a8103832 Sent from the Wicket - User mailing list archive at Nabble.com. - 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] DropDownChoice binding question
I tried this: DropDownChoice severityChoice = new DropDownChoice(size, Arrays.asList(SIZE.values()), new ChoiceRenderer() { public Object getDisplayValue(Object object) { return ((SIZE)object).getName(); } public String getIdValue(Object object, int index) { return ((SIZE)object).getId(); } }); The page renders fine. But when I submit the form, I get this error: WicketMessage: unable to set object Small, model: Model:classname=[wicket.model.CompoundPropertyModel] Root cause: wicket.util.convert.ConversionException: Cannot parse 'Small' using format [EMAIL PROTECTED] at wicket.util.convert.converters.AbstractConverter.newConversionException(AbstractConverter.java:72) As I understand it, it's trying to set an int in the Shirt model for size, but the drop down returned the Small object. What I really need is Small.getId(). So I need to tell the form to bind the id property of the return object to the field size Nick Heudecker wrote: IChoiceRenderer allows you to specify the id and display values for a DropDownChoice. It's exactly what you're looking for. To explain a bit: getDisplayValue(...) - returns the value you want the user to see. Small, Medium, etc. This is where you'd return SIZE.getName(). getIdValue(...) returns the value submitted to the application. This is where you'd return SIZE.getId(). -- View this message in context: http://www.nabble.com/DropDownChoice-binding-question-tf2900580.html#a8104039 Sent from the Wicket - User mailing list archive at Nabble.com. - 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
[Wicket-user] Wicket 1.2.2 home page loads twice
I'm new with wicket and started a vanilla project. I created my application class which extends WebApplication and defined a home page called Home.java (and Home.html). When I nav to the root of the app, it successfully takes me to the home page. But the app loads that page twice. I am determining this because in the constructor I am logging the value of getId(). In debug mode, first time through getId() = 0, and 2nd time through getId() = 1. I want to think I misconfigured something (like page pool size or something), but the only configuration I've done is the web.xml, which I mimiced from one of the wicket-examples projects I looked at. I've googled a bit and can't find anything quite like mine. I'm running this with both merve tomcat (5.5.17) and jetty launcher. Same behavior from both of these. Any suggestions on where to look would be appreciated. -- View this message in context: http://www.nabble.com/Wicket-1.2.2-home-page-loads-twice-tf2515875.html#a7017276 Sent from the Wicket - User mailing list archive at Nabble.com. - 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] Wicket 1.2.2 home page loads twice
I found the issue. I'm putting the images in for the home page. One tag didn't have an entry for the src, like img src= . . . . That was calling the home page. :-( -- View this message in context: http://www.nabble.com/Wicket-1.2.2-home-page-loads-twice-tf2515875.html#a7022847 Sent from the Wicket - User mailing list archive at Nabble.com. - 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