Re: is there any way to externalize wicket-event.js
Thank you both for your time and attention. Joe On Fri, Jun 17, 2011 at 7:15 PM, Chris Colman chr...@stepaheadsoftware.com wrote: I'm not sure if this is related to your problem but I see a few server errors relating to the fetching of wicket-event.js and I discovered it's because some agent (crappy browser or crappy bot) is ignoring the case sensitive nature of the .js resource name and making a request with all lowercase letters in path and filename to the web app which then can't locate it because it's doing a case sensitive look up. -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Saturday, 18 June 2011 1:33 AM To: users@wicket.apache.org Subject: Re: is there any way to externalize wicket-event.js i would figure out why the content is returned with a 304 header. further, when people are looking to optimize these kinds of things they put a caching proxy infront of the app server and tell it to cache js, css, and other staticy files -igor On Fri, Jun 17, 2011 at 8:18 AM, Joe Hudson joe...@gmail.com wrote: Hi, I for looking at ways of optimizing a wicket application. And, while a 304 is returned for wicket-event.js requests, the resource content is returned as well. Is there any optimizations that can be applied here? Ideally I would like to host these files (and probably change their name to have the wicket version) directly through Apache. I have poked around in the code and all I can see to do is change HtmlHeaderResolver. But since this is in Application.internalInit I am hesitant to do so. Any suggestions would be appreciated. Thanks. Joe - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
is there any way to externalize wicket-event.js
Hi, I for looking at ways of optimizing a wicket application. And, while a 304 is returned for wicket-event.js requests, the resource content is returned as well. Is there any optimizations that can be applied here? Ideally I would like to host these files (and probably change their name to have the wicket version) directly through Apache. I have poked around in the code and all I can see to do is change HtmlHeaderResolver. But since this is in Application.internalInit I am hesitant to do so. Any suggestions would be appreciated. Thanks. Joe - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: strange problem with redirect to buffer and URL encoded query string
Thank you very much for the response, Igor. After looking into this further it seems we might be having problems with MobileAware. AFAICT their implementation of encodeRedirectUrl and sendRedirect perform URL encoding differently. Thanks again. Joe On Sat, Nov 6, 2010 at 10:38 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: trace the java side to see what is encoding the url. it may be a number of things, but since its only happennig to you its probably something in your environment. also what version of wicket are you running? -igor On Fri, Nov 5, 2010 at 8:01 AM, Joe Hudson jhud...@interviewbot.com wrote: Hi, I am using a AjaxFallbackButton within a form. In this case the response is saved to a buffer in the session and supposed to be retrieved in the next page request. The problem that I am facing is that the second request is providing URL encoded query string and I can't figure out why... Here is what I have tracked down: The redirect is set by the listener interface request target: boolean issueRedirect = (strategy == IRequestCycleSettings.REDIRECT_TO_RENDER || strategy == IRequestCycleSettings.REDIRECT_TO_BUFFER); * I am set to REDIRECT_TO_BUFFER In WebApplication.addBufferedResponse, we are properly adding the buffered response to the map with the key of wicket:interface=:0 In the BufferedWebResponse, we are calling httpServletResponse.sendRedirect(url) with the value of wicket:interface=:0 * note: the value is URL encoded but even after encoding does not change from wicket:interface=:0 On the next call, the query string retreived in WicketFilter (String queryString = servletRequest.getQueryString();) is wicket%3Ainterface=%3A0%3A%3A%3A%3A This causes the call to webApplication.popBufferedResponse to execute with the wrong key which of course finds no buffered response. * I have verified at this time that the valid buffered response is still there under the key of wicket:interface=:0 * I do get a response back except that all component error messages do not show up because they were rendered to the buffer. Can anyone please help me understand what is gong on here? I have tried evaluating this in firebug to see where this strange URL encoding is coming from but all I see in Firebug when I look at the response is Failed to load source for: {context}?wicket:interface=:0:wizard:form::IFormSubmitListener::. I am using Wicket version 1.4.12 on Ubuntu and have tried this in both Chrome and FireFox with the same result. Any help would be greatly appreciated. Thanks. Joe - 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
strange problem with redirect to buffer and URL encoded query string
Hi, I am using a AjaxFallbackButton within a form. In this case the response is saved to a buffer in the session and supposed to be retrieved in the next page request. The problem that I am facing is that the second request is providing URL encoded query string and I can't figure out why... Here is what I have tracked down: The redirect is set by the listener interface request target: boolean issueRedirect = (strategy == IRequestCycleSettings.REDIRECT_TO_RENDER || strategy == IRequestCycleSettings.REDIRECT_TO_BUFFER); * I am set to REDIRECT_TO_BUFFER In WebApplication.addBufferedResponse, we are properly adding the buffered response to the map with the key of wicket:interface=:0 In the BufferedWebResponse, we are calling httpServletResponse.sendRedirect(url) with the value of wicket:interface=:0 * note: the value is URL encoded but even after encoding does not change from wicket:interface=:0 On the next call, the query string retreived in WicketFilter (String queryString = servletRequest.getQueryString();) is wicket%3Ainterface=%3A0%3A%3A%3A%3A This causes the call to webApplication.popBufferedResponse to execute with the wrong key which of course finds no buffered response. * I have verified at this time that the valid buffered response is still there under the key of wicket:interface=:0 * I do get a response back except that all component error messages do not show up because they were rendered to the buffer. Can anyone please help me understand what is gong on here? I have tried evaluating this in firebug to see where this strange URL encoding is coming from but all I see in Firebug when I look at the response is Failed to load source for: {context}?wicket:interface=:0:wizard:form::IFormSubmitListener::. I am using Wicket version 1.4.12 on Ubuntu and have tried this in both Chrome and FireFox with the same result. Any help would be greatly appreciated. Thanks. Joe - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: sanity check request for fix regarding the dreaded PageExpiredException
Thanks Igor and Alex for the feedback. It is very much appreciated! Joe -Original Message- From: Alex Rass [mailto:a...@itbsllc.com] Sent: Monday, September 27, 2010 11:47 AM To: users@wicket.apache.org Subject: RE: sanity check request for fix regarding the dreaded PageExpiredException Igor's is 100% right Plus you are forgetting that if you use the default page url constructor - it goes by interface number which will/may change after a redeploy. So your lost url bullet can be fixed if you use some url creation strategy that solidifies in it enough of the path that you can recreate your last page location Then maybe add the important parts of the user state to the same strategy and you are there. There are a bunch of examples on how to do this, but I am feeling too lazy to go search ;) - Alex -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Monday, September 27, 2010 11:28 AM To: users@wicket.apache.org Subject: Re: sanity check request for fix regarding the dreaded PageExpiredException you can try it and see if it works for your particular usecases. there may still be some edges that will break, like links you actually want to run against an older version of the page because they depend on the component hierarchy that existed then, etc. -igor On Fri, Sep 24, 2010 at 7:56 AM, Joe Hudson joe.hud...@clear2pay.com wrote: Hi, I know there have been several existing topics around this issue (http://apache-wicket.1842946.n4.nabble.com/debugging-PageExpiredExceptions- td1882040.html) for example. The reason that I am asking for a sanity check is because I plan to use an alternative approach to solving this issue and would like feedback to make sure there isn't a reason I shouldn't be doing this. The common approach is to catch the exception and return a new instance of the requested page. This seems to have some key drawbacks IMHO: 1) this only works with bookmarkable links 2) you lose any modifications to the model that happened after the page was originally loaded but before the exception occured 3) any data on the client may potentially be out of sync with the server state if not updated by the request that caused the exception (because the new page was loaded but that client representation is still a picture of the previous page with the previous model). Although this would be resolved by a form submit behavior - you would still have problems in the exceptional cases where the model is updated individually by input field ajax change events. It seems that the page version number is only necessary for a stateless application and in an ajax-oriented application you would always want to work with the latest page version. We seem to hit these issues when multiple ajax requests that target a particular page happen concurrently because the page version is incremented when the initial ajax request is made but all other ajax requests that are initiated before the initial ajax request response reference a now outdated page version number. So, after all that background - do you think this is a valid fix for an ajax-oriented application: Override the default SecondLevelCachePageMap and as long as the requested page id matches the page id of getLastPage() just return the last page. Your thoughts would be appreciated and sorry for the long email but I wanted to provide background to make sure that the fix was valid for my particular solution (because I know the fix would not be appropriate for a stateless application). Thanks Joe Hudson - 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
sanity check request for fix regarding the dreaded PageExpiredException
Hi, I know there have been several existing topics around this issue (http://apache-wicket.1842946.n4.nabble.com/debugging-PageExpiredExceptions-td1882040.html) for example. The reason that I am asking for a sanity check is because I plan to use an alternative approach to solving this issue and would like feedback to make sure there isn't a reason I shouldn't be doing this. The common approach is to catch the exception and return a new instance of the requested page. This seems to have some key drawbacks IMHO: 1) this only works with bookmarkable links 2) you lose any modifications to the model that happened after the page was originally loaded but before the exception occured 3) any data on the client may potentially be out of sync with the server state if not updated by the request that caused the exception (because the new page was loaded but that client representation is still a picture of the previous page with the previous model). Although this would be resolved by a form submit behavior - you would still have problems in the exceptional cases where the model is updated individually by input field ajax change events. It seems that the page version number is only necessary for a stateless application and in an ajax-oriented application you would always want to work with the latest page version. We seem to hit these issues when multiple ajax requests that target a particular page happen concurrently because the page version is incremented when the initial ajax request is made but all other ajax requests that are initiated before the initial ajax request response reference a now outdated page version number. So, after all that background - do you think this is a valid fix for an ajax-oriented application: Override the default SecondLevelCachePageMap and as long as the requested page id matches the page id of getLastPage() just return the last page. Your thoughts would be appreciated and sorry for the long email but I wanted to provide background to make sure that the fix was valid for my particular solution (because I know the fix would not be appropriate for a stateless application). Thanks Joe Hudson
rendering Wicket components to HTML
Hi, First of all, before I get flamed - I've seen many topics about this since I've been looking into this: http://www.mail-archive.com/users@wicket.apache.org/msg27512.html http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ http://apache-wicket.1842946.n4.nabble.com/Wicket-PDF-Page-Project-td1934168.html My problem is that I am trying to get the rendered contents of a Page to hopefully post process it and make a PDF out of it (using Flying Saucer) - because of this I need to reference the currently running application for the WicketTester (otherwise the application properties aren't available) So, the standard WicketTester approach looks like this as far as I can tell: public static String toString(Class? extends Page pageClass) { final WicketTester renderer = new WicketTester((WebApplication) Application.get()); renderer.startPage(pageClass); String renderedSource = renderer.getServletResponse().getDocument(); return renderedSource; } The problem with this approach is that the init method of the application now runs twice (once when the app starts and once when this code runs). This is causing an error because we are mounting resources which don't like being mounted twice. I have tried the other approach suggested from Dan Walmsley and haven't had any luck with this either - can anyone get this to work? Am I just making this terribly hard on myself - is it really this complicated to render a Page to a String? Thanks very much for any feedback you might be able to offer. Joe
RE: any good ideas about how to add a confirm check before leaving a page?
Thank you all for your feedback. This helps. Joe -Original Message- From: Rodolfo Hansen [mailto:kry...@gmail.com] Sent: Tuesday, August 10, 2010 12:30 PM To: users@wicket.apache.org Subject: Re: any good ideas about how to add a confirm check before leaving a page? On Tue, 2010-08-10 at 16:08 +0200, Leszek Gawron wrote: On 2010-08-10 15:11, Joe Hudson wrote: Thank you very much for the response but my issue is not a simple as this Say I have a page with navigation links and the page doesn't know about the navigation links because they are controlled by functionality provided in the superclass. What I am trying to do is deal with the case where the user clicks a link of that type and intercept that event. Does anyone have any advice? Thanks. Do you need to intercept the event or just as user for permission to leave the page? If the latter: https://cwiki.apache.org/WICKET/composite-behaviors.html You can also find an implemented version of this behaviour here: http://code.google.com/p/koodaripalvelut-wicket/ You would want the change detector project. If your requirements are more conplex and you need to add a behavior to that link specifically, (to do something on the server, you should just add a AjaxEventBehaviour for that button, or simply do a replace(Component) on your child page.
RE: any good ideas about how to add a confirm check before leaving a page?
Thank you very much for the response but my issue is not a simple as this Say I have a page with navigation links and the page doesn't know about the navigation links because they are controlled by functionality provided in the superclass. What I am trying to do is deal with the case where the user clicks a link of that type and intercept that event. Does anyone have any advice? Thanks. Joe -Original Message- From: vov [mailto:vov...@mail.ru] Sent: Thursday, August 05, 2010 9:43 AM To: users@wicket.apache.org Subject: Re: any good ideas about how to add a confirm check before leaving a page? Hi, Do not forget to use google before posting the question :) http://wicketbyexample.com/wicket-ajax-confirmation-modal-window/ -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/any-good-ideas-about-how-to-add-a-confirm-check-before-leaving-a-page-tp2314872p2314880.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
any good ideas about how to add a confirm check before leaving a page?
Hi, I'm wondering if anyone has had to tackle this before and might have any advice. I'm working on an application that needs to do a confirm before leaving a page if the use clicked on another link in the application. Does anyone have any ideas about how this could be done? Thank you very much. Joe
how to have an html id in markup and support ajax behavior?
Hello, I need a component to have an html id that I set in markup because I'm referencing it in other places. I also need to have the setOutputMarkupId(true) on the component because I need to support ajax behaviors. The problem that I am facing is that when I call setOutputMarkupId(true) it overrides the static id I set in the markup. Is there any way I can deal with this? Thanks. Joe
what is the proper way to handle success message within a feedback panel
Hello, It seems that the only levels of feedback message are: -DEBUG -ERROR -FATAL -INFO -UNDEFINED -WARNING I'm just wondering what the best practice is for success messages are. Thanks. Regards, Joe
RE: is it possible to somehow create a url to return the contents of a panel
Thank you so much for the response, that was very helpful. So, I've got half of the equation figured out but now, I have the issue of how to generate a URL that call a component that allows for a straight HTML response. Here is the issue now: Component someMadeUpAjaxComponent = ... { onClick(AjaxRequestTarget target) { // return the component output } } 1) Is there a component (the someMadeUpAjaxComponent) that I can get a URL for which will trigger the onClick method 2) I need to attach the URL for the component to a link - not add the component directly - is this possible? 3) Given an AjaxRequestTarget, is there any way I can write out the HTML response (as opposed to adding components for rendering)? Because, the result will look something like this: a href={the AJAX URL that will respond with the component HTML content}View Details/a I will then attach a tooltip to this link which will know that it can take the href attribute of the link to obtain the tooltip content. Thank you very much for any help you could offer. Joe -Original Message- From: Jeremy Thomerson [mailto:jer...@wickettraining.com] Sent: Wednesday, September 30, 2009 9:15 PM To: users@wicket.apache.org Subject: Re: is it possible to somehow create a url to return the contents of a panel search this list for how to generate emails with wicket. there are a bunch of posts of that sort. that will teach you how to render a component to a string. this could be used to return the contents. -- Jeremy Thomerson http://www.wickettraining.com On Wed, Sep 30, 2009 at 8:10 PM, Joe Hudson joe.hud...@clear2pay.comwrote: Hi - hopefully I can explain this clearly... I understand that I can use the AjaxEventBehavior to refresh the contents of any components that I have on the screen or add new components. I am trying to use a tooltip to display additional details for grid data. I plan to use a tooltip library which supports retrieving content via an ajax call. The question is: how (or is it possible at all) can I take a Panel and get a url that would return the contents of that Panel. I'm probably not explaining this well so, here is an example: AbstractLink link = createLink(IModel rowModel); Private AbstractLink createLink(IModel rowModel) { // I need to return a URL which would contain the contents of the additional details panel // for this particular row in the grid // the tooltip library will use the href attribute of this link to dynamically retrieve the contents of the tooltip when displayed } Any help or ideas would be greatly appreciated. Thanks. Joe - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: is it possible to somehow create a url to return the contents of a panel
So, it is looking like I could do something like this: LinkString link = new AjaxLinkString(componentId, new ModelString(View Details)) { @Override public void onClick(AjaxRequestTarget target) { String resultHTML = convertPanelToHTML(); // I understand this // how can I override the target response with the result HTML? } }; 1) I just want to return straight HTML (not contents within the ajax-response node) 2) I need the link to return the contents directly (not handle the contents with the Wicket ajax javascript code) Is type of behavior possible? If not, does anyone have any other ideas as to how I could show a dynamic tooltip with data retrieved using ajax? Thank you very much. Joe -Original Message- From: Pedro Santos [mailto:pedros...@gmail.com] Sent: Thursday, October 01, 2009 8:19 AM To: users@wicket.apache.org Subject: Re: is it possible to somehow create a url to return the contents of a panel 1) Is there a component (the someMadeUpAjaxComponent) that I can get a URL for which will trigger the onClick method http://wicket.apache.org/docs/1.4/org/apache/wicket/IRequestTarget.html http://wicket.apache.org/docs/1.4/org/apache/wicket/behavior/AbstractAjaxBehavior.html#getCallbackUrl%28%29 2) I need to attach the URL for the component to a link - not add the component directly - is this possible? I don't understand. Is possible to do a lot overriding onComponentTag, onRender, 3) Given an AjaxRequestTarget, is there any way I can write out the HTML response (as opposed to adding components for rendering)? you can append javascript to response... On Thu, Oct 1, 2009 at 9:11 AM, Joe Hudson joe.hud...@clear2pay.com wrote: Thank you so much for the response, that was very helpful. So, I've got half of the equation figured out but now, I have the issue of how to generate a URL that call a component that allows for a straight HTML response. Here is the issue now: Component someMadeUpAjaxComponent = ... { onClick(AjaxRequestTarget target) { // return the component output } } 1) Is there a component (the someMadeUpAjaxComponent) that I can get a URL for which will trigger the onClick method 2) I need to attach the URL for the component to a link - not add the component directly - is this possible? 3) Given an AjaxRequestTarget, is there any way I can write out the HTML response (as opposed to adding components for rendering)? Because, the result will look something like this: a href={the AJAX URL that will respond with the component HTML content}View Details/a I will then attach a tooltip to this link which will know that it can take the href attribute of the link to obtain the tooltip content. Thank you very much for any help you could offer. Joe -Original Message- From: Jeremy Thomerson [mailto:jer...@wickettraining.com] Sent: Wednesday, September 30, 2009 9:15 PM To: users@wicket.apache.org Subject: Re: is it possible to somehow create a url to return the contents of a panel search this list for how to generate emails with wicket. there are a bunch of posts of that sort. that will teach you how to render a component to a string. this could be used to return the contents. -- Jeremy Thomerson http://www.wickettraining.com On Wed, Sep 30, 2009 at 8:10 PM, Joe Hudson joe.hud...@clear2pay.com wrote: Hi - hopefully I can explain this clearly... I understand that I can use the AjaxEventBehavior to refresh the contents of any components that I have on the screen or add new components. I am trying to use a tooltip to display additional details for grid data. I plan to use a tooltip library which supports retrieving content via an ajax call. The question is: how (or is it possible at all) can I take a Panel and get a url that would return the contents of that Panel. I'm probably not explaining this well so, here is an example: AbstractLink link = createLink(IModel rowModel); Private AbstractLink createLink(IModel rowModel) { // I need to return a URL which would contain the contents of the additional details panel // for this particular row in the grid // the tooltip library will use the href attribute of this link to dynamically retrieve the contents of the tooltip when displayed } Any help or ideas would be greatly appreciated. Thanks. Joe - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
is it possible to somehow create a url to return the contents of a panel
Hi - hopefully I can explain this clearly... I understand that I can use the AjaxEventBehavior to refresh the contents of any components that I have on the screen or add new components. I am trying to use a tooltip to display additional details for grid data. I plan to use a tooltip library which supports retrieving content via an ajax call. The question is: how (or is it possible at all) can I take a Panel and get a url that would return the contents of that Panel. I'm probably not explaining this well so, here is an example: AbstractLink link = createLink(IModel rowModel); Private AbstractLink createLink(IModel rowModel) { // I need to return a URL which would contain the contents of the additional details panel // for this particular row in the grid // the tooltip library will use the href attribute of this link to dynamically retrieve the contents of the tooltip when displayed } Any help or ideas would be greatly appreciated. Thanks. Joe
is it possible to include script resources using the HeaderContributor above the WebPage component script references
Hello, I would like for the script included using a HeaderContributor to be above script references within the WebPage component head node. Is this possible. The reason I would like to do this is because I would like to be able to reference code from the script file which is included using the HeaderContributor. For example: --- Application class --- // inside init method addComponentInstantiationListener(new IComponentInstantiationListener() { public void onInstantiation(Component component) { if (component instanceof WebPage) { component.add(new HeaderContributor(new IHeaderContributor() { public void renderHead(IHeaderResponse response) { response.renderJavascriptReference(new JavascriptResourceReference(MyReferenceClass.class, scripts/example.js)); } })); } } }); // WebPage component template head script type=text/javascript ... // I can't reference anything from the scripts/example.js because the source reference appears below this in the rendered output /script /head By the way, please tell me if this is bad code and there is a better way as I am very new to Wicket. All code criticism is welcomed :) Thanks. Joe
using behaviors as borders - how to?
Hello, I would like to add a behavior to a component which alters the HTML output related to that component. I know that you can use setComponentBorder but I saw a posting that mentioned behaviors were the more appropriate way to do this as explicit component borders might become deprecated. I am trying to do something simple like wrap a form component with a label. For example: Instead of a form component rendering as: input type=text .../ I would like the behavior to help the component to render as lilabelSome Label/label input type=text ...//li So, the label component would be responsible for wrapping the inner content with: lilabelSome Label/label {inner content} /li Here is where I am at: - I know I probably want to extend AbstractBehavior - I know I probably want to use the beforeRender and afterRender methods to do this Would anyone be able to give me some pointers to get started on this? Thank you very much. Regards, Joe
RE: using behaviors as borders - how to?
Thank you Peter. That link was extremely helpful! Joe -Original Message- From: Peter Thomas [mailto:ptrtho...@gmail.com] Sent: Thursday, August 27, 2009 8:12 AM To: users@wicket.apache.org Subject: Re: using behaviors as borders - how to? On Thu, Aug 27, 2009 at 5:31 PM, Joe Hudson joe.hud...@clear2pay.comwrote: Hello, I would like to add a behavior to a component which alters the HTML output related to that component. I know that you can use setComponentBorder but I saw a posting that mentioned behaviors were the more appropriate way to do this as explicit component borders might become deprecated. I am trying to do something simple like wrap a form component with a label. For example: Instead of a form component rendering as: input type=text .../ I would like the behavior to help the component to render as lilabelSome Label/label input type=text ...//li So, the label component would be responsible for wrapping the inner content with: lilabelSome Label/label {inner content} /li Here is where I am at: - I know I probably want to extend AbstractBehavior - I know I probably want to use the beforeRender and afterRender methods to do this Would anyone be able to give me some pointers to get started on this? Thank you very much. Al Maw's Forms With Flair presentation is a good start, you can find it here: http://jweekend.co.uk/dev/ArticlesPage Regards, Joe - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: javascript effects before an ajax call
How can you make the script sources that you reference in your web page show up after the component wicket script includes? (assuming you don't want to do this inline) I would like to override the Wicket.replaceOuterHtml function because I would like to do some jquery dom post processing. But whenever I include javascript, it is above all other script includes in the rendered output. To override, it must be included below the Wicket script includes. Thanks. Joe -Original Message- From: Antony Stubbs [mailto:antony.stu...@gmail.com] Sent: Tuesday, August 18, 2009 9:04 AM To: Antony Stubbs Cc: users@wicket.apache.org; Martijn Dashorst; Matej Knopp Subject: Re: javascript effects before an ajax call Here's the more readable version - corrected with help form Richard at JWeekend... This is the easiest way to do the animation either side of the Wicket replace function that I know of... If someone would like to wrap this up into a nice behaviour for the Scriptaculous wicketstuff library be my guest :) I probably will eventually if we get back to the project that uses it. script type=text/javascript!-- var oldF = Wicket.replaceOuterHtml Wicket.replaceOuterHtml=function(element, text) { var parent = $(element.id).parentNode; // the disappear animation $(element.id).fade({ duration: 0.4, afterFinish: function(effect) { // call replace function oldF(element, text) // render the appear animtion on the replaced element $(element.id).appear({ duration: 0.4}); }}); } --/script Cheers, Antony Stubbs, sharca.com On 29/07/2009, at 4:54 AM, Antony Stubbs wrote: I have a workaround and it goes a little something like this: script type=text/ javascriptWicket.replaceOuterHtml=function(element, text) { new $(element.id).fade({ duration: 0.4, afterFinish: function(effect) { if (Wicket.Browser.isIE()) { Wicket.replaceOuterHtmlIE(element, text); } else if (Wicket.Browser.isSafari() || Wicket.Browser.isOpera()) { Wicket.replaceOuterHtmlSafari(element, text); } else /* GECKO */ { // create range and fragment var range = element.ownerDocument.createRange(); range.selectNode(element); var fragment = range.createContextualFragment(text); element.parentNode.replaceChild(fragment, element); } $(element.id).appear({ duration: 0.4}); }}); } /script Putting that at the top of the html overrides the wicket function, adds in a javascript effect, then using the onFinish hook, runs the original Wicket code, the precedes with another effect. This makes the effects run immediately after the ajax call has completed... This adds a fade transition every time wicket replaces a dom element. A better version would allow you to do it with some hooks, passing in your transition functions. 2009/7/28 Antony Stubbs antony.stu...@gmail.com (sorry, sent to wrong list before) Is it possible to override certain methods in wicketajax.js ? In order to modify the behaviour of one of the methods. but i'd prefer not to run a patched wicket, or have to run on a copy of the whole wicketajax.js file - but i will if i have to :/ what i want to do is add pre and post hooks processComponent#Wicket.replaceOuterHtml function - as this will solve what I want to do - i.e. run an animation on the element to be replaced, after the ajax call completes, but before the element is replaced. p.s. martijn, is there any info available on the plan for the new ajax system? I just found - there is a post animation hook in Scriptaculous, which I have working to run the ajax request in, however this doesn't quite get there, as there's is of course the delay between when the animation finishes, and when the ajax request actually completes - which is too long. Update: I've tried overriding the js functions like this: script type=text/javascript function newProcessComponent: function(steps, node) { alert('replaced!'); } Wicket.Ajax.Call.prototype.processComponent = newProcessComponent /script script type=text/javascriptWicket.replaceOuterHtml=function() {alert('replaceOuterHtml');}/script script type=text/ javascriptWicket.Ajax.Call.prototype.processComponent: function(steps, node) {{alert('processComponent');}/script but only the replaceOuterHtml functions works, i think because the there's a difference because processComponent is a member of an object... I need to
how to include head resources below generated component additions to head
Hello, I would like to override some of the styles of components I am using in my page. However, when I include a CSS resource at the head of my WebPage component, the incude occurs above all of the component includes. Is there any way I can specify for an include to be below component includes that I am using inside my WebPage component? For example: Here is example markup for the web page component html head link rel=stylesheet type=text/css href=styles/style.css / /head body Using some component here /body /html The output is something like this: html head link rel=stylesheet type=text/css href=styles/style.cssview-source:http://localhost:8080/wicket/styles/style.css/ script type=text/javascript src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.jsview-source:http://localhost:8080/wicket/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.jsview-source:http://localhost:8080/wicket/resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.jsview-source:http://localhost:8080/wicket/resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script ... /head body ... The output that I would like to achieve is something like this: html head script type=text/javascript src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.jsview-source:http://localhost:8080/wicket/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.jsview-source:http://localhost:8080/wicket/resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.jsview-source:http://localhost:8080/wicket/resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script ... link rel=stylesheet type=text/css href=styles/style.cssview-source:http://localhost:8080/wicket/styles/style.css/ /head body Is there some kind of component or application setting for this? Thanks very much for the help. Joe