Re: unit test of AjaxLazyLoadPanel and ModalWindow
Hi, As suggested by message subject, you had a problem for testing AjaxLazyLoadPanel and ModalWindow. You provided a solution for the first case (great!), but there is nothing in this thread about testing ModelWindow. Does your solution apply to ModalWindow too ? Or is there another method ? NB : I'm using the iframe version of ModalWindows... Regards Bernard Antony Stubbs wrote: And here's a nicer version to add to your library: /** * Triggers an {...@link AjaxLazyLoadPanel} to fetch it's contents. * * @param wc the {...@link WicketTester} to execute the behaviour ( {...@link WicketTester#executeBehavior} ). * @param container contains the {...@link AjaxLazyLoadPanel} to trigger */ private void executeAjaxLazyLoadPanel(final WicketTester wc, Panel container) { container.visitChildren( AjaxLazyLoadPanel.class, new IVisitorAjaxLazyLoadPanel() { @Override public Object component(AjaxLazyLoadPanel component) { ListIBehavior behaviors = component.getBehaviors(); // get the AbstractAjaxBehaviour which is responsible for // getting the contents of the lazy panel AbstractAjaxBehavior b = (AbstractAjaxBehavior) behaviors.get( 0 ); // tell wicket tester to execute it :) wc.executeBehavior( b ); // continue with visitation rights, or not, i don't care return CONTINUE_TRAVERSAL; } } ); } Antony Stubbs wrote: And boom! Thanks for the inspiration Frank! final WicketTester wc = constructBasicPanel(); wc.debugComponentTrees(); wc.dumpPage(); // delicious is the constructed panel, which contains a AjaxLazyLoadPanel... // visit it's children, looking for the AjaxLazyLoadPanel delicious.visitChildren( AjaxLazyLoadPanel.class, new IVisitorAjaxLazyLoadPanel(){ @Override public Object component(AjaxLazyLoadPanel component) { // get the AbstractAjaxBehaviour which is responsible for getting the contents of the lazy panel ListIBehavior behaviors = component.getBehaviors(); final AbstractAjaxBehavior b; b = (AbstractAjaxBehavior) behaviors.get( 0 ); // tell wicket tester to execute it :) wc.executeBehavior( b ); // continue with visitation rights, or not, i don't care return null; }} ); wc.debugComponentTrees(); wc.dumpPage(); // and volah, your lazy panel is now replaced with the contents :) wc.assertComponent( panel:lazy:content:repeaterContainer:bookmarks:1, Item.class ); wc.assertInvisible( panel:lazy:content:noBookmarks ); Let me know what you think or if you have any improvements! Antony Stubbs wrote: Thanks for the info Frank. Any tips on how to do so? Frank Bille wrote: On Thu, Apr 24, 2008 at 8:10 PM, qk wuhanqiangk...@gmail.com wrote: 1. after the page was rendered using WicketTester.startPage(), the real content (the one that returned by getLazyLoadComponent()) was not loaded by default. I always got an empty panel. Is there a way that I can have the real content rendered? Wicket tester doesn't parse javascript, so it can't execute the ajax callback. You have to do that yourself. Frank - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/unit-test-of-AjaxLazyLoadPanel-and-ModalWindow-tp16851306p26793515.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: close a ModalWindow when session expired
Thank you Johan, you're right... except that there is always a cross in the upper right corner of the modal window, that allows to close the modal window without sending any ajax request to the server. So I just would like to have a close button that do the same as the cross image, but I'm not able to find which javascript code is executed on this cross image. Regards Bernard Johan Compagner wrote: it could be that if you do that then in normal use the serverside doesnt know that the modal window isnt shown anymore. So i guess you should also try to let the server know. On Fri, Dec 4, 2009 at 10:16, Bernard Lupin wrote: Hi again, After a lot of various tries, I finally found a solution that seems to work. On my ModalWindow close button, I don't need javacode anymore, I just have this small javascript command in the markup file: onclick=window.parent.Wicket.Window.close(); Do you think that it's a good way to solve my problem ? Regards, Bernard Bernard Lupin wrote: Hi, On my ModalWindow's close button, I only want to ... close the modal window. It seems that myWindow.close(target) calls some Ajax request, which is failing when session is expired. But if I click on the cross button in the upper right of the modal window, everything works well : the modal window is closed and the original window becomes active again. I searched in source page and in wicket source code, but can't find what code is behind this cross button. Could you tell me which javascript code I could invoke on my close button, to close the window without ajax request ? Thanks a lot Bernard -- View this message in context: http://old.nabble.com/close-a-ModalWindow-when-session-expired-tp26622679p26779142.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: ModalWindow on Firefox plus IE tab
Hi, On line 1129 in modal.js, I replaced iframe src='\/\/:' frameborder=... with iframe src='about:blank' frameborder=... and this solved the problem. I don't know which browser do not understand about:blank, but both my IE and my firefox does... Bernard Lupin wrote: Hi, My web site as to run on Firefox and Internet Explorer, so I use IE tab (https://addons.mozilla.org/fr/firefox/addon/1419) to test it, and for the first time I see a difference between IE tab and normal IE. I introduced one ModalWindow (IFrame version) in my page : it works well on IE and on firefox, but on IE tab I have an error The page cannot be displayed, with a bad URL : http://:/; when creating this modal window. OK, the problem is perhaps within IE tab, but perhaps it can be easily corrected with one more hack in modal.js file, around the iframe creation. If some javascript expert can help me... Many thanks Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/ModalWindow-on-Firefox-plus-IE-tab-tp26613842p26736728.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: close a ModalWindow when session expired
Hi again, After a lot of various tries, I finally found a solution that seems to work. On my ModalWindow close button, I don't need javacode anymore, I just have this small javascript command in the markup file: onclick=window.parent.Wicket.Window.close(); Do you think that it's a good way to solve my problem ? Regards, Bernard Bernard Lupin wrote: Hi, On my ModalWindow's close button, I only want to ... close the modal window. It seems that myWindow.close(target) calls some Ajax request, which is failing when session is expired. But if I click on the cross button in the upper right of the modal window, everything works well : the modal window is closed and the original window becomes active again. I searched in source page and in wicket source code, but can't find what code is behind this cross button. Could you tell me which javascript code I could invoke on my close button, to close the window without ajax request ? Thanks a lot Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/close-a-ModalWindow-when-session-expired-tp26622679p26635817.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
close a ModalWindow when session expired
Hi, On my ModalWindow's close button, I only want to ... close the modal window. It seems that myWindow.close(target) calls some Ajax request, which is failing when session is expired. But if I click on the cross button in the upper right of the modal window, everything works well : the modal window is closed and the original window becomes active again. I searched in source page and in wicket source code, but can't find what code is behind this cross button. Could you tell me which javascript code I could invoke on my close button, to close the window without ajax request ? Thanks a lot Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Session timeout - AJAX-enabled controls
Thank you Igor. Does somebody have a short example of java code to check for wicket-Ajax header ? Or an example of what such a header looks like ? In the debug window, I can see wicket xml responses, bot no query... Bernard in your servlet filter you will have to check for Wicket-Ajax header and if it is present return a properly formatted ajax-response that contains javascript to redirect to your login page. -igor On Tue, Dec 1, 2009 at 1:01 PM, Bernard Lupin beal6...@yahoo.fr wrote: And I'm using wicket version 1.4.3... Bernard Lupin wrote: Hello, I also have a similar problem : when the session is over, debug shows me that all my Ajax links receive an html response with my login page, instead of an xml response, because I have a servlet filter for that. So wicket says in the wicket ajax debug window ERROR: Wicket.Ajax.Call.failure: Error while parsing response: Could not find root ajax-response element, and for users nothing happens when clicking on AjaxLink's. Is it a way to solve this please ? Regards, Bernard -- View this message in context: http://old.nabble.com/Session-timeout---AJAX-enabled-controls-tp26422932p26611019.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
ModalWindow on Firefox plus IE tab
Hi, My web site as to run on Firefox and Internet Explorer, so I use IE tab (https://addons.mozilla.org/fr/firefox/addon/1419) to test it, and for the first time I see a difference between IE tab and normal IE. I introduced one ModalWindow (IFrame version) in my page : it works well on IE and on firefox, but on IE tab I have an error The page cannot be displayed, with a bad URL : http://:/; when creating this modal window. OK, the problem is perhaps within IE tab, but perhaps it can be easily corrected with one more hack in modal.js file, around the iframe creation. If some javascript expert can help me... Many thanks Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Session timeout - AJAX-enabled controls
Hello, I also have a similar problem : when the session is over, debug shows me that all my Ajax links receive an html response with my login page, instead of an xml response, because I have a servlet filter for that. So wicket says in the wicket ajax debug window ERROR: Wicket.Ajax.Call.failure: Error while parsing response: Could not find root ajax-response element, and for users nothing happens when clicking on AjaxLink's. Is it a way to solve this please ? Regards, Bernard --- En date de : Ven 20.11.09, Carlo Camerino carlo.camer...@gmail.com a écrit : De: Carlo Camerino carlo.camer...@gmail.com Objet: Re: Session timeout - AJAX-enabled controls À: users@wicket.apache.org Date: Vendredi 20 Novembre 2009, 3h44 yes we also have this prob lem For example i use a wicket in dicating ajax button in our logi n page. If thne user doesn t click a link that moves a page he will not be able to k now that the session has i ndeed expired. The screen o ly shows the rotating image but nothing happens. but if i use a normal submit li nk, im immeddiately redirected.. Some clients didnt mind it bbut some clients do thanks On 11/20/09, Igor Vaynberg igor.vaynb...@gmail.com wrote: afair any ajax interaction on an expired page causes the same reaction as a non-ajax interaction - going to the page expired page. open a bug with a quickstart if that is not the case. -igor 2009/11/19 David Matoušek david.matou...@monetplus.cz: Hi, I have a problem with ajax behavior, that i use to fill various dropdowns by data from database. When session expires(user was inactive), non-ajax controls correctly redirect me to some kind of Error page. Thats correct. Components that have defined ajax behavior to update another components don't redirect, and doesn't update another components either. Is that Wicket feature, or a bug? Can components with ajax behaviors be forced to redirect to error page on session expire like non-ajax ones do? Any suggestions? Thanks for reply David Matousek -- Tato zprava byla prohledana na vyskyt viru a nebezpecneho obsahu antivirovym systemem MailScanner a zda se byt cista. - 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 - 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: Session timeout - AJAX-enabled controls
And I'm using wicket version 1.4.3... Bernard Lupin wrote: Hello, I also have a similar problem : when the session is over, debug shows me that all my Ajax links receive an html response with my login page, instead of an xml response, because I have a servlet filter for that. So wicket says in the wicket ajax debug window ERROR: Wicket.Ajax.Call.failure: Error while parsing response: Could not find root ajax-response element, and for users nothing happens when clicking on AjaxLink's. Is it a way to solve this please ? Regards, Bernard --- En date de : Ven 20.11.09, Carlo Camerino carlo.camer...@gmail.com a écrit : De: Carlo Camerino carlo.camer...@gmail.com Objet: Re: Session timeout - AJAX-enabled controls À: users@wicket.apache.org Date: Vendredi 20 Novembre 2009, 3h44 yes we also have this prob lem For example i use a wicket in dicating ajax button in our logi n page. If thne user doesn t click a link that moves a page he will not be able to k now that the session has i ndeed expired. The screen o ly shows the rotating image but nothing happens. but if i use a normal submit li nk, im immeddiately redirected.. Some clients didnt mind it bbut some clients do thanks On 11/20/09, Igor Vaynberg igor.vaynb...@gmail.com wrote: afair any ajax interaction on an expired page causes the same reaction as a non-ajax interaction - going to the page expired page. open a bug with a quickstart if that is not the case. -igor 2009/11/19 David Matoušek david.matou...@monetplus.cz: Hi, I have a problem with ajax behavior, that i use to fill various dropdowns by data from database. When session expires(user was inactive), non-ajax controls correctly redirect me to some kind of Error page. Thats correct. Components that have defined ajax behavior to update another components don't redirect, and doesn't update another components either. Is that Wicket feature, or a bug? Can components with ajax behaviors be forced to redirect to error page on session expire like non-ajax ones do? Any suggestions? Thanks for reply David Matousek -- Tato zprava byla prohledana na vyskyt viru a nebezpecneho obsahu antivirovym systemem MailScanner a zda se byt cista. - 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 - 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 -- View this message in context: http://old.nabble.com/Session-timeout---AJAX-enabled-controls-tp26422932p26598984.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: method assertWarningMessages
Hi again, This question seems to be simple, no ? Do I have to open a JIRA ? Bernard Bernard Lupin wrote: Hi all, Components have 3 methods to put information in a feedback panel : info(), warn() and error(). But in the WicketTester class, there are only 2 asserts available : assertInfoMessages() and assertErrorMessages(). How can I verify my warning messages ? I can't find an assertWarnMessages. Even googling 'wicket +assertWarnMessages' returns nothing. Am I missing something ? Many thanks, Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/method-assertWarningMessages-tp26411632p26481845.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: best approach for a criteria and result page
Thank you very much Igor for your answer. You're right, this is working even without any code in the onSubmit() method (in fact I just added one line to manage the visibility of my result WebMarkupContainer). Bernard -Message d'origine- De : Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Envoyé : lundi 9 novembre 2009 17:27 À : users@wicket.apache.org Objet : Re: best approach for a criteria and result page On Mon, Nov 9, 2009 at 6:21 AM, bernard.lu...@orange-ftgroup.com wrote: Hi all, I browsed a lot of wicket example and searched through many articles, but never found this classical web application example : I would have on the same page a form with some criteria, a search button and a result list : I enter some data, hit search and get the results under my criteria, just like google does. No problem for me to define all these parts using wicket components, but I don't know how to manage the workflow, and especially what code should I put in my form's onSubmit method. you dont need to put any code in your onsubmit... class mysearchpage extends webpage { private searchcriteria criteria=new searchcriteria(); public mysearchpage() { add(new searchcriteriaform(form, new propertymodel(this, searchcriteria))); ^ form object connected to the criteria field of this page via a property model add(new listview(results, new propertymodel(this, searchresults)) {...}); ^ listview that will display results retrieved from the getSearchresults() method on this page } public list getSearchresults() { // get whatever results based on the criteria field } } so in short, form pushes your criteria into the criteria field, listview uses the criteria field to build the resultset. yes, its that simple :) -igor Here is a sample code : public class TestPage extends WebPage { public TestPage() { super(); createComponents(); } �...@suppresswarnings(serial) protected void createComponents() { final WebMarkupContainer datacontainer = new WebMarkupContainer(data); FormSearchParameterBean searchForm = new FormSearchParameterBean(searchForm, new CompoundPropertyModelSearchParameterBean(new SearchParameterBean())) { �...@override protected void onSubmit() { SearchParameterBean searchParam = (SearchParameterBean) getModelObject(); // get contract list in a LoadableDetachableModel, but can't give it to ListView IModelListResultParameter contractListModel = new LoadableDetachableModelListResultParameter() { �...@override protected ListResultParameter load() { ListResultParameter contractList = manageContract.getContracts(); return contractList; } }; // This is working, but I must have an inner class and final WebMarkupContainer datacontainer // What to do if I want to create a class ConsultForm extends FormSearchParameterBean datacontainer.setVisible(true); } }; searchForm.add(new TextFieldString(Id)); add(searchForm); datacontainer.setVersioned(false); datacontainer.setVisible(false); add(datacontainer); // here I do not have access to my contractListModel PageableListViewResultParameter listView = new PageableListViewResultParameter(contracts, contractListModel, 10){ �...@override public void populateItem(ListItemResultParameter listItem) { ResultParameter contract = listItem.getModelObject(); Label name = new Label(Name, contract.getName()); listItem.add(name); } }; datacontainer.add(listView); } The questions I have are : - How to pass model between the onSubmit() message which defines it, and the FormView which shows itin the page ? - Do I have to define a setResponsePage() in my onSubmit() ? If I do so, I must go to another page, and then I lost the user's choosen criteria - What is the best practice to build such an application ? - Is there somewhere an example with criteria and results on the same page ? Thank you very much, Bernard - To unsubscribe, e-mail:
method assertWarningMessages
Hi all, Components have 3 methods to put information in a feedback panel : info(), warn() and error(). But in the WicketTester class, there are only 2 asserts available : assertInfoMessages() and assertErrorMessages(). How can I verify my warning messages ? I can't find an assertWarnMessages. Even googling 'wicket +assertWarnMessages' returns nothing. Am I missing something ? Many thanks, Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org