Paste code of what you're looking to do.  Your description seems like the
right way to do it.  If you want that "out of the box", just roll your own
NotVisibleIfEmptyListView that overrides isVisible.  Like:

public abstract class NotVisibleIfEmptyListView<T> extends ListView<T> {

    private static final long serialVersionUID = 1L;

    public NotVisibleIfEmptyListView(String id, IModel<List<T>> model) {
        super(id, model);
    }

    @Override
    public boolean isVisible() {
        return CollectionUtils.isEmpty(getModelObject()) == false;
    }
}

If you have other related markup (like you'll commonly have a <UL> tag, and
the list view is in your <LI> tag, just put a wicket enclosure around the
related markup (as you mentioned), and make it depend on the visibility of
the list view.


-- 
Jeremy Thomerson
http://www.wickettraining.com

On Wed, Jun 11, 2008 at 10:33 AM, Matthijs Wensveen <[EMAIL PROTECTED]>
wrote:

> Gwyn Evans wrote:
>
>> On Wed, Jun 11, 2008 at 10:34 AM, Matthijs Wensveen <[EMAIL PROTECTED]>
>> wrote:
>>
>>
>>
>>> Is there a way to hide a listview with an enclosure when there are no
>>> items
>>> to display? One way to get it working is to toggle the visibility of the
>>> listview based on wheter or not the list is empty or not.
>>>
>>>
>>
>>
>> I think that's the normal way, in that you'd typically have both the list
>> and a "No items found" label, then set one or the other as visible...
>>
>>
>>
>>
>>> I was expecting this would work out-of-the-box though...
>>>
>>>
>>>
>>
>> JIRA (https://issues.apache.org/jira/browse/WICKET) covers "Wishes" as
>> well
>> as "Bugs"! :-)
>>
>> /Gwyn
>>
>>
>>
> I wish I knew what to wish for exactly... :D
>
> Thanks,
> Matthijs
>
> --
> Matthijs Wensveen
> Func. Internet Integration
> W http://www.func.nl
> T +31 20 4230000
> F +31 20 4223500
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to