TabbedPanel needs at least one tab

26 views
Skip to first unread message

Mario Giammarco

unread,
Mar 25, 2018, 5:29:09 AM3/25/18
to invesdwin-platform
Hello,
I have a list of tabs, I have added this interceptor:

new GeneratedBinding(this).withBindingInterceptor(new BindingInterceptor() {
            @Override
            public Component createTable(final TableHtmlElement e) {

                if (HomeConstants.risultati.equals(e.getWicketId())) {
                    return new ModelTabbedPanel(e);
                }

                return super.createTable(e);
            }

        }).bind();


If the ArrayList is empty (also if it is null?) I get:

org.apache.wicket.WicketRuntimeException: Error attaching this container for rendering: [BorderBodyContainer [Component id = risultati_gridColumn_body]]
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1580)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.markup.html.border.Border.onBeforeRender(Border.java:637)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.markup.html.form.Form.onBeforeRender(Form.java:1807)
    at de.invesdwin.nowicket.component.csrf.CsrfTokenForm.onBeforeRender(CsrfTokenForm.java:33)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.Page.onBeforeRender(Page.java:801)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.Component.internalPrepareForRender(Component.java:2215)
    at org.apache.wicket.Page.internalPrepareForRender(Page.java:242)
    at org.apache.wicket.Component.render(Component.java:2304)
    at org.apache.wicket.Page.renderPage(Page.java:1018)
    at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:124)
    at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:236)
    at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
    at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:865)
    at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
    at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
    at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
    at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
    at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
    at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(ArrayList.java:657)
    at java.util.ArrayList.get(ArrayList.java:433)
    at de.invesdwin.util.collections.delegate.ADelegateList.get(ADelegateList.java:34)
    at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel$VisibilityCache.isVisible(TabbedPanel.java:524)
    at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel.onBeforeRender(TabbedPanel.java:252)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    ... 50 more
WARN  RequestCycleExtra    - ********************************
ERROR faultExceptionMapper - Unexpected error occurred
org.apache.wicket.WicketRuntimeException: Error attaching this container for rendering: [BorderBodyContainer [Component id = risultati_gridColumn_body]]
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1580)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.markup.html.border.Border.onBeforeRender(Border.java:637)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.markup.html.form.Form.onBeforeRender(Form.java:1807)
    at de.invesdwin.nowicket.component.csrf.CsrfTokenForm.onBeforeRender(CsrfTokenForm.java:33)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    at org.apache.wicket.Component.onBeforeRender(Component.java:3877)
    at org.apache.wicket.Page.onBeforeRender(Page.java:801)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.Component.internalPrepareForRender(Component.java:2215)
    at org.apache.wicket.Page.internalPrepareForRender(Page.java:242)
    at org.apache.wicket.Component.render(Component.java:2304)
    at org.apache.wicket.Page.renderPage(Page.java:1018)
    at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:124)
    at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:236)
    at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
    at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:865)
    at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
    at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
    at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
    at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
    at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
    at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(ArrayList.java:657)
    at java.util.ArrayList.get(ArrayList.java:433)
    at de.invesdwin.util.collections.delegate.ADelegateList.get(ADelegateList.java:34)
    at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel$VisibilityCache.isVisible(TabbedPanel.java:524)
    at org.apache.wicket.extensions.markup.html.tabs.TabbedPanel.onBeforeRender(TabbedPanel.java:252)
    at org.apache.wicket.Component.internalBeforeRender(Component.java:949)
    at org.apache.wicket.Component.beforeRender(Component.java:1017)
    at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1568)
    ... 50 more

Edwin Stang

unread,
Mar 25, 2018, 8:53:02 AM3/25/18
to invesdwin-platform
This seems to be a known error that seems to have been fixed earlier in wicket, but seems to have reoccured: https://issues.apache.org/jira/browse/WICKET-2478?attachmentOrder=desc

I have worked around this by disabling the tabbedpanel components if the tabs are empty, thus the beforeRender will not be called anymore. See commit: https://github.com/subes/invesdwin-nowicket/commit/a405de80119acdec93a06e426336d9632dd7ac79

Thanks for reporting.

Mario Giammarco

unread,
Mar 25, 2018, 12:01:13 PM3/25/18
to invesdwin-platform
I have used mvn -U and now I have latest code. Now there are no errors but it seems to me than when I update the page using ajax timer no tabs appear any more.
Is it possible?
Thanks,
Mario

Mario Giammarco

unread,
Mar 25, 2018, 12:12:59 PM3/25/18
to invesdwin-platform

I notice also that the method that returns the arraylist with values to put in tabs now it is called many times than before.

Edwin Stang

unread,
Mar 25, 2018, 12:28:35 PM3/25/18
to invesdwin-platform
I have tried to reproduce your problem, but for me after it is invisible (because empty) at page initialization, then on the first timer request an item gets added, the tab for it gets properly shown. So for me it works.

And yes, any model method can be called multiple times by wicket during a page refresh/rendering lifecycle due to validation and stuff. So nothing too expensive should be done inside of any getter/setter. It is best to keep a list of items somewhere in the model and update that list in a thread safe manner only when changes happen. Or alternatively to poll for changes only once per RequestCycle. You can do this by either checking for a timestamp in your get method to restrict only one update per second or alternatively checking that the RequestCycle.get() object is the same instance as last time. For this you have to add a transient field for the previous System.identityHashCode(RequestCycle.get()) to compare instead of the timestamp. If the identity changed (because a new page refresh is happening), an update should occur and the new identity should be stored in the field.

These are performance considerations for models that need to be considered with any web/UI framework.

Best regards,
Edwin

Mario Giammarco

unread,
Mar 25, 2018, 3:15:49 PM3/25/18
to invesdwin-platform
Sorry I told you about the model called multiple times not because I have performance problems (I have an ArrayList) but because it seems to me that "the engine" is calling it so it should visualise something.
And it call it a lot more than before your latest patch, but I continue to see nothing. I investigate the problem and give you some more info tomorrow.

Edwin Stang

unread,
Mar 25, 2018, 3:24:02 PM3/25/18
to invesdwin-platform
Yes, a lot more often is definitely the case. Because for the workaround in TabbedPanel, every internal access to the list needs to be delegated into the model object. Even with a better solution via IModel this would be required. It is simply more because now it is actually dynamic. ;)

Mario Giammarco

unread,
Mar 26, 2018, 5:58:39 AM3/26/18
to invesdwin-platform

As usual the code example was very useful because I have discovered that now I have to use again                     GuiService.get().processRequestFinally(getComponent());
in the ajax timer to make tabs update.

sub es

unread,
Mar 26, 2018, 6:21:42 AM3/26/18
to Mario Giammarco, invesdwin-platform
Hmm, this might be a valuable hint about how to reproduce the issue. I will try with only updating the tabbed pane again to see if the problem also occurs for me then. If that is the case, it is definitely a bug I will try to fix. Thanks for the info.

--
You received this message because you are subscribed to the Google Groups "invesdwin-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platf...@googlegroups.com.
To post to this group, send email to invesdwin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/invesdwin-platform/61ab6f33-6e7f-41f9-8192-fa45a4ae8f91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mario Giammarco

unread,
Mar 26, 2018, 6:37:58 AM3/26/18
to invesdwin-platform
There is a problem now because using GuiService process request causes a regression when I click on dropdowns while ajax timer got fired.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsub...@googlegroups.com.

sub es

unread,
Mar 26, 2018, 6:51:12 AM3/26/18
to Mario Giammarco, invesdwin-platform
Yes, i think the problem is that when the component is invisible, no tag is available to push the changes from the ajax timer into. We have to enable placeholder tags for these cases so we don't need to push changes to the surrounding panels to get the values updated. I would ideally fix this directly in nowicket, so you don't have to enable the placeholder tags in your code for each case.

And yes, the comboboxes are bad again because they get replaced now again. When my fix is ready you can go back to updating only the tabbed pane.

To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platf...@googlegroups.com.

To post to this group, send email to invesdwin...@googlegroups.com.

Edwin Stang

unread,
Mar 26, 2018, 8:51:02 AM3/26/18
to invesdwin-platform
Please verify that the following commit fixes the problem: https://github.com/subes/invesdwin-nowicket/commit/efa5241493c5d7ea25ecd700a86ec1e76f82bc18

Placeholder tags are now enabled for all generated components, including the TabbedPanel.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsubscribe@googlegroups.com.

To post to this group, send email to invesdwin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/invesdwin-platform/61ab6f33-6e7f-41f9-8192-fa45a4ae8f91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "invesdwin-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsub...@googlegroups.com.
To post to this group, send email to invesdwin-platform@googlegroups.com.

Mario Giammarco

unread,
Mar 26, 2018, 3:16:12 PM3/26/18
to invesdwin-platform
Sorry but without processRequestFinally call it does not update tabs. I can see updated results if I manually reload the page clicking on reload browser button

Edwin Stang

unread,
Mar 26, 2018, 4:22:38 PM3/26/18
to invesdwin-platform
Seems like the gridcolumn border that displays validation errors was causing this problem. Nesting of placeholder tags does not work so it would have been necessary to update the gridcolumn instead of the tabbed pane component (the only thing that gets its placeholder generated in the page html code). Instead of requiring this workaround I fixed this inside the grid column code to not become invisible. Thus the tabbed panel actually renders its placeholder tag inside the grid column and it can properly be updated via ajax. See commit: https://github.com/subes/invesdwin-nowicket/commit/9873c0ef0106962823265562210da20f0212c457

Mario Giammarco

unread,
Mar 27, 2018, 6:14:35 AM3/27/18
to invesdwin-platform
Hello,
the bad news is that without calling processRequestFinally it does not work yet.
the good news is that I call it only when new result is available so I can avoid problems with dropdown boxes.
If you want to proceed with debugging I am ready to test new versions. But for now I keep the processRequestFinally.
Thanks for very good work and help!
Mario

Edwin Stang

unread,
Mar 27, 2018, 6:43:58 AM3/27/18
to invesdwin-platform
Can you send me the html code from your browser "View Source" before any tabs are shown? Then I should see if your structure might have changed or the updated GridColumn code has not been fetched on your side.

Also by analyzing this, you can determine what WicketID/Component you have to add to the ajax response so that the update works. The WicketId/Component needs to be available in the HTML on the client side before the update occurs.

To verify I just changed from processRequestFinally to update only the risultati WicketId/Component in the previous sample I sent you via Mail.

Mario Giammarco

unread,
Mar 27, 2018, 12:27:08 PM3/27/18
to invesdwin-platform
Hello!
Do you want all the page? Pasted here?
Meanwhile I inform you that I have tried to attach ajax timer to several components: risultati, but now I am on "cerca". Now I will try others

sub es

unread,
Mar 27, 2018, 1:20:14 PM3/27/18
to Mario Giammarco, invesdwin-platform
Yes, just add it as an attachment. Or send it via private mail if you don't want to push it here into the public.

To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platf...@googlegroups.com.

To post to this group, send email to invesdwin...@googlegroups.com.

Mario Giammarco

unread,
Mar 27, 2018, 2:34:42 PM3/27/18
to invesdwin-platform
I have attached file I discovered now the attachments option :-)
Please note also that as I said in another post and as you can see wicket:enclosure is not working and I am worried.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsub...@googlegroups.com.
To post to this group, send email to invesdwin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/invesdwin-platform/61ab6f33-6e7f-41f9-8192-fa45a4ae8f91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "invesdwin-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsubscribe@googlegroups.com.
To post to this group, send email to invesdwin...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "invesdwin-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to invesdwin-platform+unsub...@googlegroups.com.
To post to this group, send email to invesdwin...@googlegroups.com.
page.html

Edwin Stang

unread,
Mar 27, 2018, 6:33:39 PM3/27/18
to invesdwin-platform
It seems the code was applied. Though the fix misbehaved when being used with wicket:enclosure and also the validation messages won't get updated when only putting the nested component to the ajax target. Please use the following code in your timer to update the risultati_gridcolumn component properly (which in turn will update its nested risultati component):

final Component risultati = HtmlContext.get(HomePage.this).getComponentRegistry().getComponent(HomeConstants.risultati + GridColumnHtmlElement.GRID_COLUMN_WICKET_ID_SUFFIX);
target.add(risultati);

And make sure all components outside of it are visible or are renderer at least as a placeholder tag in the html code. If that is not the case, you have to add the outer most visible component to the target instead. When an update fails due to this, the wicket debug console (visible inside the browser in development mode) will turn red and tell you about that update error. This should help resolve future instances of this problem.

It was a bad idea to try to allow updating risultati itself. Though if you still want to do it, one option would still be to remove the gridcolumn for risultati entirely from the html markup (since you won't want to display validation errors for the tabbed pane anyway I guess).

Mario Giammarco

unread,
Mar 28, 2018, 5:41:36 AM3/28/18
to invesdwin-platform
I have tried your latest updates now and:
1) wicket:enclosure works perfectly now!!! Great work!
2) ajax update has some problems

Is (obviously) true what you have written below: at application start the tabs arraylist is null  so no tabs are shown. So no updated results are shown. Also no "risultati" label is shown and, as you say, you cannot fire un update on something that is not present on the page.
I have tried to use also HomeConstants.cerca and HomeConstants.ricerca that are always present but without luck.
If I start playing unhiding mctcnc and eucaris very strange things happens: sometims the "risultati" label appears and so replies starts to appear.
I am sending you a private email.

Edwin Stang

unread,
Mar 28, 2018, 10:40:13 AM3/28/18
to invesdwin-platform
Reply all
Reply to author
Forward
0 new messages