The problem I see is
that org.apache.wicket.markup.repeater.AbstractRepeater#onBeforeRender()
calls #onPopulate().
I.e. there is a small window between #onConfigure() (where you make the
check now) and #onBeforeRender() where the list is actually used. And in
this window the list may change in someone's application.

Martin Grigorov
Wicket Training and Consulting


On Mon, May 5, 2014 at 3:13 PM, Martijn Dashorst <[email protected]
> wrote:

> One of the things I dislike is when I have to implement my own
> visibility logic when a ListView is empty, mostly when using
> enclosures to wrap around surrounding markup.
>
> So for a ListView<Address> I have to implement an onConfigure that
> calls setVisible(!getList().isEmpty()); to tell the enclosure that it
> should not render the enclosed markup.
>
> <wicket:enclosure child="addresses">
> <h2>Addresses</h2>
> <dl>
> <wicket:container wicket:id="addresses">
>   <dt>Address</dt>
>   <dd><wicket:container wicket:id="address"></wicket:container></dd>
> </wicket:container>
> </dl>
> </wicket:enclosure>
>
> I figure we can make that the default. There is little point in having
> a visible, empty ListView, is there?
>
> Another option would be to make wicket:enclosure smarter, but that is
> a rabbit hole I'd like leave closed.
>
> Martijn
>

Reply via email to