I did used a nasty way by using AjaxLazyLoadPanel and providing my custom loading as both - lazy load component (with code in renderHead) and loading component (empty renderHead) . Not the most elegant way but from user point of view its ideal :)
Zbynek On Thu, May 31, 2018, 16:25 Martin Grigorov <mgrigo...@apache.org> wrote: > On Wed, May 30, 2018 at 6:00 PM, Zbynek Vavros <zbynekvav...@gmail.com> > wrote: > > > Hey, > > > > this is weird, I can see the Ajax loading during renderHead() processing > > and then switch to my loading. > > > > Maybe I could describe what I'm doing in more details (with > > AjaxLazyLoadPanel being used): > > Loader from AjaxLazyLoadPanel is displayed. > > Remote REST is being called, response from REST is passed to JS function > - > > at this moment my panel is rendered. > > JS then calls remote service via websocket, receives response, passed > that > > response to Wicket JS callback function. > > This calls yet another REST endpoint and saves result into DB. > > > > After that I replace my loading with success message. > > > > I would like to "ideally" have all this covered by single loading panel. > > > > You will need to create a custom Panel to do all this. > I guess you can still use AjaxLazyLoadPanel if you use Java WebSocket > client, but this is something you have to decide. > > > > > > Zbynek > > > > > > On Wed, May 30, 2018 at 3:32 PM, Martin Grigorov <mgrigo...@apache.org> > > wrote: > > > > > Hi, > > > > > > Do you use AjaxLazyLoadPanel for the loading image + result panel ? > > > You can move your #renderHead() logic to the result panel's > renderHead(). > > > > > > On Wed, May 30, 2018 at 3:05 PM, Zbynek Vavros <zbynekvav...@gmail.com > > > > > wrote: > > > > > > > Hi, > > > > > > > > I got a wizard and one of its steps display loading image while > > > > processing long running task. After this task JavaScript is being > > called. > > > > > > > > I've put the code into render renderHead() method of the step itself: > > > > > > > > @Override > > > > public void renderHead(IHeaderResponse response) { > > > > // process task > > > > String taskResult = ... > > > > // call JavaScript with result > > > > response.render(OnDomReadyHeaderItem.forScript("jsFunction(" + > > > > taskResult + ")")); > > > > } > > > > > > > > When I click the NEXT button, this long running task is executed > before > > > > the step with loading image is rendered. > > > > I guess I need to move the code somewhere else than renderHead() but > > > where? > > > > > > > > Thanks, > > > > Zbynek > > > > > > > > > >