Re: Twitter Bootstrap in Wicket
I guess you're talking about the first conditional comments in the markup of HTML5 Boilerplate ( https://github.com/h5bp/html5-boilerplate/blob/master/index.html). Am I right ? __ Cedric Gatay http://www.bloggure.info | http://cedric.gatay.fr | @Cedric_Gatayhttp://twitter.com/Cedric_Gatay On Fri, Oct 12, 2012 at 6:31 AM, Martin Grigorov mgrigo...@apache.orgwrote: On Fri, Oct 12, 2012 at 5:14 AM, Bruno Borges bruno.bor...@gmail.com wrote: You have to remove though some of the CSS IE conditionals from Twitter bootstrap. They are still not correctly processed by Wicket. :-( No one else had such complaints so far. Me included. *Bruno Borges* (11) 99564-9058 *www.brunoborges.com* On Thu, Oct 11, 2012 at 11:08 PM, Chris Colman chr...@stepaheadsoftware.com wrote: Is it possible/feasible to 'selectively' use the Twitter bootstrap in a wicket app? Scenario: our app serves many different clients. Some will want the Twitter Bootstrap look and feel but others will be happy to use any number of existing CSS/JS templates that we have created for them over the years. Currently we use a combination of Wicket variations and conditional header injection to provide different look and feel for customers even though they all use the same Wicket page classes. Is it possible to use Twitter Bootstrap in the same way? i.e. conditionally use it when rendering a page for one customer but not using it when rendering that same page class for another customer? It sounds like you already have the system for this built. Bootstrap is just HTML and CSS, so keep doing what you were with the variations and different header contributions. Is there something else that you need? Probably not. I guess because it's purely HTML and CSS then it should fit in nicely with our existing HTML/CSS selection code. -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org* - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
ModalDialog - control the location
Hi. We have the requirement that we need to show more than one popup at a time - this means buttons / links in a popup trigger showing other popups (whether it's good style or not is irrelevant, this is a requirement...). We are using ModalWindow for that, and it is always shown in the center of the screen. What we would like to have is to be able to 'stack' windows, where the new one is shown +20 from the top and +20 to the right from the top one: | |_ | | | | | | | | | |_| My idea is to override the center method in a way that: 1. introduces a counter of the windows 2. calls the original method 3. retrieves the top and and left styles, parses them into an integer 4. top = top + counter * 20; left = left + counter * 20 5. sets the style to these new values As I have very, very little knowledge of javascript, I'm failing to implement that. Could I get some help from you? Namely, I have trouble getting accessing the modal window, and its current styles. Regards, wujek
Multiple AjaxLazyLoadingPanel's never load
Hi, all! I have a problem with list of AjaxLazyLoadingPanels. Only the first panel loads, but others never. It's looks like this: http://apache-wicket.1842946.n4.nabble.com/file/n4652907/lazyloading.jpg I need to load N lazyPanels, and I trying to do next: *In Java:* List components = new ArrayList(); for (int i = 0; i 6; i++) { components.add(i); } add(new ListView(list, components) { @Override protected void populateItem(ListItem item) { item.add(new AjaxLazyLoadPanel(ajaxPanel) { @Override public Component getLazyLoadComponent(String markupId) { return new Label(markupId, Simple Label); } }); } }); *In HTML:* div wicket:id=list div wicket:id=ajaxPanel id=ajaxPanel /div /div But this does not works. I tried to set every ALLP's markupId unique, but this led to the fact that even the first element-loaded stoped. Can somebody help me with this problem? Regards, Michael. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Multiple-AjaxLazyLoadingPanel-s-never-load-tp4652907.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: Twitter Bootstrap in Wicket
check this out: https://github.com/decebals/wicket-bootstrap On Fri, Oct 12, 2012 at 8:37 AM, Cedric Gatay gata...@gmail.com wrote: I guess you're talking about the first conditional comments in the markup of HTML5 Boilerplate ( https://github.com/h5bp/html5-boilerplate/blob/master/index.html). Am I right ? __ Cedric Gatay http://www.bloggure.info | http://cedric.gatay.fr | @Cedric_Gatayhttp://twitter.com/Cedric_Gatay On Fri, Oct 12, 2012 at 6:31 AM, Martin Grigorov mgrigo...@apache.org wrote: On Fri, Oct 12, 2012 at 5:14 AM, Bruno Borges bruno.bor...@gmail.com wrote: You have to remove though some of the CSS IE conditionals from Twitter bootstrap. They are still not correctly processed by Wicket. :-( No one else had such complaints so far. Me included. *Bruno Borges* (11) 99564-9058 *www.brunoborges.com* On Thu, Oct 11, 2012 at 11:08 PM, Chris Colman chr...@stepaheadsoftware.com wrote: Is it possible/feasible to 'selectively' use the Twitter bootstrap in a wicket app? Scenario: our app serves many different clients. Some will want the Twitter Bootstrap look and feel but others will be happy to use any number of existing CSS/JS templates that we have created for them over the years. Currently we use a combination of Wicket variations and conditional header injection to provide different look and feel for customers even though they all use the same Wicket page classes. Is it possible to use Twitter Bootstrap in the same way? i.e. conditionally use it when rendering a page for one customer but not using it when rendering that same page class for another customer? It sounds like you already have the system for this built. Bootstrap is just HTML and CSS, so keep doing what you were with the variations and different header contributions. Is there something else that you need? Probably not. I guess because it's purely HTML and CSS then it should fit in nicely with our existing HTML/CSS selection code. -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org* - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Manipulate Form Input After Validation
Hi, On Fri, Oct 12, 2012 at 5:29 AM, weslowsk weslo...@accesscomm.ca wrote: Thanks for the suggestions... What if I wanted to conditionally upper case the text field? Would a converter work then? For example, if the validation fails, upper case the string; otherwise, leave the string as is. Yes, you can use textField.isValid() to check it. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Manipulate-Form-Input-After-Validation-tp4652855p4652901.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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket 6 AjaxCheckBox#onUpdate method not called
Hey guys Got a problem with my checkbox in wicket 6.1 This code worked in 1.5 so my question is .. what am I doing wrong .. when I click on it, onUpdate method is not called ... any suggestions would be nice ... overriding method wantOnSelectionChangedNotifications() doesn't help either ... Regards Armando -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-6-AjaxCheckBox-onUpdate-method-not-called-tp4652910.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 file download...
So what I'm trying to do must surely be a common thing... yet so far I have had no luck getting it to work. I'm generating big PDF's on the server .. and in the browser I have a link that should initiate that generation and bring up a file 'save-as' dialog when the PDF is ready to be downloaded. While the generation phase is going on, I want to use jQuery.blockUI to stop the user from doing anything else in the app. I've got two issues: 1. Wicket.Ajax.Get is asynchronous by default, so the 'success' callback gets hit right away. I'm using a decorator (as described in Igor's cookbook) to block/unblock the UI via jQuery.blockUI. The ajax call fires off and comes right back, unblocking the UI well before the PDF generation finishes (I kick that off in the ajax link's onclick handler). If there is a way to make the ajax call synchronous 'on the fly', then this problem would go away. I know how to do it in pure jQuery, but I don't know how to do it 'the wicket way' .. I looked at AbstractDefaultAjaxHandler and i'm currently studying the wicket javascript code, but if somebody knows a way to do this please do let me know .. :) 2. ByteArrayResource .. is somewhat inconvenient (for me).. The filename member is private final and you can only set it at construction time. You can provide the byte[] whenever you like though. This seems odd to me.. because if you are overriding getBytes() you probably are doing that because you didn't have the byte content at construction time and, if you are doing what i'm doing, ie creating a file and getting the bytes from that, you probably wouldn't have the filename of the file until post-construction time either... I think there should be overrides for both the bytes *and* the filename...? TIA -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-file-download-tp4652911.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 file download...
Hi, On Fri, Oct 12, 2012 at 10:35 AM, mlabs mlabs@gmail.com wrote: So what I'm trying to do must surely be a common thing... yet so far I have had no luck getting it to work. I'm generating big PDF's on the server .. and in the browser I have a link that should initiate that generation and bring up a file 'save-as' dialog when the PDF is ready to be downloaded. While the generation phase is going on, I want to use jQuery.blockUI to stop the user from doing anything else in the app. 1-AJAX start PDF generation, on a different thread and retunr script to block UI, plus AJAX timer that will poll the server for PDF generation status. 2-Once PDF generation is finished, AJAX timer will unblock the UI and trigger AJAX download (and disable timer). -- Regards - Ernesto Reinaldo Barreiro Antilia Soft http://antiliasoft.com
Re: ajax file download...
you could even display a progress bar indicator so that your users are aware of how much it is left. On Fri, Oct 12, 2012 at 10:46 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi, On Fri, Oct 12, 2012 at 10:35 AM, mlabs mlabs@gmail.com wrote: So what I'm trying to do must surely be a common thing... yet so far I have had no luck getting it to work. I'm generating big PDF's on the server .. and in the browser I have a link that should initiate that generation and bring up a file 'save-as' dialog when the PDF is ready to be downloaded. While the generation phase is going on, I want to use jQuery.blockUI to stop the user from doing anything else in the app. 1-AJAX start PDF generation, on a different thread and retunr script to block UI, plus AJAX timer that will poll the server for PDF generation status. 2-Once PDF generation is finished, AJAX timer will unblock the UI and trigger AJAX download (and disable timer). -- Regards - Ernesto Reinaldo Barreiro Antilia Soft http://antiliasoft.com -- Regards - Ernesto Reinaldo Barreiro Antilia Soft http://antiliasoft.com
Re: Wicket 6 AjaxCheckBox#onUpdate method not called
Found the issue .. has nothing to do with wicket not working ! Sorry ! Regards Armando -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-6-AjaxCheckBox-onUpdate-method-not-called-tp4652910p4652914.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 file download...
hmm.. no .. sounds too complicated ... I don't want to get into spawning threads and polling .. In jQuery you can use $.ajax({url:'my-pdf resource-url',async:false,success...,error...}) and wire blockUI into the success/error handlers.. that worked great except the save-as dialog didn't come up - even though in my PDFSharedResource I was setting content-disposition to attachment... It seems to me that this 'synchronous' flag should be exposed in the wicket javascript somehow... But I haven't found it yet... only just started digging into this code... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-file-download-tp4652911p4652915.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 file download...
I know, but the idea of the user being able to click around the web page and possibly navigate to other areas of the app... and then minutes later the save-as dialog suddenly pops up .. seems to me to be potentially confusing... which is why I like blockUI ... it lets them know that as soon as they click the download link .. something is happening... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-file-download-tp4652911p4652917.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 6 AjaxCheckBox#onUpdate method not called
If someone ever needs it I'm using Sscrew Default Buttons http://www.screwdefaultbuttons.com/ plugin for jQuery which hides default input (checkbox) field and shows pictures over it. The problem was with click event never triggered on input field but only on element over the checkbox field. This code helped fixing the problem. First you have to change the checked property of the input field AjaxCheckBox#onUpdate method is then called ;) Regards Armando -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-6-AjaxCheckBox-onUpdate-method-not-called-tp4652910p4652918.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: ModalDialog - control the location
Hm, this from something I did (uses jquery): public class ModalDialogPanel extends ModalWindow { ... public enum Position { TR, TL, BR, BL } ... /** * @param target * @param component Element to use for position of popup. */ public void open(AjaxRequestTarget target, Component component) { open(target, component, Position.TL); } public void open(AjaxRequestTarget target, Component component, Position position) { open(target); String left = , top = ; switch (position) { case TL: left = pos.left; top = pos.top + ch/2; break; case TR: left = pos.left - ow + cw; top = pos.top + ch/2; break; case BL: left = pos.left; top = pos.top + ch/2 - oh; break; case BR: left = pos.left - ow + cw; top = pos.top + ch/2 - oh; break; } target.appendJavaScript( ( + $f( var pos = + $(component).offset(), var ch = + $(component).outerHeight(), var cw = + $(component).outerWidth(), var width = $(window).width(), var height = $(window).height(), var w = Wicket.Window.get();, var ow = w.window.offsetWidth, var oh = w.window.offsetHeight, var left = + left, var top = + top, left = Math.max(0,Math.min(left,width-ow)), top = Math.max(0,Math.min(top,height-oh)), w.window.style.left=left+'px';, w.window.style.top=top+'px'; )+)();); } } -Original Message- From: Wujek Srujek [mailto:wujek.sru...@gmail.com] Sent: Friday, October 12, 2012 8:56 AM To: users@wicket.apache.org Subject: ModalDialog - control the location Hi. We have the requirement that we need to show more than one popup at a time - this means buttons / links in a popup trigger showing other popups (whether it's good style or not is irrelevant, this is a requirement...). We are using ModalWindow for that, and it is always shown in the center of the screen. What we would like to have is to be able to 'stack' windows, where the new one is shown +20 from the top and +20 to the right from the top one: | |_ | | | | | | | | | |_| My idea is to override the center method in a way that: 1. introduces a counter of the windows 2. calls the original method 3. retrieves the top and and left styles, parses them into an integer 4. top = top + counter * 20; left = left + counter * 20 5. sets the style to these new values As I have very, very little knowledge of javascript, I'm failing to implement that. Could I get some help from you? Namely, I have trouble getting accessing the modal window, and its current styles. Regards, wujek - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Multiple AjaxLazyLoadingPanel's never load
Hi, I'm not sure why it stops but I see another problem in it. There is synchronization when using the page instance, i.e. the first Ajax call will acquire the lock on the page and all other requests will have to wait it to release it. So the ALLPs will load sequentially. How to solve this? It depends on the type of data you need to load. You can use Wicket IResource which is not locked like Page, or Atmosphere/Native Web Sockets to push the data when ready. On Fri, Oct 12, 2012 at 10:24 AM, Michael Zhavzharov mzhavzha...@alee.ru wrote: Hi, all! I have a problem with list of AjaxLazyLoadingPanels. Only the first panel loads, but others never. It's looks like this: http://apache-wicket.1842946.n4.nabble.com/file/n4652907/lazyloading.jpg I need to load N lazyPanels, and I trying to do next: *In Java:* List components = new ArrayList(); for (int i = 0; i 6; i++) { components.add(i); } add(new ListView(list, components) { @Override protected void populateItem(ListItem item) { item.add(new AjaxLazyLoadPanel(ajaxPanel) { @Override public Component getLazyLoadComponent(String markupId) { return new Label(markupId, Simple Label); } }); } }); *In HTML:* div wicket:id=list div wicket:id=ajaxPanel id=ajaxPanel /div /div But this does not works. I tried to set every ALLP's markupId unique, but this led to the fact that even the first element-loaded stoped. Can somebody help me with this problem? Regards, Michael. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Multiple-AjaxLazyLoadingPanel-s-never-load-tp4652907.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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
refresh ajaxlazyloadpanel
Hello, I'm using an ajaxlazyloadpanel and I already read that instantiating a new instance is the way to 'refresh' the panel. But my question is where do you think is the most appropriate/elegant way to do so when I have various different places in my page that reloads the panel's parent form, without duplicating code and keeping it simple for future new places that reloads the form. Hope I was clear. thanks Lucas Kuperman PS: wicket 1.4.15 -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/refresh-ajaxlazyloadpanel-tp4652923.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
Coming Error in Wicket 6.1.1 during Migration from 1.5.6
in these days i am migrating one my wicket project from 1.5.6 to wicket 6.1.1 stable. for that i have download stable release and remove all compile time errors but now when i run the project i get following error: *java.lang.NoClassDefFoundError: javax/inject/Inject at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.supportsField(AnnotProxyFieldValueFactory.java:304)* i am using spring 2.5.6 version and wicket 6.1.1 http://apache-wicket.1842946.n4.nabble.com/file/n4652875/Screenshot_2.png please tell me the the solution for that as i need to download any dependancy jar or other thing. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Coming-Error-in-Wicket-6-1-1-during-Migration-from-1-5-6-tp4652875.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: Coming Error in Wicket 6.1.1 during Migration from 1.5.6
Hi, You need to add dependency groupIdjavax.inject/groupId artifactIdjavax.inject/artifactId version1/version /dependency It comes with Spring 3+. On Thu, Oct 11, 2012 at 12:43 PM, Nitin khandelwal nikeiiim2...@gmail.com wrote: in these days i am migrating one my wicket project from 1.5.6 to wicket 6.1.1 stable. for that i have download stable release and remove all compile time errors but now when i run the project i get following error: *java.lang.NoClassDefFoundError: javax/inject/Inject at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.supportsField(AnnotProxyFieldValueFactory.java:304)* i am using spring 2.5.6 version and wicket 6.1.1 http://apache-wicket.1842946.n4.nabble.com/file/n4652875/Screenshot_2.png please tell me the the solution for that as i need to download any dependancy jar or other thing. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Coming-Error-in-Wicket-6-1-1-during-Migration-from-1-5-6-tp4652875.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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Multiple AjaxLazyLoadingPanel's never load
Hi, Martin! Thank You for your reply. I realized, that it is not an option for me to use ALLP. I need to load different data - Labels, Link and Image in one lazy panel, also I should be able to interact with other components in page, while ALLP loads it's content. You can use Wicket IResource which is not locked like Page, I don't understand how to use IResource instead of Page. As I know IResource could carry an image, or css, and is not used like MarkupContainer. Am I wrong? Atmosphere/Native Web Sockets to push the data when ready It seems to me, that time has come to learn sockets. Nevertheless, it is interesting to understand the problem with ALLP. I put sleep() into getLazyLoadComponent method and set different Models for returned Label. After starting the app I saw, that every ALLP changes first generated Label to it's own. It's looks like this: Label1 Label2 Label3 * become * become * * * * I think all the same that the matter is in markupId, but can't fix it. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Multiple-AjaxLazyLoadPanel-s-never-load-tp4652907p4652925.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 file download...
The way I did it - I created a panel to be used by all reports. It uses IndicatingAjaxButton for Generate Report button which starts report generation in thread and adds AjaxSelfUpdating behaviour to the button panel. Once generation is finished, previously invisible Download Report button is enabled, which uses standard non-ajax DownloadLink to allow user to Download report. On 10/12/2012 12:19 PM, mlabs wrote: I know, but the idea of the user being able to click around the web page and possibly navigate to other areas of the app... and then minutes later the save-as dialog suddenly pops up .. seems to me to be potentially confusing... which is why I like blockUI ... it lets them know that as soon as they click the download link .. something is happening... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-file-download-tp4652911p4652917.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket + Guice + unittests
Dan, I'm not talking about my application. I'm talking about unittests. I've followed the Guice recommended way to integrate with servlets using the GuiceFilter. Now I'm trying to make the Wicket unittests work and I need the injector to be available in WicketTester. Daniel On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: For what it's worth, we instantiate our applications through Guice. Having your application go get its Injector kind of violates the DI concept. filter(/*).through(WicketFilter.class); bind(WebApplication.class).to(CustomWebApplication.class); bind(WicketFilter.class).to(CustomWicketFilter.class); @Singleton private static class CustomFilter extends WicketFilter { @Inject private ProviderWebApplication webApplicationProvider; @Override protected IWebApplicationFactory getApplicationFactory() { return new IWebApplicationFactory() { @Override public WebApplication createApplication(WicketFilter filter) { return webApplicationProvider.get(); } @Override public void destroy(WicketFilter filter) { } }; } } On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I think you're right. Since in the WicketApplication init() function I attempt to get the bootStrapInjector like this: Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); I just can't figure out how to get the injector into the ServletContext before init() is run in my WicketApplication. Daniel On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Daniel, What you're doing should work, but I think you're giving your GuiceComponentInjector a null Injector. Unit tests don't go through web.xml to set up its context listeners, so your GuiceServletContextListener never has a chance to construct and register an Injector with the ServletContext. Dan On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Hi, I've integrated Guice into Wicket successfully, but I'm struggling with the unittests. I'm not sure how to get the injector into my HomePage class. Here's my setup. I'm using GuiceFilter with a GuiceServletContextListener. That creates the injector and a ServletModule which defines the WicketApplication. I followed: http://code.google.com/p/google-guice/wiki/ServletModule Here's some of MyGuiceServletConfig extends GuiceServletContextListener @Override protected Injector getInjector() { return Guice.createInjector(createServletModule(), new MongoHoneybadgerModule()); } private ServletModule createServletModule() { return new ServletModule() { ... In my WicketApplication extends WebApplication I have this init() method @Override public void init() { super.init(); Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); getComponentInstantiationListeners().add(new GuiceComponentInjector(this, bootStrapInjector)); } Now, in my HomePage.java class I have public class HomePage extends WebPage { private static final long serialVersionUID = 1L; @Inject private Injector injector; public HomePage(final PageParameters parameters) { super(parameters); SomeType myobj = injector.getInstance(SomeType.class); add(new Label(version, myobj.getValue())); } } This all runs great inside a web container as a servlet. The PROBLEM: I'm getting a NullPointerException on the line where I reference the injector: SomeType myobj = injector.getInstance(SomeType.class); My test class is what was generated by the wicket quickstart. I'm not sure how to make an injector available in setUp. @Before public void setUp() { tester = new WicketTester(new WicketApplication()); } Any ideas? Thanks, Daniel - 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: ajax file download...
ok i like the idea of enabling the download button upon completion of generation - I will have a go at doing something similar. But it seems to me that if there was a way to switch the ajax call to be synchronous 'on the fly' then there would be no need for polling with ajax timers (selfupdaingbehaviors) .. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ajax-file-download-tp4652911p4652928.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 + Guice + unittests
I follow you. WicketTester doesn't know about GuiceFilter, so you'll need a different way of getting your Injector into your Wicket Application. Rather than getting the Injector from your servlet context attributes, I'm suggesting that you let Guice instantiate your Application so you can @Inject the injector like any other dependency. The binding code I posted previously does the (non-test) setup; for the test itself it's as simple as https://gist.github.com/3880246. Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks for that. :) On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I'm not talking about my application. I'm talking about unittests. I've followed the Guice recommended way to integrate with servlets using the GuiceFilter. Now I'm trying to make the Wicket unittests work and I need the injector to be available in WicketTester. Daniel On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: For what it's worth, we instantiate our applications through Guice. Having your application go get its Injector kind of violates the DI concept. filter(/*).through(WicketFilter.class); bind(WebApplication.class).to(CustomWebApplication.class); bind(WicketFilter.class).to(CustomWicketFilter.class); @Singleton private static class CustomFilter extends WicketFilter { @Inject private ProviderWebApplication webApplicationProvider; @Override protected IWebApplicationFactory getApplicationFactory() { return new IWebApplicationFactory() { @Override public WebApplication createApplication(WicketFilter filter) { return webApplicationProvider.get(); } @Override public void destroy(WicketFilter filter) { } }; } } On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I think you're right. Since in the WicketApplication init() function I attempt to get the bootStrapInjector like this: Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); I just can't figure out how to get the injector into the ServletContext before init() is run in my WicketApplication. Daniel On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Daniel, What you're doing should work, but I think you're giving your GuiceComponentInjector a null Injector. Unit tests don't go through web.xml to set up its context listeners, so your GuiceServletContextListener never has a chance to construct and register an Injector with the ServletContext. Dan On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Hi, I've integrated Guice into Wicket successfully, but I'm struggling with the unittests. I'm not sure how to get the injector into my HomePage class. Here's my setup. I'm using GuiceFilter with a GuiceServletContextListener. That creates the injector and a ServletModule which defines the WicketApplication. I followed: http://code.google.com/p/google-guice/wiki/ServletModule Here's some of MyGuiceServletConfig extends GuiceServletContextListener @Override protected Injector getInjector() { return Guice.createInjector(createServletModule(), new MongoHoneybadgerModule()); } private ServletModule createServletModule() { return new ServletModule() { ... In my WicketApplication extends WebApplication I have this init() method @Override public void init() { super.init(); Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); getComponentInstantiationListeners().add(new GuiceComponentInjector(this, bootStrapInjector)); } Now, in my HomePage.java class I have public class HomePage extends WebPage { private static final long serialVersionUID = 1L; @Inject private Injector injector; public HomePage(final PageParameters parameters) { super(parameters); SomeType myobj = injector.getInstance(SomeType.class); add(new Label(version, myobj.getValue())); } } This all runs great inside a web container as a servlet. The PROBLEM: I'm getting a NullPointerException on the line where I reference the injector: SomeType myobj = injector.getInstance(SomeType.class); My test class is what was generated by the wicket quickstart. I'm not sure how to make an injector available in setUp. @Before public void setUp() { tester = new WicketTester(new WicketApplication()); } Any ideas? Thanks, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail:
Re: Wicket + Guice + unittests
Dan, Thanks. I've got unittests running now, but the WicketFilter doesn't seem to be processing. All I get when I run the applicaiton shows a jetty produced directory listing. In the snippet you provided before I think that CustomFilter and CustomeWicketFilter should be the same thing. Is that right? In my previous approach, when I bound the WicketFilter I included some parameters, like this: filter(/*).through(WicketFilter.class, createWicketFilterInitParams()); With this function private MapString, String createWicketFilterInitParams() { MapString, String wicketFilterParams = new HashMapString, String(); wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*); wicketFilterParams.put(applicationClassName, com.hp.honeybadger.web.WicketApplication); return wicketFilterParams; } I'm now trying to figure out how to make sure that the wicket filter is called... Daniel On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com wrote: I follow you. WicketTester doesn't know about GuiceFilter, so you'll need a different way of getting your Injector into your Wicket Application. Rather than getting the Injector from your servlet context attributes, I'm suggesting that you let Guice instantiate your Application so you can @Inject the injector like any other dependency. The binding code I posted previously does the (non-test) setup; for the test itself it's as simple as https://gist.github.com/3880246. Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks for that. :) On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I'm not talking about my application. I'm talking about unittests. I've followed the Guice recommended way to integrate with servlets using the GuiceFilter. Now I'm trying to make the Wicket unittests work and I need the injector to be available in WicketTester. Daniel On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: For what it's worth, we instantiate our applications through Guice. Having your application go get its Injector kind of violates the DI concept. filter(/*).through(WicketFilter.class); bind(WebApplication.class).to(CustomWebApplication.class); bind(WicketFilter.class).to(CustomWicketFilter.class); @Singleton private static class CustomFilter extends WicketFilter { @Inject private ProviderWebApplication webApplicationProvider; @Override protected IWebApplicationFactory getApplicationFactory() { return new IWebApplicationFactory() { @Override public WebApplication createApplication(WicketFilter filter) { return webApplicationProvider.get(); } @Override public void destroy(WicketFilter filter) { } }; } } On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I think you're right. Since in the WicketApplication init() function I attempt to get the bootStrapInjector like this: Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); I just can't figure out how to get the injector into the ServletContext before init() is run in my WicketApplication. Daniel On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Daniel, What you're doing should work, but I think you're giving your GuiceComponentInjector a null Injector. Unit tests don't go through web.xml to set up its context listeners, so your GuiceServletContextListener never has a chance to construct and register an Injector with the ServletContext. Dan On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Hi, I've integrated Guice into Wicket successfully, but I'm struggling with the unittests. I'm not sure how to get the injector into my HomePage class. Here's my setup. I'm using GuiceFilter with a GuiceServletContextListener. That creates the injector and a ServletModule which defines the WicketApplication. I followed: http://code.google.com/p/google-guice/wiki/ServletModule Here's some of MyGuiceServletConfig extends GuiceServletContextListener @Override protected Injector getInjector() { return Guice.createInjector(createServletModule(), new MongoHoneybadgerModule()); } private ServletModule createServletModule() { return new ServletModule() { ... In my WicketApplication extends WebApplication I have this init() method @Override public void init() { super.init(); Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); getComponentInstantiationListeners().add(new GuiceComponentInjector(this, bootStrapInjector)); } Now, in my HomePage.java class I have public class HomePage extends WebPage {
Re: Wicket + Guice + unittests
Yes, CustomFilter = CustomWicketFilter... Those aren't our actual names. And yes, we provide filter parameters too. I just omitted them since they weren't relevant to the Guice-based application instantiation I was describing. Do you have this in your web.xml? filter filter-nameguiceFilter/filter-name filter-classcom.google.inject.servlet.GuiceFilter/filter-class /filter filter-mapping filter-nameguiceFilter/filter-name url-pattern/*/url-pattern /filter-mapping On Fri, Oct 12, 2012 at 6:01 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, Thanks. I've got unittests running now, but the WicketFilter doesn't seem to be processing. All I get when I run the applicaiton shows a jetty produced directory listing. In the snippet you provided before I think that CustomFilter and CustomeWicketFilter should be the same thing. Is that right? In my previous approach, when I bound the WicketFilter I included some parameters, like this: filter(/*).through(WicketFilter.class, createWicketFilterInitParams()); With this function private MapString, String createWicketFilterInitParams() { MapString, String wicketFilterParams = new HashMapString, String(); wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*); wicketFilterParams.put(applicationClassName, com.hp.honeybadger.web.WicketApplication); return wicketFilterParams; } I'm now trying to figure out how to make sure that the wicket filter is called... Daniel On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com wrote: I follow you. WicketTester doesn't know about GuiceFilter, so you'll need a different way of getting your Injector into your Wicket Application. Rather than getting the Injector from your servlet context attributes, I'm suggesting that you let Guice instantiate your Application so you can @Inject the injector like any other dependency. The binding code I posted previously does the (non-test) setup; for the test itself it's as simple as https://gist.github.com/3880246. Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks for that. :) On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I'm not talking about my application. I'm talking about unittests. I've followed the Guice recommended way to integrate with servlets using the GuiceFilter. Now I'm trying to make the Wicket unittests work and I need the injector to be available in WicketTester. Daniel On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: For what it's worth, we instantiate our applications through Guice. Having your application go get its Injector kind of violates the DI concept. filter(/*).through(WicketFilter.class); bind(WebApplication.class).to(CustomWebApplication.class); bind(WicketFilter.class).to(CustomWicketFilter.class); @Singleton private static class CustomFilter extends WicketFilter { @Inject private ProviderWebApplication webApplicationProvider; @Override protected IWebApplicationFactory getApplicationFactory() { return new IWebApplicationFactory() { @Override public WebApplication createApplication(WicketFilter filter) { return webApplicationProvider.get(); } @Override public void destroy(WicketFilter filter) { } }; } } On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I think you're right. Since in the WicketApplication init() function I attempt to get the bootStrapInjector like this: Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); I just can't figure out how to get the injector into the ServletContext before init() is run in my WicketApplication. Daniel On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Daniel, What you're doing should work, but I think you're giving your GuiceComponentInjector a null Injector. Unit tests don't go through web.xml to set up its context listeners, so your GuiceServletContextListener never has a chance to construct and register an Injector with the ServletContext. Dan On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Hi, I've integrated Guice into Wicket successfully, but I'm struggling with the unittests. I'm not sure how to get the injector into my HomePage class. Here's my setup. I'm using GuiceFilter with a GuiceServletContextListener. That creates the injector and a ServletModule which defines the WicketApplication. I followed: http://code.google.com/p/google-guice/wiki/ServletModule Here's some of MyGuiceServletConfig extends GuiceServletContextListener @Override protected Injector getInjector() {
Re: Wicket + Guice + unittests
yes, that's what I have in my web.xml On Fri, Oct 12, 2012 at 12:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Yes, CustomFilter = CustomWicketFilter... Those aren't our actual names. And yes, we provide filter parameters too. I just omitted them since they weren't relevant to the Guice-based application instantiation I was describing. Do you have this in your web.xml? filter filter-nameguiceFilter/filter-name filter-classcom.google.inject.servlet.GuiceFilter/filter-class /filter filter-mapping filter-nameguiceFilter/filter-name url-pattern/*/url-pattern /filter-mapping On Fri, Oct 12, 2012 at 6:01 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, Thanks. I've got unittests running now, but the WicketFilter doesn't seem to be processing. All I get when I run the applicaiton shows a jetty produced directory listing. In the snippet you provided before I think that CustomFilter and CustomeWicketFilter should be the same thing. Is that right? In my previous approach, when I bound the WicketFilter I included some parameters, like this: filter(/*).through(WicketFilter.class, createWicketFilterInitParams()); With this function private MapString, String createWicketFilterInitParams() { MapString, String wicketFilterParams = new HashMapString, String(); wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*); wicketFilterParams.put(applicationClassName, com.hp.honeybadger.web.WicketApplication); return wicketFilterParams; } I'm now trying to figure out how to make sure that the wicket filter is called... Daniel On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com wrote: I follow you. WicketTester doesn't know about GuiceFilter, so you'll need a different way of getting your Injector into your Wicket Application. Rather than getting the Injector from your servlet context attributes, I'm suggesting that you let Guice instantiate your Application so you can @Inject the injector like any other dependency. The binding code I posted previously does the (non-test) setup; for the test itself it's as simple as https://gist.github.com/3880246. Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks for that. :) On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I'm not talking about my application. I'm talking about unittests. I've followed the Guice recommended way to integrate with servlets using the GuiceFilter. Now I'm trying to make the Wicket unittests work and I need the injector to be available in WicketTester. Daniel On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: For what it's worth, we instantiate our applications through Guice. Having your application go get its Injector kind of violates the DI concept. filter(/*).through(WicketFilter.class); bind(WebApplication.class).to(CustomWebApplication.class); bind(WicketFilter.class).to(CustomWicketFilter.class); @Singleton private static class CustomFilter extends WicketFilter { @Inject private ProviderWebApplication webApplicationProvider; @Override protected IWebApplicationFactory getApplicationFactory() { return new IWebApplicationFactory() { @Override public WebApplication createApplication(WicketFilter filter) { return webApplicationProvider.get(); } @Override public void destroy(WicketFilter filter) { } }; } } On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I think you're right. Since in the WicketApplication init() function I attempt to get the bootStrapInjector like this: Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); I just can't figure out how to get the injector into the ServletContext before init() is run in my WicketApplication. Daniel On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Daniel, What you're doing should work, but I think you're giving your GuiceComponentInjector a null Injector. Unit tests don't go through web.xml to set up its context listeners, so your GuiceServletContextListener never has a chance to construct and register an Injector with the ServletContext. Dan On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Hi, I've integrated Guice into Wicket successfully, but I'm struggling with the unittests. I'm not sure how to get the injector into my HomePage class. Here's my setup. I'm using GuiceFilter with a GuiceServletContextListener. That creates the injector and a ServletModule which defines the WicketApplication. I followed: http://code.google.com/p/google-guice/wiki/ServletModule Here's some of