How to call a ModalWindow's close callback?
Hi all, I have a ModalWindow, which when closed should update a panel (in this case, happens to be the parent of the ModalWindow) : final ChangePasswordModal changePasswordModal = new ChangePasswordModal("changePasswordModal", person, InputEditCustomerSysPanel.this); changePasswordModal.setCloseButtonCallback(new CloseButtonCallback() { @Override public boolean onCloseButtonClicked(AjaxRequestTarget target) { info("close button"); target.add(InputEditCustomerSysPanel.this); return true; } }); add(changePasswordModal); This works when the close button is clicked by the user. However, the primary use case is the modal will be closed by a an AjaxButton inside a form inside a panel inside the modal: AjaxButton submitBtn = new AjaxButton("submitBtn") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { // info("Updating password for " + person.getObject().getId() + " to be " + passwordField.getModelObject().toString()); log.info("Updating password for {} to be {}", person.getObject().getId(), passwordField.getModelObject()); person.getObject().setPassword(LdapUtils.encodeSsha(passwordField.getModelObject())); modalWindow.close(target); // PROBLEM: this doesn't call the callback above super.onSubmit(target, form); } }; add(submitBtn); Problem is, the callback is not called by onSubmit(). And I can't call the callback manually using the ModalWindow because I can't get to the callback object, i.e. no getCloseButtonCallback() method. How to solve this? Thank you. Rudi -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-call-a-ModalWindow-s-close-callback-tp4653456.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
wicket:message vs Label
Hello, is there any difference related to performance on using wicket:message instead of Labels objects? Regards, Rodrigo - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket:message vs Label
Hi, I guess there is but it is negligible. Label as a normal component stays in the component tree for the whole lifetime of the page, thus contributes to the memory usage. wicket:message creates an auto-component, which is created just for the render phase and then discarded, so it takes some CPU time for these operations. On Tue, Oct 30, 2012 at 11:50 AM, Rodrigo Pereira wrote: > > Hello, > is there any difference related to performance on using wicket:message > instead of Labels objects? > > Regards, > Rodrigo > > > > > - > 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
how to add rel="nofollow" to all links
Hi, when I look on my site (Brix and Wicket 6 application) in the google webmasters tools I see 300 thousands of wrong urls. All of them are from links (contains ILinkListener). So I would like to ask you if it would make sense to add attribute rel="nofollow" to all wicket links? If so is there some way how to do it automatically? Thanks in advance! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: how to add rel="nofollow" to all links
Hi In your Application.init() add this line: getComponentInstantiationListeners().add(new LinkListener()); public class LinkListener implements IComponentInstantiationListener { @Override public void onInstantiation(Component component) { if (component instanceof Link) { component.add(AttributeModifier.append("rel", "nofollow")); } } } Best regards, Decebal -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-add-rel-nofollow-to-all-links-tp4653459p4653460.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: how to add rel="nofollow" to all links
Hi, Using IComponentInstantiationListener is one way. Using a custom IMarkupFilter is another. And I think it is better because it is lighter - it wont add an additional behavior to each Link instance. On Tue, Oct 30, 2012 at 1:51 PM, Decebal Suiu wrote: > Hi > > In your Application.init() add this line: > getComponentInstantiationListeners().add(new LinkListener()); > > public class LinkListener implements IComponentInstantiationListener { > > @Override > public void onInstantiation(Component component) { > if (component instanceof Link) { > component.add(AttributeModifier.append("rel", > "nofollow")); > } > } > > } > > Best regards, > Decebal > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/how-to-add-rel-nofollow-to-all-links-tp4653459p4653460.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: HybridPageParamter encoder
When decoding the parameters set a flag in the request cycle's metadata that defines where the request parameters came from (path or query string). Later when encoding in the same request cycle use that flag to decide where to put the parameters. On Tue, Oct 30, 2012 at 9:39 PM, vinitty wrote: > I tried a lot of ways but i am not able to support both without redirect > > > Please help me > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/HybridPageParamter-encoder-tp4653279p4653464.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: How to set Javascript error handler for Wicket Ajax error
Hi, Do you need this only during development ? In Wicket 6 the Debug Window link in the bottom right corner becomes red and flashes few times so it should notify you that there is an error. Otherwise you can override (monkey-patch) Wicket.Log.error() to do whatever you need. On Tue, Oct 30, 2012 at 9:23 PM, Istvan Jozsa wrote: > Having a heavely Ajaxified page and a server wich went down, I got > "Could not find root element" > when an Ajax link is clicked > (as shown in WICKET AJAX DEBUG window). > > It would be nice to alert() user that the server is down. > > Neither of > window.onerror = function(msg, file, line){ /*...*/ }; > or > jQuery(document.body).error(function(msg, file, line){ /*...*/ }); > seems to work. > > stefan > > - > 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: HybridPageParamter encoder
Thanks Martin for checking this , Actually in my system they want to support both in single request like /mounturl//?q=1 is this possible ? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/HybridPageParamter-encoder-tp4653279p4653467.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: HybridPageParamter encoder
Check http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/ On Tue, Oct 30, 2012 at 11:54 PM, vinitty wrote: > Thanks Martin for checking this , > > Actually in my system they want to support both in single request like > > /mounturl//?q=1 > > is this possible ? > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/HybridPageParamter-encoder-tp4653279p4653467.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: Custom CSS for Feedback message is broken in 1.5
Hi, I also agree with Martin's points. Having no css-class on the span is the best solution from my point of view too. A little concern however. I think this kind of change is not exactly "backward compatible". Sure, it is, for the java side, but I figure that *many* users have wrote their own CSS for feedback panels and this will probably results to bad display with this change. So, I am wondering if this change will be considered as an "API break"? If yes, will you apply it also to 1.5.x (the original demand)? And, if the new version numbering system in place applies to 1.5.x, does that means that it should be 1.6.0? You see what I mean... it could lead to some misunderstanding!.. Also I like Sven's suggestion, but I am afraid that it will overlap with #newMessageDisplayComponent(). As ListItem IS-A WebMarkupContainer, we could do any customization from here. But, in this case (there is a new #newMessageItem() method), the span element is not needed anymore and therefore #newMessageDisplayComponent() neither. So, about the API break, we are in situation :) Thanks & best regards, Sebastien. On Mon, Oct 29, 2012 at 6:18 PM, Joachim Schrod wrote: > Hi, > > This would change be very well received, from my side. :-) :-) > > Cheers, > Joachim > > > Martin Grigorov wrote: > > Hi, > > > > [X] Other suggestion: (please specify) > > > > Here is what I think it should be: > > - element should have class "feedbackPanel" (this is already the > case) > > - element(s) should have class that specifies the feedback > > message level (currently by default Wicket sets "feedbackPanelLEVEL", > > but this is configurable with > > > org.apache.wicket.markup.html.panel.FeedbackPanel#getCSSClass(FeedbackMessage)) > > - the should not have class at all (currently it has the same > > class as the element) > > - the styling should be done with CSS selectors (e.g. > > div.feedbackPanel; div.feedbackPanel li.alert-warn; div.feedbackPanel > > li.alert-warn span; ...) > > - if custom markup is needed then a custom FeedbackPanel is needed > > (one that extends from the default FeedbackPanel or a completely new > > one, it depends on the use case) > > > > > > On Sun, Oct 28, 2012 at 6:03 PM, Sebastien wrote: > >> Hi, > >> > >> To sum-up this thread: we have a (not huge, but still) design issue that > >> annoys several users. A patch* has been provided but some questions > >> remains... > >> Given this, I would suggest a kind-of vote about the several points > >> discussed earlier, in order to enlighten the dev-team about the > preferred > >> choice of their (beloved) users.** > >> > >> Here are some possible options: > >> [ ] Please apply the patch as-is. It currently provides 2 methods > >> (#getListCSSClass and #getLabelCSSClass), #getCSSClass is marked a > >> deprecated until marked as private (or removed) > >> [ ] Do not apply the patch as-is, #getCSSClass should be kept (not > marked > >> as deprecated) > >> [ ] Do not apply the patch as-is, I do not agree with the 2 method > names. I > >> would have preferred: (please specify) > >> [ ] This is not an issue; this does not need to be "corrected" > >> [ ] Other suggestion: (please specify) > >> > >> Thanks in advance for your contribution, > >> Sebastien > >> > >> (*) https://issues.apache.org/jira/browse/WICKET-4831 > >> (**) Sure, dev-team opinion is also kindly asked! :) > > > > > > > > > > Joachim > > -- > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > Joachim Schrod, Roedermark, Germany > Email: jsch...@acm.org > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: HybridPageParamter encoder
Thanks But sorry to bother you again and again, If wicket can ignore the ?param1=value1 , and do not use them as parameters my problem will be solved but wicket should not changed the url in browser Thanks Vinit -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/HybridPageParamter-encoder-tp4653279p4653470.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: Remove ?1 from URL on GoogleAnalytics tracked pages
Hi Martin, With pleasure. I would be glad to add it to the wiki, just please tell me in which section and how to request an account (or maybe you asked me if I wanted -you- to add it to the wiki :) ) About your 2 comments: - The page instance is passed to the behavior because I had supposed the behavior will likely be added on a 'base' page. Like this, every child pages will automatically have their own GA script, simply with: this.add(new GoogleAnalyticsBehavior(this)); But I can provide 2 constructors, one with WebPage, the other with Class. #getURL() will then deals with the type instead of the instance, which is straightforward to update. - renderFullUrl: I also guessed GA script would have expected the full url (including the protocol, the port and the domain). I was so confident that I deployed with that change (yes, I did). As the result, the effect is dramatic: in the report, all visited pages was starting with "/http://"; (with the "/" at the beginning), instead of "/context/my/path/to/page" as expected. Thanks again & best regards, Sebastien. On Mon, Oct 29, 2012 at 9:02 AM, Martin Grigorov wrote: > Hi Sebastien, > > Thanks for sharing this solution! > I find it very useful. > Do you want to add it in the Wiki so it will be easier to find and > "part of the documentation". > > See few comments inline. > > On Sun, Oct 28, 2012 at 3:49 PM, Sebastien wrote: > > Hi, > > > > For whom might be interested, here is a solution on how to remove ?1 > params > > from tracked page's URL on GoogleAnalytics. This follows a thread > entitled > > "I would url clear, without jsessionid and ?1" > > To achieve this, the approach is to not attempt to remove/adapt ?1 params > > from statefull page's URL, but rather supply a "clean" URL to the GA > > javascript object: _gaq.push(['_trackPageview', 'the/clean/url']); > > > > For this cooking recipe we need: > > 1/ the GA client script in a js-templated file (ie: my/package/gaq.js) so > > the URL value can be supplied through a variable: > > _gaq.push(['_trackPageview', '${url}']); > > 2/ a behavior, that will: > > 2a/ resolves the URL (ie: /context/page) > > 2b/ de-templates the js file, with the url value, using a > > TextTemplateResourceReference > > 2c/ renders the js file back to the page. > > > > Then, add the behavior to your (base) page, and that's it. > > The behavior looks like: > > > > class GoogleAnalyticsBehavior extends Behavior > > { > > private static final long serialVersionUID = 1L; > > > > private final String url; > > > > > > public GoogleAnalyticsBehavior(final WebPage page) > > { > > No need to pass an instance of WebPage. You need just its class. > > > this.url = this.getUrl(page); > > } > > > > private String getUrl(WebPage page) > > { > > Url pageUrl = Url.parse(page.urlFor(page.getClass(), > > null).toString()); > > Url baseUrl = new > > Url(page.getRequestCycle().getUrlRenderer().getBaseUrl()); > > > > > baseUrl.resolveRelative(pageUrl); > > No need to play with the base url and calculate the urls yourself. > Use: > Url fullUrl = urlRenderer.renderFullUrl(pageUrl) > > > > > return String.format("%s/%s", page.getRequest().getContextPath(), > > baseUrl); > > } > > > > private IModel> newResourceModel() > > { > > Map map = new HashMap(); > > map.put("url", this.url); > > > > return Model.ofMap(map); > > } > > > > private ResourceReference newResourceReference() > > { > > return new > > TextTemplateResourceReference(GoogleAnalyticsBehavior.class, "gaq.js", > > this.newResourceModel()); > > } > > > > @Override > > public void renderHead(Component component, IHeaderResponse response) > > { > > super.renderHead(component, response); > > > > > > > response.render(JavaScriptHeaderItem.forReference(this.newResourceReference(), > > "gaq")); > > } > > } > > > > > > Thanks to Martin (I would say: again!) to have suggested the right > pointers. > > Sebastien. > > > > On Fri, Oct 26, 2012 at 1:17 AM, Sebastien wrote: > > > >> Hi Martin, > >> > >> Thanks for your answer! Yes, I think it - indirectly - answers the need! > >> > >> In short: Google Analytics does not take into account the canonical > links > >> directly (it appears to be for indexing purpose only). However, you put > me > >> on the right direction, and a simple solution is provided here: > >> http://stackoverflow.com/questions/9103794/canonical-url-in-analytics > >> > >> I will give this a try and will let you know! > >> > >> Thanks again & best regards, > >> > >> Sebastien. > >> > >> On Thu, Oct 25, 2012 at 5:17 PM, Martin Grigorov >wrote: > >> > >>> Hi Sebastien, > >>> > >>> Is > >>> > http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html > >>> a solution for this use case ? > >>> > >>> On Thu, Oct 25, 2012 at 5:42 PM, Sebastien wrote: > >>> > Hi, > >>> > > >>> > I have a question related to this thread, how
Call Wicket repeatedly from JQplot (Jquery based) graphing framework
Hi, I would like to call Wicket repeatedly to obtain data from a service for a JQplot chart. I need to do this as the data is obtained from a slow web service. The user will then see a graph that will gradually build up after each new set of data from the server is added to it. I've had some success with this part. The user clicks a button to start building the graph, however, I cannot work out how to call for more data from javaScript to Wicket, then back again from Wicket to javaScript to add the new data to the JQplot graph. Code below (there will be a flag to signal to the javaScript that there's no more graph data, but it's not there yet): public class GraphPanel extends ParentPanel { @SpringBean private GraphDataService graphDataService; private Integer dataId; public GraphPanel ( String id, Integer dataId) { super(id); this.dataId = dataId; buildPage(); } public void buildPage() { //Link used for button to start to obtain chart data add( new AjaxLink( "getGraphData" ){ public void onClick( AjaxRequestTarget target ){ getChartData(target); } } ); //behaviour used to obtain url for call back from javaScript final AbstractDefaultAjaxBehavior jsCallbackBehaviourForMoreChartData = new AbstractDefaultAjaxBehavior() { @Override protected void respond(AjaxRequestTarget target) { getChartData(target); } }; getBasePage().add(jsCallbackBehaviourForMoreChartData); final CharSequence url = jsCallbackBehaviourForMoreChartData.getCallbackUrl(); //behaviour to provide javaScript function which I can call from my javaScript //function if it needs to get more data. This function is not added to mark up... add(new Behavior() { private static final long serialVersionUID = 1L; @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); String js = "function callWicket() { var wcall = wicketAjaxGet ('" + url + ", function() { }, function() { } ) }"; response.renderJavaScript(js, "myScript"); } }); } private void getChartData(AjaxRequestTarget target) { GraphData graphData = null; try { graphData = graphDataService.getChartData(dataId); } catch (GraphDataFailureException e) { // TODO Need to report error to user somehow } //This method just builds a String in the format required for JQplot String jsVar = buildChartDataAsJavaScriptVariable(graphData); String chartTitle = graphData.getTitle(); List namesOfSeriesOnGraph = graphData.getNamesOfGraphSeries(); String legendNames = Arrays.toString(namesOfSeriesOnGraph.toArray(new String[namesOfSeriesOnGraph.size()])); String javaScriptFunctionCall= "buildChart('chartDivContainer',[" + jsVar + "],'" + chartTitle + ", " + legendNames + ")"; target.appendJavaScript(javaScriptFunctionCall); } } I want the abstract Behaviour added to the panel above to provide me with some javaScript so that I can call back to Wicket. This javaScript is not added to the mark up. When I paste the url from the getCallbackUrl() into the browser but I get XML back: buildChart('chartDivContainer',[[[135161736, 22.76].all my graph data. Can anyone point me in the right direction as to what I have to do here or as to what I've missed? Are there any examples that demonstrate how this is done? Also how can I handle exceptions thrown back from the service? That is, present some feedback to the user. Hopefully that is all clear enough, feel free to ask if you need more information. Many thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Call-Wicket-repeatedly-from-JQplot-Jquery-based-graphing-framework-tp4653472.html Sent from the Users forum mailing lis