Re: Another same probleme with wicket:enclosure tag[SOLVED]
Hi !! Ok for closing this topic. I created a custom panel. and the PanelAgent.html like this. //In web Page class private PanelAgent panelInfosAgent = new PanelAgent(panelInfosAgent,new ModelAgent(Agent.emptyAgent())){ @Override protected void onConfigure(){ if (agentBySesame==null){ this.setVisible(false); } else { setVisible(true); } } }; Then in the web page html wicket:enclosure child=panelInfosAgent div wicket:id=panelInfosAgent/div /wicket:enclosure /div And it works as expected. That's a best pratices I think. Next time. Selom wrote When formulaireRechercheAgent is submitted, formulaireAgent come with * null value model. * Do you mind tell me what wrong with this code ? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Another-same-probleme-with-wicket-enclosure-tag-tp4662371p4662425.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
Conditionally include header item when page contains ajax components
Hi all, I have a base page from which all my pages inherit. I want to conditionally include a javascript reference (header item) if the page contains an ajax component. The reference is a veil implementation based on BlockUI which is redundant (and also causes a javascript error) if the page has not ajax (and hence JQuery is not loaded). Any suggestions? Thanks Marios
Re: Get return value of ajax event in Wicket 6.9.1
Hi, now everything works perfect, thank you I am so happy. Best Regards Daniela 2013/11/14 Martin Grigorov mgrigo...@apache.org Hi, mySubmitButton.add(AttributeAppender.append(onclick, window.dontAsk = true; return true;)) response.render(new OnDomReadyHeaderItem(window.onbeforeunload = function (e) { + if (!window.dontAsk) { + + var message = 'Your confirmation message goes here.', + e = e || window.event; + if (e) { + e.returnValue = message; + } + return message; + } + };)); On Wed, Nov 13, 2013 at 4:12 PM, Daniela L danigal...@gmail.com wrote: Hi, I am sorry I don't get it. How and when to set the JS variable? Like this: mySubmitButton.add(new AjaxEventBehavior(onclick) { @Override protected void onEvent(AjaxRequestTarget target) { AjaxRequestAttributes ajaxRequestAttributes = new AjaxRequestAttributes(); CharSequence dynamicExtraParameters = var enableEvent = false;; ajaxRequestAttributes.getDynamicExtraParameters().add(dynamicExtraParameters) pageExitWarningBehavior.updateAjaxAttributes(ajaxRequestAttributes); } }); And which onBeforeRender, the one of the TextField? Best Regards Daniela 2013/11/13 Martin Grigorov mgrigo...@apache.org Hi, #onSubmit() would be called after the user agrees to leave the page. You can set some JS variable/flag when the submit button is used and depending on this flag do not ask for confirmation in onbeforerender. On Wed, Nov 13, 2013 at 10:02 AM, Daniela L danigal...@gmail.com wrote: Hi, I have another problem regarding this question. Now every time the page is left the message Do you want to leave the page is popping up, but when the user correctly fills the form on the page and hits the submit button he should be redirected to another page showing the result of his input. I have tryed this to remove the behavior for a correct submit but the message is still popping up: mySubmitButton = new Button(mySubmitButton ) { @Override public void onSubmit() { try { myTextField.remove(pageExitWarningBehavior); //tryed both //pageExitWarningBehavior.detach(myTextField); } }; 2013/11/12 Daniela L danigal...@gmail.com Hi, thank you so much for your help this works fantastic. I am so happy I was trying around with this for days :-) 2013/11/11 Martin Grigorov mgrigo...@apache.org respond() is the callback method that Wicket will notify. But you need to trigger an Ajax call first. This is done with the Wicket Ajax API: Wicket.Ajax.get(...). Just try with the line I've added in your JS code On Mon, Nov 11, 2013 at 4:04 PM, Daniela L danigal...@gmail.com wrote: I thought adding respond was the ajax call to the server, am I wrong? I didn't work much with ajax, i am sorry 2013/11/11 Martin Grigorov mgrigo...@apache.org Did you do what I suggested you ? On Mon, Nov 11, 2013 at 3:49 PM, Daniela L danigal...@gmail.com wrote: Hi, I have tryed to change to AbstractDefaultAjaxBehavior like I described below, but respond is never called. What am I doing wrong? Hi, as far as I have understood this can only be achieved, if I subclass AbstractDefaultAjaxBehavior like this? public class PageExitWarningBehavior extends AbstractDefaultAjaxBehavior { @Override protected void respond(AjaxRequestTarget target) { AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent(); } Hi, You need to make an Ajax call to the server. On Mon, Nov 11, 2013 at 2:10 PM, Daniela L danigal...@gmail.com danigal...@gmail.comdanigal...@gmail.com danigal...@gmail.com wrote: Hi, this is my first question, so i hope I get everything right. I am trying to catch the event of the user closing the browser window in wicket. I followed this example: http://stackoverflow.com/questions/16527463/call-java-component-from-javascript-and-retreive-value and I managed to get the example working so the message is displayed, but I have no idea how to get the event triggered by the javascript function in wicket. I need this because when the user
Re: Conditionally include header item when page contains ajax components
Hi Marios, IMO the best way IMO is to make your js reference extending JQueryPluginResourceReference (wicket 6) Best regards, Sebastien. On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.com wrote: Hi all, I have a base page from which all my pages inherit. I want to conditionally include a javascript reference (header item) if the page contains an ajax component. The reference is a veil implementation based on BlockUI which is redundant (and also causes a javascript error) if the page has not ajax (and hence JQuery is not loaded). Any suggestions? Thanks Marios
Re: Conditionally include header item when page contains ajax components
oops, seems that one IMO is enough... On Thu, Nov 14, 2013 at 1:04 PM, Sebastien seb...@gmail.com wrote: Hi Marios, IMO the best way IMO is to make your js reference extending JQueryPluginResourceReference (wicket 6) Best regards, Sebastien. On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.comwrote: Hi all, I have a base page from which all my pages inherit. I want to conditionally include a javascript reference (header item) if the page contains an ajax component. The reference is a veil implementation based on BlockUI which is redundant (and also causes a javascript error) if the page has not ajax (and hence JQuery is not loaded). Any suggestions? Thanks Marios
Re: Conditionally include header item when page contains ajax components
If I'm not mistaken this will cause JQuery to be included whenever my js reference is included. Effectively this will cause non-ajax pages to load javascript which applies only to ajax requests. What I want is the opposite: to not include my js reference when the page does not have any ajax. On Thu, Nov 14, 2013 at 2:04 PM, Sebastien seb...@gmail.com wrote: Hi Marios, IMO the best way IMO is to make your js reference extending JQueryPluginResourceReference (wicket 6) Best regards, Sebastien. On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.com wrote: Hi all, I have a base page from which all my pages inherit. I want to conditionally include a javascript reference (header item) if the page contains an ajax component. The reference is a veil implementation based on BlockUI which is redundant (and also causes a javascript error) if the page has not ajax (and hence JQuery is not loaded). Any suggestions? Thanks Marios
Re: Conditionally include header item when page contains ajax components
Hi, You can create custom IHeaderResponseDecorator and by using custom IHeaderResponse you can check for contributions of org.apache.wicket.ajax.WicketAjaxJQueryResourceReference See http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/?0 and http://wicketinaction.com/2012/07/wicket-6-resource-management/ On Thu, Nov 14, 2013 at 2:59 PM, Marios Skounakis msc...@gmail.com wrote: If I'm not mistaken this will cause JQuery to be included whenever my js reference is included. Effectively this will cause non-ajax pages to load javascript which applies only to ajax requests. What I want is the opposite: to not include my js reference when the page does not have any ajax. On Thu, Nov 14, 2013 at 2:04 PM, Sebastien seb...@gmail.com wrote: Hi Marios, IMO the best way IMO is to make your js reference extending JQueryPluginResourceReference (wicket 6) Best regards, Sebastien. On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.com wrote: Hi all, I have a base page from which all my pages inherit. I want to conditionally include a javascript reference (header item) if the page contains an ajax component. The reference is a veil implementation based on BlockUI which is redundant (and also causes a javascript error) if the page has not ajax (and hence JQuery is not loaded). Any suggestions? Thanks Marios
Re: Conditionally include header item when page contains ajax components
The javascript will only be included if your Ajax enabled component is included that in turn references the JS ResourceReference, otherwise it wont be. N On Thu, Nov 14, 2013 at 7:59 AM, Marios Skounakis msc...@gmail.com wrote: If I'm not mistaken this will cause JQuery to be included whenever my js reference is included. Effectively this will cause non-ajax pages to load javascript which applies only to ajax requests. What I want is the opposite: to not include my js reference when the page does not have any ajax. On Thu, Nov 14, 2013 at 2:04 PM, Sebastien seb...@gmail.com wrote: Hi Marios, IMO the best way IMO is to make your js reference extending JQueryPluginResourceReference (wicket 6) Best regards, Sebastien. On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.com wrote: Hi all, I have a base page from which all my pages inherit. I want to conditionally include a javascript reference (header item) if the page contains an ajax component. The reference is a veil implementation based on BlockUI which is redundant (and also causes a javascript error) if the page has not ajax (and hence JQuery is not loaded). Any suggestions? Thanks Marios
Re: Conditionally include header item when page contains ajax components
Then you're doing something odd :-) If you have dependencies like this: CustomComponent -- Custom JS Reference (and this is added in the public void renderHead( Component component, IHeaderResponse response ) method) -- Wicket's JQuery JS Reference Page A (no Ajax components or components depending on Wicket's jquery ref) Page B -- CustomComponent (Page B being a copy of Page with a single instance of your CustomComponent) When you load Page A, the JS will not be loaded. When you load Page B, both the Wicket JS and the custom JS will be added to the page. If you are seeing Jquery being loaded in Page A then some component on that page requires the Wicket JS libraries and is causing it to be added. N On Thu, Nov 14, 2013 at 8:56 AM, Marios Skounakis msc...@gmail.com wrote: Thanks Martin, this worked well. Sebastien and Nick, I tried the solution with JQueryPluginResourceReference but this indeed caused JQuery to be loaded in non ajax pages. On Thu, Nov 14, 2013 at 3:04 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, You can create custom IHeaderResponseDecorator and by using custom IHeaderResponse you can check for contributions of org.apache.wicket.ajax.WicketAjaxJQueryResourceReference See http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/?0 and http://wicketinaction.com/2012/07/wicket-6-resource-management/ On Thu, Nov 14, 2013 at 2:59 PM, Marios Skounakis msc...@gmail.com wrote: If I'm not mistaken this will cause JQuery to be included whenever my js reference is included. Effectively this will cause non-ajax pages to load javascript which applies only to ajax requests. What I want is the opposite: to not include my js reference when the page does not have any ajax. On Thu, Nov 14, 2013 at 2:04 PM, Sebastien seb...@gmail.com wrote: Hi Marios, IMO the best way IMO is to make your js reference extending JQueryPluginResourceReference (wicket 6) Best regards, Sebastien. On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.com wrote: Hi all, I have a base page from which all my pages inherit. I want to conditionally include a javascript reference (header item) if the page contains an ajax component. The reference is a veil implementation based on BlockUI which is redundant (and also causes a javascript error) if the page has not ajax (and hence JQuery is not loaded). Any suggestions? Thanks Marios
Re: Wicket site on Android phone
I also recently find that I need to tweak Wicket Palette component look, because on Android a multiple select will not show all the options. You have to click it for selection and after that you can see only the first selected item no matter how big is the height for select markup. I have written more about it here http://programmingbb.blogspot.ro/2013/11/html-multiple-select-and-android.html . -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-site-on-Android-phone-tp2966635p4662441.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: Conditionally include header item when page contains ajax components
I probably wasn't clear enough. Here's my case: BasePage.renderHead() adds veil.js as javascript resource reference. All my pages inherit from BasePage. But veil.js is only useful when a page has wicket ajax. If I declare that veil.js has a dependency on jquery then the result is that all pages get both veil.js and jquery. What I want is that pages that don't have ajax (i.e. no Wicket-Ajax or Wicket-Event libraries) don't include veil.js. I could do it on a per component basis but this would be cumbersome and error prone. So instead I used Martin's solution and conditionally render veil.js only if the headerResponse renders Wicket-Event. On Thu, Nov 14, 2013 at 5:09 PM, Nick Pratt nbpr...@gmail.com wrote: Then you're doing something odd :-) If you have dependencies like this: CustomComponent -- Custom JS Reference (and this is added in the public void renderHead( Component component, IHeaderResponse response ) method) -- Wicket's JQuery JS Reference Page A (no Ajax components or components depending on Wicket's jquery ref) Page B -- CustomComponent (Page B being a copy of Page with a single instance of your CustomComponent) When you load Page A, the JS will not be loaded. When you load Page B, both the Wicket JS and the custom JS will be added to the page. If you are seeing Jquery being loaded in Page A then some component on that page requires the Wicket JS libraries and is causing it to be added. N On Thu, Nov 14, 2013 at 8:56 AM, Marios Skounakis msc...@gmail.com wrote: Thanks Martin, this worked well. Sebastien and Nick, I tried the solution with JQueryPluginResourceReference but this indeed caused JQuery to be loaded in non ajax pages. On Thu, Nov 14, 2013 at 3:04 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, You can create custom IHeaderResponseDecorator and by using custom IHeaderResponse you can check for contributions of org.apache.wicket.ajax.WicketAjaxJQueryResourceReference See http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/?0 and http://wicketinaction.com/2012/07/wicket-6-resource-management/ On Thu, Nov 14, 2013 at 2:59 PM, Marios Skounakis msc...@gmail.com wrote: If I'm not mistaken this will cause JQuery to be included whenever my js reference is included. Effectively this will cause non-ajax pages to load javascript which applies only to ajax requests. What I want is the opposite: to not include my js reference when the page does not have any ajax. On Thu, Nov 14, 2013 at 2:04 PM, Sebastien seb...@gmail.com wrote: Hi Marios, IMO the best way IMO is to make your js reference extending JQueryPluginResourceReference (wicket 6) Best regards, Sebastien. On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.com wrote: Hi all, I have a base page from which all my pages inherit. I want to conditionally include a javascript reference (header item) if the page contains an ajax component. The reference is a veil implementation based on BlockUI which is redundant (and also causes a javascript error) if the page has not ajax (and hence JQuery is not loaded). Any suggestions? Thanks Marios
Re: Conditionally include header item when page contains ajax components
Understood. Martin - (for my own curiousity now) would it be possible and would there be any benefit to replacing the default Wicket jQuery resource reference with a custom veil.js ResourceReference that also included the packaged Wicket jquery resource ref as a dependency (i.e. configure this all in Application.init() )? Nick On Thu, Nov 14, 2013 at 3:04 PM, Marios Skounakis msc...@gmail.com wrote: I probably wasn't clear enough. Here's my case: BasePage.renderHead() adds veil.js as javascript resource reference. All my pages inherit from BasePage. But veil.js is only useful when a page has wicket ajax. If I declare that veil.js has a dependency on jquery then the result is that all pages get both veil.js and jquery. What I want is that pages that don't have ajax (i.e. no Wicket-Ajax or Wicket-Event libraries) don't include veil.js. I could do it on a per component basis but this would be cumbersome and error prone. So instead I used Martin's solution and conditionally render veil.js only if the headerResponse renders Wicket-Event. On Thu, Nov 14, 2013 at 5:09 PM, Nick Pratt nbpr...@gmail.com wrote: Then you're doing something odd :-) If you have dependencies like this: CustomComponent -- Custom JS Reference (and this is added in the public void renderHead( Component component, IHeaderResponse response ) method) -- Wicket's JQuery JS Reference Page A (no Ajax components or components depending on Wicket's jquery ref) Page B -- CustomComponent (Page B being a copy of Page with a single instance of your CustomComponent) When you load Page A, the JS will not be loaded. When you load Page B, both the Wicket JS and the custom JS will be added to the page. If you are seeing Jquery being loaded in Page A then some component on that page requires the Wicket JS libraries and is causing it to be added. N On Thu, Nov 14, 2013 at 8:56 AM, Marios Skounakis msc...@gmail.com wrote: Thanks Martin, this worked well. Sebastien and Nick, I tried the solution with JQueryPluginResourceReference but this indeed caused JQuery to be loaded in non ajax pages. On Thu, Nov 14, 2013 at 3:04 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, You can create custom IHeaderResponseDecorator and by using custom IHeaderResponse you can check for contributions of org.apache.wicket.ajax.WicketAjaxJQueryResourceReference See http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/?0 and http://wicketinaction.com/2012/07/wicket-6-resource-management/ On Thu, Nov 14, 2013 at 2:59 PM, Marios Skounakis msc...@gmail.com wrote: If I'm not mistaken this will cause JQuery to be included whenever my js reference is included. Effectively this will cause non-ajax pages to load javascript which applies only to ajax requests. What I want is the opposite: to not include my js reference when the page does not have any ajax. On Thu, Nov 14, 2013 at 2:04 PM, Sebastien seb...@gmail.com wrote: Hi Marios, IMO the best way IMO is to make your js reference extending JQueryPluginResourceReference (wicket 6) Best regards, Sebastien. On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.com wrote: Hi all, I have a base page from which all my pages inherit. I want to conditionally include a javascript reference (header item) if the page contains an ajax component. The reference is a veil implementation based on BlockUI which is redundant (and also causes a javascript error) if the page has not ajax (and hence JQuery is not loaded). Any suggestions? Thanks Marios
Re: Conditionally include header item when page contains ajax components
Hi, On Thu, Nov 14, 2013 at 10:43 PM, Nick Pratt nbpr...@gmail.com wrote: Understood. Martin - (for my own curiousity now) would it be possible and would there be any benefit to replacing the default Wicket jQuery resource reference with a custom veil.js ResourceReference that also included the packaged Wicket jquery resource ref as a dependency (i.e. configure this all in Application.init() )? Yes. This will work as well. getJavaScriptLibrarySettings().setWicketAjaxReference(veilJsThatDependsOnOriginalWicketAjaxReference) Nick On Thu, Nov 14, 2013 at 3:04 PM, Marios Skounakis msc...@gmail.com wrote: I probably wasn't clear enough. Here's my case: BasePage.renderHead() adds veil.js as javascript resource reference. All my pages inherit from BasePage. But veil.js is only useful when a page has wicket ajax. If I declare that veil.js has a dependency on jquery then the result is that all pages get both veil.js and jquery. What I want is that pages that don't have ajax (i.e. no Wicket-Ajax or Wicket-Event libraries) don't include veil.js. I could do it on a per component basis but this would be cumbersome and error prone. So instead I used Martin's solution and conditionally render veil.js only if the headerResponse renders Wicket-Event. On Thu, Nov 14, 2013 at 5:09 PM, Nick Pratt nbpr...@gmail.com wrote: Then you're doing something odd :-) If you have dependencies like this: CustomComponent -- Custom JS Reference (and this is added in the public void renderHead( Component component, IHeaderResponse response ) method) -- Wicket's JQuery JS Reference Page A (no Ajax components or components depending on Wicket's jquery ref) Page B -- CustomComponent (Page B being a copy of Page with a single instance of your CustomComponent) When you load Page A, the JS will not be loaded. When you load Page B, both the Wicket JS and the custom JS will be added to the page. If you are seeing Jquery being loaded in Page A then some component on that page requires the Wicket JS libraries and is causing it to be added. N On Thu, Nov 14, 2013 at 8:56 AM, Marios Skounakis msc...@gmail.com wrote: Thanks Martin, this worked well. Sebastien and Nick, I tried the solution with JQueryPluginResourceReference but this indeed caused JQuery to be loaded in non ajax pages. On Thu, Nov 14, 2013 at 3:04 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, You can create custom IHeaderResponseDecorator and by using custom IHeaderResponse you can check for contributions of org.apache.wicket.ajax.WicketAjaxJQueryResourceReference See http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/?0 and http://wicketinaction.com/2012/07/wicket-6-resource-management/ On Thu, Nov 14, 2013 at 2:59 PM, Marios Skounakis msc...@gmail.com wrote: If I'm not mistaken this will cause JQuery to be included whenever my js reference is included. Effectively this will cause non-ajax pages to load javascript which applies only to ajax requests. What I want is the opposite: to not include my js reference when the page does not have any ajax. On Thu, Nov 14, 2013 at 2:04 PM, Sebastien seb...@gmail.com wrote: Hi Marios, IMO the best way IMO is to make your js reference extending JQueryPluginResourceReference (wicket 6) Best regards, Sebastien. On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.com wrote: Hi all, I have a base page from which all my pages inherit. I want to conditionally include a javascript reference (header item) if the page contains an ajax component. The reference is a veil implementation based on BlockUI which is redundant (and also causes a javascript error) if the page has not ajax (and hence JQuery is not loaded). Any suggestions? Thanks Marios