Hi,

I didn't dig to much into the code, but keep in mind that you are disabling markup caching in your example. This might explain why getMarkup is called three times. Anyway, in your specific case it might be better not to implement IMarkupCacheKeyProvider and IMarkupResourceStreamProvider, but simply override onComponentTagBody like this:

@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
        if (getDefaultModelObject() == null) {
            super.onComponentTagBody(markupStream, openTag);
        }
        else {

replaceComponentTagBody(markupStream, openTag, "<wicket:panel>it works</wicket:panel>");
        }
    }
So debugging a bit, I find that I get hit by the
PanelMarkupSourcingStrategy. It seems it throws away the body markup
in favcor of the associated Markup. So I could advance one step by
extending WebMarkupContainer instead of Panel.

I notice that when extending Panel, getMarkup() is being called 3
times in my example, before the result is being discarded.

That seems like design smell. If users override getMarkup() with some
expensive operation, they should be able to rely on this being called
just once, and this only if the result is actually being used.

On Tue, Sep 16, 2014 at 11:24 AM, Thibault Kruse
<[email protected]> wrote:



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to