Re: swap panels from child element
Hi, replacing is really easy: this.addOrReplace(panel); ... as long as all your panels have an identical Wicket id. I often prefer this approach over changing visibility because of smaller session size (i.e. not keeping unused panels in the component tree) and simpler markup (i.e. not requiring a div for each panel). Your mileage may vary. Regards Sven On 02.02.2015 18:15, Chris wrote: Hi, I would like to swap panels B and C when the user clicks on a certain div element in Subpanel Aa The Page consists of following panels: - Panel A Subpanel Aa - Panel B - Panel C How can I access the panels B and C and replace them or change their visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target) method? Is it better to replace them or change their visibility? Subpanel Aa: … WebMarkupContainer div=new WebMarkupContainer(„item); div.setOutputMarkupId(true); div.add(new AjaxEventBehavior(onclick) { protected void onEvent(AjaxRequestTarget target) { } }); ... Thanks, Chris - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Empty form values after successful onSubmit?
Hi, I don't think you're doing something weird, you're just seeing the normal Wicket behavior: I debugged a bit Good! that success calls though to some logic which marks my page as dirty generated a new version number, stores the changed page in the session All pretty normal. I don't see anything to interfere with that Why should you? the ctor of my page is not called again the same with onInitialization Why should it? Wicket is stateful by default, so it will keep the current page as long as the user doesn't navigate away from it. After form processing the input of all form components are cleared, but after that you see the model values instead. You can navigate to a new page instance (#setResponsePage(this.getClass()) if you want to start over with empty input *and* an empty model. Regards Sven On 02.02.2015 18:34, Thorsten Schöning wrote: Guten Tag Thorsten Schöning, am Montag, 2. Februar 2015 um 18:13 schrieben Sie: I do see the success message AND the values of the input which have been sent. I debugged a bit and can verify that success calls though to some logic which marks my page as dirty, generated a new version number, stores the changed page in the session and such. I don't see anything to interfere with that and the ctor of my page is not called again, the same with onInitialization, which I override to build my form. I didn't see any code which resets the default model or its properties or such. Is all that expected and intended behavior or am I doing something really weird? :-) Mit freundlichen Grüßen, Thorsten Schöning - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: put Javascript in HTML body
Hi, You can extend OnDomReadyHeaderItem, e.g. MyOnDomReadyHeaderItem, and then filter only instances of this type to be rendered in the body. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 3:34 PM, Chris chris...@gmx.at wrote: Hi Martin, Shengche, thanks a lot! I used the approach as explained in http://wicket.apache.org/guide/guide/resources.html#resources_7 http://wicket.apache.org/guide/guide/resources.html#resources_7 by providing a custom IHeaderResponseDecorator and using the Wicket container tag. Then I used the OnDomReadyHeaderItem.forScript() method to include the specific JavaScript code: @Override public void renderHead(IHeaderResponse response) { response.render(OnDomReadyHeaderItem.forScript(JS CODE); } Because of the HeaderResponseDecorator set in the init method of the application, the JS-code of all pages will be placed in the body. How can I adapt this method, so that by default, all JS-code is placed in the header, and only that of a certain page is put in the body tag? Thanks, Chris Am 02.02.2015 um 08:05 schrieb Martin Grigorov mgrigo...@apache.org: Hi, If you use Label then you should do: label.setEscapeModelStrings(true). But for your case I'd recommend using OnDomReadyHeaderItem.forScript() Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Sun, Feb 1, 2015 at 11:44 PM, Chris chris...@gmx.at wrote: Hi all, I would like to use Leaflet JS library in order to display open street maps. According to this library, certain JS code has to be placed in the body element of the html underneath a div element, e.g.: body div id=map/div script var map = L.map('map').setView([51.505, -0.09], 13); L.tileLayer('https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', { maxZoom: 18, attribution: 'Map data copy; a href=http://openstreetmap.org OpenStreetMap/a contributors, ' + 'a href=http://creativecommons.org/licenses/by-sa/2.0/ CC-BY-SA/a, ' + 'Imagery © a href=http://mapbox.com;Mapbox/a', id: 'examples.map-i875mjb7' }).addTo(map); L.marker([51.5, -0.09]).addTo(map) .bindPopup(bHello world!/bbr /I am a popup.).openPopup(); L.circle([51.508, -0.11], 500, { color: 'red', fillColor: '#f03', fillOpacity: 0.5 }).addTo(map).bindPopup(I am a circle.); /script /body What is the best way to generate this code in wicket so that map makers can be set dynamically? I tried to insert it via add(new Label(script“,“...“) but in this case, all the quotation marks are escaped in a wrong way (using \). Thanks a lot, Chris
Re: Empty form values after successful onSubmit?
On Mon, Feb 2, 2015 at 10:03 PM, Sven Meier s...@meiers.net wrote: Hi, I don't think you're doing something weird, you're just seeing the normal Wicket behavior: I debugged a bit Good! that success calls though to some logic which marks my page as dirty generated a new version number, stores the changed page in the session All pretty normal. I don't see anything to interfere with that Why should you? the ctor of my page is not called again the same with onInitialization Why should it? Wicket is stateful by default, so it will keep the current page as long as the user doesn't navigate away from it. Wicket pages are stateless by default. It is just that it is very easy to become stateful. After form processing the input of all form components are cleared, but after that you see the model values instead. You can navigate to a new page instance (#setResponsePage(this.getClass()) if you want to start over with empty input *and* an empty model. Or set a fresh instance as a model object of the Form. Regards Sven On 02.02.2015 18:34, Thorsten Schöning wrote: Guten Tag Thorsten Schöning, am Montag, 2. Februar 2015 um 18:13 schrieben Sie: I do see the success message AND the values of the input which have been sent. I debugged a bit and can verify that success calls though to some logic which marks my page as dirty, generated a new version number, stores the changed page in the session and such. I don't see anything to interfere with that and the ctor of my page is not called again, the same with onInitialization, which I override to build my form. I didn't see any code which resets the default model or its properties or such. Is all that expected and intended behavior or am I doing something really weird? :-) Mit freundlichen Grüßen, Thorsten Schöning - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: swap panels from child element
Andrea - thanks, but how can I access the panels from a child panel within the component hierarchy of a page without having to put them in the constructor of each child panel? best regards, Chris Am 02.02.2015 um 19:02 schrieb Andrea Del Bene an.delb...@gmail.com: Changing visibility is less complex and if the result looks good I would go for it. Hi, I would like to swap panels B and C when the user clicks on a certain div element in Subpanel Aa The Page consists of following panels: - Panel A Subpanel Aa - Panel B - Panel C How can I access the panels B and C and replace them or change their visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target) method? Is it better to replace them or change their visibility? Subpanel Aa: … WebMarkupContainer div=new WebMarkupContainer(„item); div.setOutputMarkupId(true); div.add(new AjaxEventBehavior(onclick) { protected void onEvent(AjaxRequestTarget target) { } }); ... Thanks, Chris - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: swap panels from child element
Hi, You can use Wicket Events - http://www.wicket-library.com/wicket-examples-6.0.x/events/ Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 8:25 PM, Grün Christoph christ...@ec.tuwien.ac.at wrote: Andrea - thanks, but how can I access the panels from a child panel within the component hierarchy of a page without having to put them in the constructor of each child panel? best regards, Chris Am 02.02.2015 um 19:02 schrieb Andrea Del Bene an.delb...@gmail.com: Changing visibility is less complex and if the result looks good I would go for it. Hi, I would like to swap panels B and C when the user clicks on a certain div element in Subpanel Aa The Page consists of following panels: - Panel A Subpanel Aa - Panel B - Panel C How can I access the panels B and C and replace them or change their visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target) method? Is it better to replace them or change their visibility? Subpanel Aa: … WebMarkupContainer div=new WebMarkupContainer(„item); div.setOutputMarkupId(true); div.add(new AjaxEventBehavior(onclick) { protected void onEvent(AjaxRequestTarget target) { } }); ... Thanks, Chris - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: put Javascript in HTML body
Hi Martin, Shengche, thanks a lot! I used the approach as explained in http://wicket.apache.org/guide/guide/resources.html#resources_7 http://wicket.apache.org/guide/guide/resources.html#resources_7 by providing a custom IHeaderResponseDecorator and using the Wicket container tag. Then I used the OnDomReadyHeaderItem.forScript() method to include the specific JavaScript code: @Override public void renderHead(IHeaderResponse response) { response.render(OnDomReadyHeaderItem.forScript(JS CODE); } Because of the HeaderResponseDecorator set in the init method of the application, the JS-code of all pages will be placed in the body. How can I adapt this method, so that by default, all JS-code is placed in the header, and only that of a certain page is put in the body tag? Thanks, Chris Am 02.02.2015 um 08:05 schrieb Martin Grigorov mgrigo...@apache.org: Hi, If you use Label then you should do: label.setEscapeModelStrings(true). But for your case I'd recommend using OnDomReadyHeaderItem.forScript() Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Sun, Feb 1, 2015 at 11:44 PM, Chris chris...@gmx.at wrote: Hi all, I would like to use Leaflet JS library in order to display open street maps. According to this library, certain JS code has to be placed in the body element of the html underneath a div element, e.g.: body div id=map/div script var map = L.map('map').setView([51.505, -0.09], 13); L.tileLayer('https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', { maxZoom: 18, attribution: 'Map data copy; a href=http://openstreetmap.org;OpenStreetMap/a contributors, ' + 'a href=http://creativecommons.org/licenses/by-sa/2.0/;CC-BY-SA/a, ' + 'Imagery © a href=http://mapbox.com;Mapbox/a', id: 'examples.map-i875mjb7' }).addTo(map); L.marker([51.5, -0.09]).addTo(map) .bindPopup(bHello world!/bbr /I am a popup.).openPopup(); L.circle([51.508, -0.11], 500, { color: 'red', fillColor: '#f03', fillOpacity: 0.5 }).addTo(map).bindPopup(I am a circle.); /script /body What is the best way to generate this code in wicket so that map makers can be set dynamically? I tried to insert it via add(new Label(script“,“...“) but in this case, all the quotation marks are escaped in a wrong way (using \). Thanks a lot, Chris
Re: Wicket JQuery Selectable Sortable combined
Hi Sebastien, thanks a lot for your example, it works fine! One question remains: how is it possible to add the ListModel as Ajax target so that when I delete a selected element, the displayed elements are updated? @Override public void onSelect(AjaxRequestTarget target, ListString items) { info(selected + items); target.add(feedback); } Thanks a lot, Chris Am 01.02.2015 um 17:58 schrieb Sebastien seb...@gmail.com: Hi Chris, Please find hereafter the link to the sample: http://www.7thweb.net/wicket-jquery-ui/sortable/SelectableSortablePage Best regards, Sebastien.
Re: Plans for further wicket classes with generics
Hi, There is a discussion about this since Wicket 1.4 (the first version of Wicket built against JDK 1.5). The main stopper is that using generics makes the code even more verbose. And many people don't like this. So there are few Generic*** versions of the most used components. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 3:21 PM, Thibault Kruse tibokr...@googlemail.com wrote: Hi, Already in Wicket there is GenericPanel, GenericWebPage, GenericFragment, IGenericComponent, and IModel of course is already generic. But there is still IBehavior without Generics and several standard components which do not implement IGenericComponent such a Label. Are there plans to further promote APIs with generics, also maybe deprecating the APIs which do not use generics (classes Panel, Page, etc.)? Or is there a good reason not to use Generics? regards, Thibault - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: GMap3 - Show title of markers permanently
Thanks a lot! Chris Am 02.02.2015 um 08:12 schrieb Martin Grigorov mgrigo...@apache.org mailto:mgrigo...@apache.org: aps v3 JS API and if there is a way then look in WicketStuff integration to apply it.
Plans for further wicket classes with generics
Hi, Already in Wicket there is GenericPanel, GenericWebPage, GenericFragment, IGenericComponent, and IModel of course is already generic. But there is still IBehavior without Generics and several standard components which do not implement IGenericComponent such a Label. Are there plans to further promote APIs with generics, also maybe deprecating the APIs which do not use generics (classes Panel, Page, etc.)? Or is there a good reason not to use Generics? regards, Thibault - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Having Wicket manage resources outside classpath
It would be good to change the Wicket implementation here so that several ICssCompressor could be added. With an ArrayList for example - then you could add a css compressor to the beginning of the chain with getCssCompressors().add(0,myCoolNewCssCompressor) kind regards Tobias Am 02.02.2015 um 09:51 schrieb Martin Grigorov mgrigo...@apache.org: Additionally we used preloading of static resources. At app start time (i.e. MyApp#init()) we fired an artificial request to all registered CSS/JS bundles. The response has been cached (by a specialization of ConcatBundleResource) and later all real/runtime requests were using the cache. This way the compression (CSS JS) has been done just once. By default Wicket would do it for each request. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 10:43 AM, Tobias Soloschenko tobiassolosche...@googlemail.com wrote: Good idea, I'm going to make it this way! kind regards Tobias Am 02.02.2015 um 09:36 schrieb Martin Grigorov mgrigo...@apache.org: Hi Tobias, I imagine it with a regex that parses for url(...) and replaces the old url with a new one. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 10:31 AM, Tobias Soloschenko tobiassolosche...@googlemail.com wrote: Hi, would be a good to see such an implementation out of the box. (CSSCompressor) I try to do it soon - maybe with a varags of URLs which are going to be passed into the CSS file. kind regards Tobias Am 02.02.2015 um 08:35 schrieb Martin Grigorov mgrigo...@apache.org: Hi, Putting your static resources in the context root and letting Wicket manage them is not a problem. For example you can use a special/custom MyScope.class as a scope for JS/Css ResourceReferences and a custom IResourceFinder that uses ServletContext#getResource() when the scope is MyScope.class. The problem with images in .css files is that they are processed by browser directly. I.e. they are invisible to Wicket. The CSS is streamed to the browser and the browser resolves the relative url to absolute one and makes a new request for the image. One way to make it working is to use a custom ICssCompressor that receives the raw .css as an input, parses for url(...) and replaces it with the url produced by urlFor(new PackageResourceReference(MyScope.class, the.original.image.name)). Another way is to use Less/SCSS/SASS as a pre-processor. I have did this with Less in the past: Less4j provides https://github.com/SomMeri/less4j/blob/master/src/main/java/com/github/sommeri/less4j/LessFunction.java . With it you can replace some content in the Less file during compilation. This approach works only with runtime compilation! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Jan 30, 2015 at 3:21 PM, Nick Pratt nbpr...@gmail.com wrote: is it possible to have Wicket manage resources (.css and .js) outside of the classpath, so that we can leverage all the great dev/prod things that Wicket does with resources served from within the classpath? We typically put our resources at the root of the context: /assets/css /assets/js /assets/images /WEB-INF/ This way we can reference images from within our style sheets using 'background:url(../images/logo.png);' If Wicket were to serve these resources (I guess we would have to move the assets down a level so they were brought in to the accessible classpath of the Wicket app), can we manage such context sensitive references within CSS files that are being managed by Wicket? We're using 6.x N - 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: Having Wicket manage resources outside classpath
Hi, https://github.com/klopfdreh/wicket-components-playground See CssUrlReplacer kind regards Tobias Am 02.02.2015 um 09:51 schrieb Martin Grigorov mgrigo...@apache.org: Additionally we used preloading of static resources. At app start time (i.e. MyApp#init()) we fired an artificial request to all registered CSS/JS bundles. The response has been cached (by a specialization of ConcatBundleResource) and later all real/runtime requests were using the cache. This way the compression (CSS JS) has been done just once. By default Wicket would do it for each request. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 10:43 AM, Tobias Soloschenko tobiassolosche...@googlemail.com wrote: Good idea, I'm going to make it this way! kind regards Tobias Am 02.02.2015 um 09:36 schrieb Martin Grigorov mgrigo...@apache.org: Hi Tobias, I imagine it with a regex that parses for url(...) and replaces the old url with a new one. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 10:31 AM, Tobias Soloschenko tobiassolosche...@googlemail.com wrote: Hi, would be a good to see such an implementation out of the box. (CSSCompressor) I try to do it soon - maybe with a varags of URLs which are going to be passed into the CSS file. kind regards Tobias Am 02.02.2015 um 08:35 schrieb Martin Grigorov mgrigo...@apache.org: Hi, Putting your static resources in the context root and letting Wicket manage them is not a problem. For example you can use a special/custom MyScope.class as a scope for JS/Css ResourceReferences and a custom IResourceFinder that uses ServletContext#getResource() when the scope is MyScope.class. The problem with images in .css files is that they are processed by browser directly. I.e. they are invisible to Wicket. The CSS is streamed to the browser and the browser resolves the relative url to absolute one and makes a new request for the image. One way to make it working is to use a custom ICssCompressor that receives the raw .css as an input, parses for url(...) and replaces it with the url produced by urlFor(new PackageResourceReference(MyScope.class, the.original.image.name)). Another way is to use Less/SCSS/SASS as a pre-processor. I have did this with Less in the past: Less4j provides https://github.com/SomMeri/less4j/blob/master/src/main/java/com/github/sommeri/less4j/LessFunction.java . With it you can replace some content in the Less file during compilation. This approach works only with runtime compilation! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Jan 30, 2015 at 3:21 PM, Nick Pratt nbpr...@gmail.com wrote: is it possible to have Wicket manage resources (.css and .js) outside of the classpath, so that we can leverage all the great dev/prod things that Wicket does with resources served from within the classpath? We typically put our resources at the root of the context: /assets/css /assets/js /assets/images /WEB-INF/ This way we can reference images from within our style sheets using 'background:url(../images/logo.png);' If Wicket were to serve these resources (I guess we would have to move the assets down a level so they were brought in to the accessible classpath of the Wicket app), can we manage such context sensitive references within CSS files that are being managed by Wicket? We're using 6.x N - 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: Plans for further wicket classes with generics
I see, I guess this was summarized here: https://cwiki.apache.org/confluence/display/WICKET/generics On Mon, Feb 2, 2015 at 2:27 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, There is a discussion about this since Wicket 1.4 (the first version of Wicket built against JDK 1.5). The main stopper is that using generics makes the code even more verbose. And many people don't like this. So there are few Generic*** versions of the most used components. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 3:21 PM, Thibault Kruse tibokr...@googlemail.com wrote: Hi, Already in Wicket there is GenericPanel, GenericWebPage, GenericFragment, IGenericComponent, and IModel of course is already generic. But there is still IBehavior without Generics and several standard components which do not implement IGenericComponent such a Label. Are there plans to further promote APIs with generics, also maybe deprecating the APIs which do not use generics (classes Panel, Page, etc.)? Or is there a good reason not to use Generics? regards, Thibault - 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
Empty form values after successful onSubmit?
Hi all, I have some very straightforward forms, but am really new to the whole stateful forms/pages thing in Wicket. My form has some elements with validators and if things fail the form is rendered again with the former input values and a feedback message with the error. If no error occured my form changes some data and provides a simple success feedback message by calling this.success(...). I didn't expect the latter, but instead that the form data is cleared automatically. Is that something Wicket don't want to do automatically by purpose because it's only sometimes wanted, not always? I'm a bit afraid I could forget clearing data on my own in that case and thought about how to deal with this, especially as forms may grow in future and fields get added. I'm using CompoundPropertyModel, like suggested in the tutorials. Any ideas or suggestions on this? Would be a simple call to Form.clearInput the best solution? Thank für your feedback! Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...05151- 9468- 55 Fax...05151- 9468- 88 Mobil..0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket JQuery Selectable Sortable combined
Hi Chris, You're welcome! The list is already the Sortable's model object, if you are able to send the item hash, you are able to retrieve the item, then you just have to invoke Sortable#onRemove(target, item) [1] and this should be all fine... Hope this helps, Sebastien. [1] https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui/src/main/java/com/googlecode/wicket/jquery/ui/interaction/sortable/Sortable.java#L151 On Mon, Feb 2, 2015 at 2:22 PM, Chris chris...@gmx.at wrote: Hi Sebastien, thanks a lot for your example, it works fine! One question remains: how is it possible to add the ListModel as Ajax target so that when I delete a selected element, the displayed elements are updated? @Override public void onSelect(AjaxRequestTarget target, ListString items) { info(selected + items); target.add(feedback); } Thanks a lot, Chris
Re: Empty form values after successful onSubmit?
Hi Thorsten, a Form clears all FormComponents' input automatically on a successful submit. Why do you think that this is not the case? Regards Sven On 02.02.2015 17:11, Thorsten Schöning wrote: Hi all, I have some very straightforward forms, but am really new to the whole stateful forms/pages thing in Wicket. My form has some elements with validators and if things fail the form is rendered again with the former input values and a feedback message with the error. If no error occured my form changes some data and provides a simple success feedback message by calling this.success(...). I didn't expect the latter, but instead that the form data is cleared automatically. Is that something Wicket don't want to do automatically by purpose because it's only sometimes wanted, not always? I'm a bit afraid I could forget clearing data on my own in that case and thought about how to deal with this, especially as forms may grow in future and fields get added. I'm using CompoundPropertyModel, like suggested in the tutorials. Any ideas or suggestions on this? Would be a simple call to Form.clearInput the best solution? Thank für your feedback! Mit freundlichen Grüßen, Thorsten Schöning - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Empty form values after successful onSubmit?
Guten Tag Sven Meier, am Montag, 2. Februar 2015 um 17:38 schrieben Sie: a Form clears all FormComponents' input automatically on a successful submit. Why do you think that this is not the case? Because that's what I see. ;-) Using the following code: @Override protected void onSubmit() { do something... // TODO Instanzdaten leeren? this.success(this.getString(success)); } I do see the success message AND the values of the input which have been sent. So, you tell me that I'm doing something wrong? I only have a form and use it as a compound one as the default model. Any ideas on where I should look at to find the problem? Thank! Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...05151- 9468- 55 Fax...05151- 9468- 88 Mobil..0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Empty form values after successful onSubmit?
Guten Tag Thorsten Schöning, am Montag, 2. Februar 2015 um 18:13 schrieben Sie: I do see the success message AND the values of the input which have been sent. I debugged a bit and can verify that success calls though to some logic which marks my page as dirty, generated a new version number, stores the changed page in the session and such. I don't see anything to interfere with that and the ctor of my page is not called again, the same with onInitialization, which I override to build my form. I didn't see any code which resets the default model or its properties or such. Is all that expected and intended behavior or am I doing something really weird? :-) Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...05151- 9468- 55 Fax...05151- 9468- 88 Mobil..0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: swap panels from child element
Changing visibility is less complex and if the result looks good I would go for it. Hi, I would like to swap panels B and C when the user clicks on a certain div element in Subpanel Aa The Page consists of following panels: - Panel A Subpanel Aa - Panel B - Panel C How can I access the panels B and C and replace them or change their visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target) method? Is it better to replace them or change their visibility? Subpanel Aa: … WebMarkupContainer div=new WebMarkupContainer(„item); div.setOutputMarkupId(true); div.add(new AjaxEventBehavior(onclick) { protected void onEvent(AjaxRequestTarget target) { } }); ... Thanks, Chris - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
swap panels from child element
Hi, I would like to swap panels B and C when the user clicks on a certain div element in Subpanel Aa The Page consists of following panels: - Panel A Subpanel Aa - Panel B - Panel C How can I access the panels B and C and replace them or change their visibility from the WebMarkupContainer onEvent(AjaxRequestTarget target) method? Is it better to replace them or change their visibility? Subpanel Aa: … WebMarkupContainer div=new WebMarkupContainer(„item); div.setOutputMarkupId(true); div.add(new AjaxEventBehavior(onclick) { protected void onEvent(AjaxRequestTarget target) { } }); ... Thanks, Chris
Re: Having Wicket manage resources outside classpath
Hi, would be a good to see such an implementation out of the box. (CSSCompressor) I try to do it soon - maybe with a varags of URLs which are going to be passed into the CSS file. kind regards Tobias Am 02.02.2015 um 08:35 schrieb Martin Grigorov mgrigo...@apache.org: Hi, Putting your static resources in the context root and letting Wicket manage them is not a problem. For example you can use a special/custom MyScope.class as a scope for JS/Css ResourceReferences and a custom IResourceFinder that uses ServletContext#getResource() when the scope is MyScope.class. The problem with images in .css files is that they are processed by browser directly. I.e. they are invisible to Wicket. The CSS is streamed to the browser and the browser resolves the relative url to absolute one and makes a new request for the image. One way to make it working is to use a custom ICssCompressor that receives the raw .css as an input, parses for url(...) and replaces it with the url produced by urlFor(new PackageResourceReference(MyScope.class, the.original.image.name)). Another way is to use Less/SCSS/SASS as a pre-processor. I have did this with Less in the past: Less4j provides https://github.com/SomMeri/less4j/blob/master/src/main/java/com/github/sommeri/less4j/LessFunction.java. With it you can replace some content in the Less file during compilation. This approach works only with runtime compilation! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Jan 30, 2015 at 3:21 PM, Nick Pratt nbpr...@gmail.com wrote: is it possible to have Wicket manage resources (.css and .js) outside of the classpath, so that we can leverage all the great dev/prod things that Wicket does with resources served from within the classpath? We typically put our resources at the root of the context: /assets/css /assets/js /assets/images /WEB-INF/ This way we can reference images from within our style sheets using 'background:url(../images/logo.png);' If Wicket were to serve these resources (I guess we would have to move the assets down a level so they were brought in to the accessible classpath of the Wicket app), can we manage such context sensitive references within CSS files that are being managed by Wicket? We're using 6.x N - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Having Wicket manage resources outside classpath
Hi Tobias, I imagine it with a regex that parses for url(...) and replaces the old url with a new one. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 10:31 AM, Tobias Soloschenko tobiassolosche...@googlemail.com wrote: Hi, would be a good to see such an implementation out of the box. (CSSCompressor) I try to do it soon - maybe with a varags of URLs which are going to be passed into the CSS file. kind regards Tobias Am 02.02.2015 um 08:35 schrieb Martin Grigorov mgrigo...@apache.org: Hi, Putting your static resources in the context root and letting Wicket manage them is not a problem. For example you can use a special/custom MyScope.class as a scope for JS/Css ResourceReferences and a custom IResourceFinder that uses ServletContext#getResource() when the scope is MyScope.class. The problem with images in .css files is that they are processed by browser directly. I.e. they are invisible to Wicket. The CSS is streamed to the browser and the browser resolves the relative url to absolute one and makes a new request for the image. One way to make it working is to use a custom ICssCompressor that receives the raw .css as an input, parses for url(...) and replaces it with the url produced by urlFor(new PackageResourceReference(MyScope.class, the.original.image.name)). Another way is to use Less/SCSS/SASS as a pre-processor. I have did this with Less in the past: Less4j provides https://github.com/SomMeri/less4j/blob/master/src/main/java/com/github/sommeri/less4j/LessFunction.java . With it you can replace some content in the Less file during compilation. This approach works only with runtime compilation! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Jan 30, 2015 at 3:21 PM, Nick Pratt nbpr...@gmail.com wrote: is it possible to have Wicket manage resources (.css and .js) outside of the classpath, so that we can leverage all the great dev/prod things that Wicket does with resources served from within the classpath? We typically put our resources at the root of the context: /assets/css /assets/js /assets/images /WEB-INF/ This way we can reference images from within our style sheets using 'background:url(../images/logo.png);' If Wicket were to serve these resources (I guess we would have to move the assets down a level so they were brought in to the accessible classpath of the Wicket app), can we manage such context sensitive references within CSS files that are being managed by Wicket? We're using 6.x N - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Having Wicket manage resources outside classpath
Good idea, I'm going to make it this way! kind regards Tobias Am 02.02.2015 um 09:36 schrieb Martin Grigorov mgrigo...@apache.org: Hi Tobias, I imagine it with a regex that parses for url(...) and replaces the old url with a new one. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 10:31 AM, Tobias Soloschenko tobiassolosche...@googlemail.com wrote: Hi, would be a good to see such an implementation out of the box. (CSSCompressor) I try to do it soon - maybe with a varags of URLs which are going to be passed into the CSS file. kind regards Tobias Am 02.02.2015 um 08:35 schrieb Martin Grigorov mgrigo...@apache.org: Hi, Putting your static resources in the context root and letting Wicket manage them is not a problem. For example you can use a special/custom MyScope.class as a scope for JS/Css ResourceReferences and a custom IResourceFinder that uses ServletContext#getResource() when the scope is MyScope.class. The problem with images in .css files is that they are processed by browser directly. I.e. they are invisible to Wicket. The CSS is streamed to the browser and the browser resolves the relative url to absolute one and makes a new request for the image. One way to make it working is to use a custom ICssCompressor that receives the raw .css as an input, parses for url(...) and replaces it with the url produced by urlFor(new PackageResourceReference(MyScope.class, the.original.image.name)). Another way is to use Less/SCSS/SASS as a pre-processor. I have did this with Less in the past: Less4j provides https://github.com/SomMeri/less4j/blob/master/src/main/java/com/github/sommeri/less4j/LessFunction.java . With it you can replace some content in the Less file during compilation. This approach works only with runtime compilation! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Jan 30, 2015 at 3:21 PM, Nick Pratt nbpr...@gmail.com wrote: is it possible to have Wicket manage resources (.css and .js) outside of the classpath, so that we can leverage all the great dev/prod things that Wicket does with resources served from within the classpath? We typically put our resources at the root of the context: /assets/css /assets/js /assets/images /WEB-INF/ This way we can reference images from within our style sheets using 'background:url(../images/logo.png);' If Wicket were to serve these resources (I guess we would have to move the assets down a level so they were brought in to the accessible classpath of the Wicket app), can we manage such context sensitive references within CSS files that are being managed by Wicket? We're using 6.x N - 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: Having Wicket manage resources outside classpath
Additionally we used preloading of static resources. At app start time (i.e. MyApp#init()) we fired an artificial request to all registered CSS/JS bundles. The response has been cached (by a specialization of ConcatBundleResource) and later all real/runtime requests were using the cache. This way the compression (CSS JS) has been done just once. By default Wicket would do it for each request. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 10:43 AM, Tobias Soloschenko tobiassolosche...@googlemail.com wrote: Good idea, I'm going to make it this way! kind regards Tobias Am 02.02.2015 um 09:36 schrieb Martin Grigorov mgrigo...@apache.org: Hi Tobias, I imagine it with a regex that parses for url(...) and replaces the old url with a new one. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 2, 2015 at 10:31 AM, Tobias Soloschenko tobiassolosche...@googlemail.com wrote: Hi, would be a good to see such an implementation out of the box. (CSSCompressor) I try to do it soon - maybe with a varags of URLs which are going to be passed into the CSS file. kind regards Tobias Am 02.02.2015 um 08:35 schrieb Martin Grigorov mgrigo...@apache.org: Hi, Putting your static resources in the context root and letting Wicket manage them is not a problem. For example you can use a special/custom MyScope.class as a scope for JS/Css ResourceReferences and a custom IResourceFinder that uses ServletContext#getResource() when the scope is MyScope.class. The problem with images in .css files is that they are processed by browser directly. I.e. they are invisible to Wicket. The CSS is streamed to the browser and the browser resolves the relative url to absolute one and makes a new request for the image. One way to make it working is to use a custom ICssCompressor that receives the raw .css as an input, parses for url(...) and replaces it with the url produced by urlFor(new PackageResourceReference(MyScope.class, the.original.image.name)). Another way is to use Less/SCSS/SASS as a pre-processor. I have did this with Less in the past: Less4j provides https://github.com/SomMeri/less4j/blob/master/src/main/java/com/github/sommeri/less4j/LessFunction.java . With it you can replace some content in the Less file during compilation. This approach works only with runtime compilation! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Jan 30, 2015 at 3:21 PM, Nick Pratt nbpr...@gmail.com wrote: is it possible to have Wicket manage resources (.css and .js) outside of the classpath, so that we can leverage all the great dev/prod things that Wicket does with resources served from within the classpath? We typically put our resources at the root of the context: /assets/css /assets/js /assets/images /WEB-INF/ This way we can reference images from within our style sheets using 'background:url(../images/logo.png);' If Wicket were to serve these resources (I guess we would have to move the assets down a level so they were brought in to the accessible classpath of the Wicket app), can we manage such context sensitive references within CSS files that are being managed by Wicket? We're using 6.x N - 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