You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matthijs Wensveen <m....@func.nl> on 2008/06/11 11:34:03 UTC

enclosure around listview

Hi,

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 was 
expecting this would work out-of-the-box though...

Thanks,
Matthijs

-- 
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: enclosure around listview

Posted by Jeremy Thomerson <je...@wickettraining.com>.
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 <m....@func.nl>
wrote:

> Gwyn Evans wrote:
>
>> On Wed, Jun 11, 2008 at 10:34 AM, Matthijs Wensveen <m....@func.nl>
>> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: enclosure around listview

Posted by Matthijs Wensveen <m....@func.nl>.
Gwyn Evans wrote:
> On Wed, Jun 11, 2008 at 10:34 AM, Matthijs Wensveen <m....@func.nl>
> 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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: enclosure around listview

Posted by Gwyn Evans <gw...@gmail.com>.
On Wed, Jun 11, 2008 at 10:34 AM, Matthijs Wensveen <m....@func.nl>
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