Re: Re: Re: Re: ListItem and enclosure problem
you're wellcome! On Thu, Jun 8, 2017 at 12:42 PM, Per Newgro wrote: > Thanks a lot Andrea, > > that did work. Now i get only markup of visible items. > > My Solution looks now: > > > ListViewEnclosurePage.html > > http://wicket.apache.org";> > > > > > > > > > > [Content] > > > > > > > > ListViewEnclosurePage$MyListView.java > public static class MyListView extends ListView { > > public MyListView( > String id, > List list) { > super(id, list); > } > > @Override > protected void populateItem(ListItem item) { > Label label = new Label("bar", item.getModel()); > item.add(label); > if (item.getIndex() == 1) { > item.setVisible(false); > } > } > } > > > Thanks for your support > Per > > > Gesendet: Donnerstag, 08. Juni 2017 um 12:30 Uhr > > Von: "Andrea Del Bene" > > An: users@wicket.apache.org > > Betreff: Re: Re: Re: ListItem and enclosure problem > > > > Just use: > > > > item.setVisible(false); > > > > instead of: > > > > label.setVisible(false); > > > > On Thu, Jun 8, 2017 at 12:23 PM, Per Newgro wrote: > > > > > But wouldn't this only hide the complete listview when there is no > item? > > > I want to remove markup only for an empty item. > > > > > > So something like > > > > > > 1 > > > 2 > > > 3 > > > > > > > > > should become in case foo:1:bar is invisible > > > > > > > > > 1 > > > 3 > > > > > > > > > Thank you > > > Per > > > > > > > Gesendet: Donnerstag, 08. Juni 2017 um 11:40 Uhr > > > > Von: "Andrea Del Bene" > > > > An: users@wicket.apache.org > > > > Betreff: Re: Re: ListItem and enclosure problem > > > > > > > > Sorry, in your case this HTML should work better: > > > > > > > > > > > > > > > > > > > >[Content] > > > > > > > > > > > > > > > > > > > > Then in your MyListView override onConfigure with something like > this: > > > > > > > > void onConfigure() { > > > >super.onConfigure(); > > > > setVisible(getModelObject().size() > 0); > > > > } > > > > > > > > > > > > On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro > wrote: > > > > > > > > > Sorry Ernesto for my bad english. But i can not see how i shall get > > > this > > > > > to work with a panel? > > > > > I use a listview because my item count is configurable. So i can > not > > > > > generate a "template panel" > > > > > and put all items in that. But i admit that i didn't understand > your > > > > > question completely. > > > > > > > > > > Thanks > > > > > Per > > > > > > > > > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > > > > > > Von: "Ernesto Reinaldo Barreiro" > > > > > > An: "users@wicket.apache.org" > > > > > > Betreff: Re: ListItem and enclosure problem > > > > > > > > > > > > Why to not put the thing in a panel? > > > > > > > > > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro > > > wrote: > > > > > > > > > > > > > Hello, > > > > > > > > > > > > > > i would like to enclose markup of a list item in > wicket:enclosure. > > > The > > > > > > > enclosure is activated based on a child component on list item. > > > > > > > So for i could not find any marker that this is not working. > So i > > > need > > > > > to > > > > > > > do something wrong. Any work around would be welcome. > > > > > > > > > > > > > > Thanks for your support > > > > > > > Per > > > > > > > > > > > > > > > > > > > > > WicketApplication.java > > > > > > > p
Aw: Re: Re: Re: ListItem and enclosure problem
Thanks a lot Andrea, that did work. Now i get only markup of visible items. My Solution looks now: ListViewEnclosurePage.html http://wicket.apache.org";> [Content] ListViewEnclosurePage$MyListView.java public static class MyListView extends ListView { public MyListView( String id, List list) { super(id, list); } @Override protected void populateItem(ListItem item) { Label label = new Label("bar", item.getModel()); item.add(label); if (item.getIndex() == 1) { item.setVisible(false); } } } Thanks for your support Per > Gesendet: Donnerstag, 08. Juni 2017 um 12:30 Uhr > Von: "Andrea Del Bene" > An: users@wicket.apache.org > Betreff: Re: Re: Re: ListItem and enclosure problem > > Just use: > > item.setVisible(false); > > instead of: > > label.setVisible(false); > > On Thu, Jun 8, 2017 at 12:23 PM, Per Newgro wrote: > > > But wouldn't this only hide the complete listview when there is no item? > > I want to remove markup only for an empty item. > > > > So something like > > > > 1 > > 2 > > 3 > > > > > > should become in case foo:1:bar is invisible > > > > > > 1 > > 3 > > > > > > Thank you > > Per > > > > > Gesendet: Donnerstag, 08. Juni 2017 um 11:40 Uhr > > > Von: "Andrea Del Bene" > > > An: users@wicket.apache.org > > > Betreff: Re: Re: ListItem and enclosure problem > > > > > > Sorry, in your case this HTML should work better: > > > > > > > > > > > > > > >[Content] > > > > > > > > > > > > > > > Then in your MyListView override onConfigure with something like this: > > > > > > void onConfigure() { > > >super.onConfigure(); > > >setVisible(getModelObject().size() > 0); > > > } > > > > > > > > > On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro wrote: > > > > > > > Sorry Ernesto for my bad english. But i can not see how i shall get > > this > > > > to work with a panel? > > > > I use a listview because my item count is configurable. So i can not > > > > generate a "template panel" > > > > and put all items in that. But i admit that i didn't understand your > > > > question completely. > > > > > > > > Thanks > > > > Per > > > > > > > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > > > > > Von: "Ernesto Reinaldo Barreiro" > > > > > An: "users@wicket.apache.org" > > > > > Betreff: Re: ListItem and enclosure problem > > > > > > > > > > Why to not put the thing in a panel? > > > > > > > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro > > wrote: > > > > > > > > > > > Hello, > > > > > > > > > > > > i would like to enclose markup of a list item in wicket:enclosure. > > The > > > > > > enclosure is activated based on a child component on list item. > > > > > > So for i could not find any marker that this is not working. So i > > need > > > > to > > > > > > do something wrong. Any work around would be welcome. > > > > > > > > > > > > Thanks for your support > > > > > > Per > > > > > > > > > > > > > > > > > > WicketApplication.java > > > > > > public class WicketApplication extends WebApplication > > > > > > { > > > > > > /** > > > > > >* @see org.apache.wicket.Application#getHomePage() > > > > > >*/ > > > > > > @Override > > > > > > public Class getHomePage() > > > > > > { > > > > > > return HomePage.class; > > > > > > } > > > > > > > > > > > > /** > > > > > >* @see org.apache.wicket.Application#init()
Re: Re: Re: ListItem and enclosure problem
The enclosure is necessary if you want to strip out tag when it's empty. On Thu, Jun 8, 2017 at 12:30 PM, Andrea Del Bene wrote: > Just use: > > item.setVisible(false); > > instead of: > > label.setVisible(false); > > On Thu, Jun 8, 2017 at 12:23 PM, Per Newgro wrote: > >> But wouldn't this only hide the complete listview when there is no item? >> I want to remove markup only for an empty item. >> >> So something like >> >> 1 >> 2 >> 3 >> >> >> should become in case foo:1:bar is invisible >> >> >> 1 >> 3 >> >> >> Thank you >> Per >> >> > Gesendet: Donnerstag, 08. Juni 2017 um 11:40 Uhr >> > Von: "Andrea Del Bene" >> > An: users@wicket.apache.org >> > Betreff: Re: Re: ListItem and enclosure problem >> > >> > Sorry, in your case this HTML should work better: >> > >> > >> > >> > >> >[Content] >> > >> > >> > >> > >> > Then in your MyListView override onConfigure with something like this: >> > >> > void onConfigure() { >> >super.onConfigure(); >> >setVisible(getModelObject().size() > 0); >> > } >> > >> > >> > On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro wrote: >> > >> > > Sorry Ernesto for my bad english. But i can not see how i shall get >> this >> > > to work with a panel? >> > > I use a listview because my item count is configurable. So i can not >> > > generate a "template panel" >> > > and put all items in that. But i admit that i didn't understand your >> > > question completely. >> > > >> > > Thanks >> > > Per >> > > >> > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr >> > > > Von: "Ernesto Reinaldo Barreiro" >> > > > An: "users@wicket.apache.org" >> > > > Betreff: Re: ListItem and enclosure problem >> > > > >> > > > Why to not put the thing in a panel? >> > > > >> > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro >> wrote: >> > > > >> > > > > Hello, >> > > > > >> > > > > i would like to enclose markup of a list item in >> wicket:enclosure. The >> > > > > enclosure is activated based on a child component on list item. >> > > > > So for i could not find any marker that this is not working. So i >> need >> > > to >> > > > > do something wrong. Any work around would be welcome. >> > > > > >> > > > > Thanks for your support >> > > > > Per >> > > > > >> > > > > >> > > > > WicketApplication.java >> > > > > public class WicketApplication extends WebApplication >> > > > > { >> > > > > /** >> > > > >* @see org.apache.wicket.Application#getHomePage() >> > > > >*/ >> > > > > @Override >> > > > > public Class getHomePage() >> > > > > { >> > > > > return HomePage.class; >> > > > > } >> > > > > >> > > > > /** >> > > > >* @see org.apache.wicket.Application#init() >> > > > >*/ >> > > > > @Override >> > > > > public void init() >> > > > > { >> > > > > super.init(); >> > > > > mountPage("encloselistitem", ListViewEnclosurePage.class); >> > > > > } >> > > > > } >> > > > > >> > > > > ListViewEnclosurePage.class >> > > > > public class ListViewEnclosurePage extends WebPage { >> > > > > >> > > > > public ListViewEnclosurePage() { >> > > > > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); >> > > > > } >> > > > > >> > > > > public static class MyListView extends ListView { >> > > > > >> > > > > public MyListView( >> > > > > String id, >> > > > > List list) { >> > >
Re: Re: Re: ListItem and enclosure problem
Just use: item.setVisible(false); instead of: label.setVisible(false); On Thu, Jun 8, 2017 at 12:23 PM, Per Newgro wrote: > But wouldn't this only hide the complete listview when there is no item? > I want to remove markup only for an empty item. > > So something like > > 1 > 2 > 3 > > > should become in case foo:1:bar is invisible > > > 1 > 3 > > > Thank you > Per > > > Gesendet: Donnerstag, 08. Juni 2017 um 11:40 Uhr > > Von: "Andrea Del Bene" > > An: users@wicket.apache.org > > Betreff: Re: Re: ListItem and enclosure problem > > > > Sorry, in your case this HTML should work better: > > > > > > > > > >[Content] > > > > > > > > > > Then in your MyListView override onConfigure with something like this: > > > > void onConfigure() { > >super.onConfigure(); > >setVisible(getModelObject().size() > 0); > > } > > > > > > On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro wrote: > > > > > Sorry Ernesto for my bad english. But i can not see how i shall get > this > > > to work with a panel? > > > I use a listview because my item count is configurable. So i can not > > > generate a "template panel" > > > and put all items in that. But i admit that i didn't understand your > > > question completely. > > > > > > Thanks > > > Per > > > > > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > > > > Von: "Ernesto Reinaldo Barreiro" > > > > An: "users@wicket.apache.org" > > > > Betreff: Re: ListItem and enclosure problem > > > > > > > > Why to not put the thing in a panel? > > > > > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro > wrote: > > > > > > > > > Hello, > > > > > > > > > > i would like to enclose markup of a list item in wicket:enclosure. > The > > > > > enclosure is activated based on a child component on list item. > > > > > So for i could not find any marker that this is not working. So i > need > > > to > > > > > do something wrong. Any work around would be welcome. > > > > > > > > > > Thanks for your support > > > > > Per > > > > > > > > > > > > > > > WicketApplication.java > > > > > public class WicketApplication extends WebApplication > > > > > { > > > > > /** > > > > >* @see org.apache.wicket.Application#getHomePage() > > > > >*/ > > > > > @Override > > > > > public Class getHomePage() > > > > > { > > > > > return HomePage.class; > > > > > } > > > > > > > > > > /** > > > > >* @see org.apache.wicket.Application#init() > > > > >*/ > > > > > @Override > > > > > public void init() > > > > > { > > > > > super.init(); > > > > > mountPage("encloselistitem", ListViewEnclosurePage.class); > > > > > } > > > > > } > > > > > > > > > > ListViewEnclosurePage.class > > > > > public class ListViewEnclosurePage extends WebPage { > > > > > > > > > > public ListViewEnclosurePage() { > > > > > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > > > > > } > > > > > > > > > > public static class MyListView extends ListView { > > > > > > > > > > public MyListView( > > > > > String id, > > > > > List list) { > > > > > super(id, list); > > > > > } > > > > > > > > > > @Override > > > > > protected void populateItem(ListItem item) { > > > > > Label label = new Label("bar", item.getModel()); > > > > > item.add(label); > > > > > if (item.getIndex() == 1) { // any condition > > > > > label.setVisible(false); > > > > > } > > > > > } > > > > > } > > > > > } > > > > > > > > > > ListViewEnclosurePage.html > > > > > > > > > > http://wicket.apache.org";> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > wicket:id="bar">[Content] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > - > > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > > > > > > > > > > > -- > > > > Regards - Ernesto Reinaldo Barreiro > > > > > > > > > > - > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Re: Re: ListItem and enclosure problem
Why don't you just use `item.setVisible(false)` ? No need of enclosures. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Jun 8, 2017 at 12:23 PM, Per Newgro wrote: > But wouldn't this only hide the complete listview when there is no item? > I want to remove markup only for an empty item. > > So something like > > 1 > 2 > 3 > > > should become in case foo:1:bar is invisible > > > 1 > 3 > > > Thank you > Per > > > Gesendet: Donnerstag, 08. Juni 2017 um 11:40 Uhr > > Von: "Andrea Del Bene" > > An: users@wicket.apache.org > > Betreff: Re: Re: ListItem and enclosure problem > > > > Sorry, in your case this HTML should work better: > > > > > > > > > >[Content] > > > > > > > > > > Then in your MyListView override onConfigure with something like this: > > > > void onConfigure() { > >super.onConfigure(); > >setVisible(getModelObject().size() > 0); > > } > > > > > > On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro wrote: > > > > > Sorry Ernesto for my bad english. But i can not see how i shall get > this > > > to work with a panel? > > > I use a listview because my item count is configurable. So i can not > > > generate a "template panel" > > > and put all items in that. But i admit that i didn't understand your > > > question completely. > > > > > > Thanks > > > Per > > > > > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > > > > Von: "Ernesto Reinaldo Barreiro" > > > > An: "users@wicket.apache.org" > > > > Betreff: Re: ListItem and enclosure problem > > > > > > > > Why to not put the thing in a panel? > > > > > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro > wrote: > > > > > > > > > Hello, > > > > > > > > > > i would like to enclose markup of a list item in wicket:enclosure. > The > > > > > enclosure is activated based on a child component on list item. > > > > > So for i could not find any marker that this is not working. So i > need > > > to > > > > > do something wrong. Any work around would be welcome. > > > > > > > > > > Thanks for your support > > > > > Per > > > > > > > > > > > > > > > WicketApplication.java > > > > > public class WicketApplication extends WebApplication > > > > > { > > > > > /** > > > > >* @see org.apache.wicket.Application#getHomePage() > > > > >*/ > > > > > @Override > > > > > public Class getHomePage() > > > > > { > > > > > return HomePage.class; > > > > > } > > > > > > > > > > /** > > > > >* @see org.apache.wicket.Application#init() > > > > >*/ > > > > > @Override > > > > > public void init() > > > > > { > > > > > super.init(); > > > > > mountPage("encloselistitem", ListViewEnclosurePage.class); > > > > > } > > > > > } > > > > > > > > > > ListViewEnclosurePage.class > > > > > public class ListViewEnclosurePage extends WebPage { > > > > > > > > > > public ListViewEnclosurePage() { > > > > > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > > > > > } > > > > > > > > > > public static class MyListView extends ListView { > > > > > > > > > > public MyListView( > > > > > String id, > > > > > List list) { > > > > > super(id, list); > > > > > } > > > > > > > > > > @Override > > > > > protected void populateItem(ListItem item) { > > > > > Label label = new Label("bar", item.getModel()); > > > > > item.add(label); > > > > > if (item.getIndex() == 1) { // any condition > > > > > label.setVisible(false); > > > > > } > > > > > } > > > > &
Aw: Re: Re: ListItem and enclosure problem
But wouldn't this only hide the complete listview when there is no item? I want to remove markup only for an empty item. So something like 1 2 3 should become in case foo:1:bar is invisible 1 3 Thank you Per > Gesendet: Donnerstag, 08. Juni 2017 um 11:40 Uhr > Von: "Andrea Del Bene" > An: users@wicket.apache.org > Betreff: Re: Re: ListItem and enclosure problem > > Sorry, in your case this HTML should work better: > > > > >[Content] > > > > > Then in your MyListView override onConfigure with something like this: > > void onConfigure() { >super.onConfigure(); >setVisible(getModelObject().size() > 0); > } > > > On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro wrote: > > > Sorry Ernesto for my bad english. But i can not see how i shall get this > > to work with a panel? > > I use a listview because my item count is configurable. So i can not > > generate a "template panel" > > and put all items in that. But i admit that i didn't understand your > > question completely. > > > > Thanks > > Per > > > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > > > Von: "Ernesto Reinaldo Barreiro" > > > An: "users@wicket.apache.org" > > > Betreff: Re: ListItem and enclosure problem > > > > > > Why to not put the thing in a panel? > > > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro wrote: > > > > > > > Hello, > > > > > > > > i would like to enclose markup of a list item in wicket:enclosure. The > > > > enclosure is activated based on a child component on list item. > > > > So for i could not find any marker that this is not working. So i need > > to > > > > do something wrong. Any work around would be welcome. > > > > > > > > Thanks for your support > > > > Per > > > > > > > > > > > > WicketApplication.java > > > > public class WicketApplication extends WebApplication > > > > { > > > > /** > > > >* @see org.apache.wicket.Application#getHomePage() > > > >*/ > > > > @Override > > > > public Class getHomePage() > > > > { > > > > return HomePage.class; > > > > } > > > > > > > > /** > > > >* @see org.apache.wicket.Application#init() > > > >*/ > > > > @Override > > > > public void init() > > > > { > > > > super.init(); > > > > mountPage("encloselistitem", ListViewEnclosurePage.class); > > > > } > > > > } > > > > > > > > ListViewEnclosurePage.class > > > > public class ListViewEnclosurePage extends WebPage { > > > > > > > > public ListViewEnclosurePage() { > > > > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > > > > } > > > > > > > > public static class MyListView extends ListView { > > > > > > > > public MyListView( > > > > String id, > > > > List list) { > > > > super(id, list); > > > > } > > > > > > > > @Override > > > > protected void populateItem(ListItem item) { > > > > Label label = new Label("bar", item.getModel()); > > > > item.add(label); > > > > if (item.getIndex() == 1) { // any condition > > > > label.setVisible(false); > > > > } > > > > } > > > > } > > > > } > > > > > > > > ListViewEnclosurePage.html > > > > > > > > http://wicket.apache.org";> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > wicket:id="bar">[Content] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > - > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > > > > > > -- > > > Regards - Ernesto Reinaldo Barreiro > > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Re: ListItem and enclosure problem
And have reusable bit and avoids enclosures :-) On Thu, Jun 8, 2017 at 12:00 PM, Andrea Del Bene wrote: > Nothing against Panels :-), but in this way you have to create a new class > file and a markup file. > > On Thu, Jun 8, 2017 at 11:48 AM, Ernesto Reinaldo Barreiro < > reier...@gmail.com> wrote: > > > Why to not replace MyListView with a panel containing the listView? No > > enclosure is needed then > > > > > > On Thu, Jun 8, 2017 at 11:40 AM, Andrea Del Bene > > wrote: > > > > > Sorry, in your case this HTML should work better: > > > > > > > > > > > > > > >[Content] > > > > > > > > > > > > > > > Then in your MyListView override onConfigure with something like this: > > > > > > void onConfigure() { > > >super.onConfigure(); > > >setVisible(getModelObject().size() > 0); > > > } > > > > > > > > > On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro wrote: > > > > > > > Sorry Ernesto for my bad english. But i can not see how i shall get > > this > > > > to work with a panel? > > > > I use a listview because my item count is configurable. So i can not > > > > generate a "template panel" > > > > and put all items in that. But i admit that i didn't understand your > > > > question completely. > > > > > > > > Thanks > > > > Per > > > > > > > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > > > > > Von: "Ernesto Reinaldo Barreiro" > > > > > An: "users@wicket.apache.org" > > > > > Betreff: Re: ListItem and enclosure problem > > > > > > > > > > Why to not put the thing in a panel? > > > > > > > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro > > wrote: > > > > > > > > > > > Hello, > > > > > > > > > > > > i would like to enclose markup of a list item in > wicket:enclosure. > > > The > > > > > > enclosure is activated based on a child component on list item. > > > > > > So for i could not find any marker that this is not working. So i > > > need > > > > to > > > > > > do something wrong. Any work around would be welcome. > > > > > > > > > > > > Thanks for your support > > > > > > Per > > > > > > > > > > > > > > > > > > WicketApplication.java > > > > > > public class WicketApplication extends WebApplication > > > > > > { > > > > > > /** > > > > > >* @see org.apache.wicket.Application#getHomePage() > > > > > >*/ > > > > > > @Override > > > > > > public Class getHomePage() > > > > > > { > > > > > > return HomePage.class; > > > > > > } > > > > > > > > > > > > /** > > > > > >* @see org.apache.wicket.Application#init() > > > > > >*/ > > > > > > @Override > > > > > > public void init() > > > > > > { > > > > > > super.init(); > > > > > > mountPage("encloselistitem", ListViewEnclosurePage.class); > > > > > > } > > > > > > } > > > > > > > > > > > > ListViewEnclosurePage.class > > > > > > public class ListViewEnclosurePage extends WebPage { > > > > > > > > > > > > public ListViewEnclosurePage() { > > > > > > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > > > > > > } > > > > > > > > > > > > public static class MyListView extends ListView { > > > > > > > > > > > > public MyListView( > > > > > > String id, > > > > > > List list) { > > > > > > super(id, list); > > > > > > } > > > > > > > > > > > > @Override > > > > > > protected void populateItem(ListItem item) { > > > > > &
Re: Re: ListItem and enclosure problem
Nothing against Panels :-), but in this way you have to create a new class file and a markup file. On Thu, Jun 8, 2017 at 11:48 AM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > Why to not replace MyListView with a panel containing the listView? No > enclosure is needed then > > > On Thu, Jun 8, 2017 at 11:40 AM, Andrea Del Bene > wrote: > > > Sorry, in your case this HTML should work better: > > > > > > > > > >[Content] > > > > > > > > > > Then in your MyListView override onConfigure with something like this: > > > > void onConfigure() { > >super.onConfigure(); > >setVisible(getModelObject().size() > 0); > > } > > > > > > On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro wrote: > > > > > Sorry Ernesto for my bad english. But i can not see how i shall get > this > > > to work with a panel? > > > I use a listview because my item count is configurable. So i can not > > > generate a "template panel" > > > and put all items in that. But i admit that i didn't understand your > > > question completely. > > > > > > Thanks > > > Per > > > > > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > > > > Von: "Ernesto Reinaldo Barreiro" > > > > An: "users@wicket.apache.org" > > > > Betreff: Re: ListItem and enclosure problem > > > > > > > > Why to not put the thing in a panel? > > > > > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro > wrote: > > > > > > > > > Hello, > > > > > > > > > > i would like to enclose markup of a list item in wicket:enclosure. > > The > > > > > enclosure is activated based on a child component on list item. > > > > > So for i could not find any marker that this is not working. So i > > need > > > to > > > > > do something wrong. Any work around would be welcome. > > > > > > > > > > Thanks for your support > > > > > Per > > > > > > > > > > > > > > > WicketApplication.java > > > > > public class WicketApplication extends WebApplication > > > > > { > > > > > /** > > > > >* @see org.apache.wicket.Application#getHomePage() > > > > >*/ > > > > > @Override > > > > > public Class getHomePage() > > > > > { > > > > > return HomePage.class; > > > > > } > > > > > > > > > > /** > > > > >* @see org.apache.wicket.Application#init() > > > > >*/ > > > > > @Override > > > > > public void init() > > > > > { > > > > > super.init(); > > > > > mountPage("encloselistitem", ListViewEnclosurePage.class); > > > > > } > > > > > } > > > > > > > > > > ListViewEnclosurePage.class > > > > > public class ListViewEnclosurePage extends WebPage { > > > > > > > > > > public ListViewEnclosurePage() { > > > > > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > > > > > } > > > > > > > > > > public static class MyListView extends ListView { > > > > > > > > > > public MyListView( > > > > > String id, > > > > > List list) { > > > > > super(id, list); > > > > > } > > > > > > > > > > @Override > > > > > protected void populateItem(ListItem item) { > > > > > Label label = new Label("bar", item.getModel()); > > > > > item.add(label); > > > > > if (item.getIndex() == 1) { // any condition > > > > > label.setVisible(false); > > > > > } > > > > > } > > > > > } > > > > > } > > > > > > > > > > ListViewEnclosurePage.html > > > > > > > > > > http://wicket.apache.org";> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > wicket:id="bar">[Content] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > - > > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > > > > > > > > > > > -- > > > > Regards - Ernesto Reinaldo Barreiro > > > > > > > > > > - > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > -- > Regards - Ernesto Reinaldo Barreiro >
Re: Re: ListItem and enclosure problem
Why to not replace MyListView with a panel containing the listView? No enclosure is needed then On Thu, Jun 8, 2017 at 11:40 AM, Andrea Del Bene wrote: > Sorry, in your case this HTML should work better: > > > > >[Content] > > > > > Then in your MyListView override onConfigure with something like this: > > void onConfigure() { >super.onConfigure(); >setVisible(getModelObject().size() > 0); > } > > > On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro wrote: > > > Sorry Ernesto for my bad english. But i can not see how i shall get this > > to work with a panel? > > I use a listview because my item count is configurable. So i can not > > generate a "template panel" > > and put all items in that. But i admit that i didn't understand your > > question completely. > > > > Thanks > > Per > > > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > > > Von: "Ernesto Reinaldo Barreiro" > > > An: "users@wicket.apache.org" > > > Betreff: Re: ListItem and enclosure problem > > > > > > Why to not put the thing in a panel? > > > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro wrote: > > > > > > > Hello, > > > > > > > > i would like to enclose markup of a list item in wicket:enclosure. > The > > > > enclosure is activated based on a child component on list item. > > > > So for i could not find any marker that this is not working. So i > need > > to > > > > do something wrong. Any work around would be welcome. > > > > > > > > Thanks for your support > > > > Per > > > > > > > > > > > > WicketApplication.java > > > > public class WicketApplication extends WebApplication > > > > { > > > > /** > > > >* @see org.apache.wicket.Application#getHomePage() > > > >*/ > > > > @Override > > > > public Class getHomePage() > > > > { > > > > return HomePage.class; > > > > } > > > > > > > > /** > > > >* @see org.apache.wicket.Application#init() > > > >*/ > > > > @Override > > > > public void init() > > > > { > > > > super.init(); > > > > mountPage("encloselistitem", ListViewEnclosurePage.class); > > > > } > > > > } > > > > > > > > ListViewEnclosurePage.class > > > > public class ListViewEnclosurePage extends WebPage { > > > > > > > > public ListViewEnclosurePage() { > > > > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > > > > } > > > > > > > > public static class MyListView extends ListView { > > > > > > > > public MyListView( > > > > String id, > > > > List list) { > > > > super(id, list); > > > > } > > > > > > > > @Override > > > > protected void populateItem(ListItem item) { > > > > Label label = new Label("bar", item.getModel()); > > > > item.add(label); > > > > if (item.getIndex() == 1) { // any condition > > > > label.setVisible(false); > > > > } > > > > } > > > > } > > > > } > > > > > > > > ListViewEnclosurePage.html > > > > > > > > http://wicket.apache.org";> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > wicket:id="bar">[Content] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > - > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > > > > > > -- > > > Regards - Ernesto Reinaldo Barreiro > > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > -- Regards - Ernesto Reinaldo Barreiro
Re: Re: ListItem and enclosure problem
Sorry, in your case this HTML should work better: [Content] Then in your MyListView override onConfigure with something like this: void onConfigure() { super.onConfigure(); setVisible(getModelObject().size() > 0); } On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro wrote: > Sorry Ernesto for my bad english. But i can not see how i shall get this > to work with a panel? > I use a listview because my item count is configurable. So i can not > generate a "template panel" > and put all items in that. But i admit that i didn't understand your > question completely. > > Thanks > Per > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > > Von: "Ernesto Reinaldo Barreiro" > > An: "users@wicket.apache.org" > > Betreff: Re: ListItem and enclosure problem > > > > Why to not put the thing in a panel? > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro wrote: > > > > > Hello, > > > > > > i would like to enclose markup of a list item in wicket:enclosure. The > > > enclosure is activated based on a child component on list item. > > > So for i could not find any marker that this is not working. So i need > to > > > do something wrong. Any work around would be welcome. > > > > > > Thanks for your support > > > Per > > > > > > > > > WicketApplication.java > > > public class WicketApplication extends WebApplication > > > { > > > /** > > >* @see org.apache.wicket.Application#getHomePage() > > >*/ > > > @Override > > > public Class getHomePage() > > > { > > > return HomePage.class; > > > } > > > > > > /** > > >* @see org.apache.wicket.Application#init() > > >*/ > > > @Override > > > public void init() > > > { > > > super.init(); > > > mountPage("encloselistitem", ListViewEnclosurePage.class); > > > } > > > } > > > > > > ListViewEnclosurePage.class > > > public class ListViewEnclosurePage extends WebPage { > > > > > > public ListViewEnclosurePage() { > > > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > > > } > > > > > > public static class MyListView extends ListView { > > > > > > public MyListView( > > > String id, > > > List list) { > > > super(id, list); > > > } > > > > > > @Override > > > protected void populateItem(ListItem item) { > > > Label label = new Label("bar", item.getModel()); > > > item.add(label); > > > if (item.getIndex() == 1) { // any condition > > > label.setVisible(false); > > > } > > > } > > > } > > > } > > > > > > ListViewEnclosurePage.html > > > > > > http://wicket.apache.org";> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > wicket:id="bar">[Content] > > > > > > > > > > > > > > > > > > > > > > > > > > > - > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > -- > > Regards - Ernesto Reinaldo Barreiro > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Aw: Re: ListItem and enclosure problem
Sorry Ernesto for my bad english. But i can not see how i shall get this to work with a panel? I use a listview because my item count is configurable. So i can not generate a "template panel" and put all items in that. But i admit that i didn't understand your question completely. Thanks Per > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > Von: "Ernesto Reinaldo Barreiro" > An: "users@wicket.apache.org" > Betreff: Re: ListItem and enclosure problem > > Why to not put the thing in a panel? > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro wrote: > > > Hello, > > > > i would like to enclose markup of a list item in wicket:enclosure. The > > enclosure is activated based on a child component on list item. > > So for i could not find any marker that this is not working. So i need to > > do something wrong. Any work around would be welcome. > > > > Thanks for your support > > Per > > > > > > WicketApplication.java > > public class WicketApplication extends WebApplication > > { > > /** > >* @see org.apache.wicket.Application#getHomePage() > >*/ > > @Override > > public Class getHomePage() > > { > > return HomePage.class; > > } > > > > /** > >* @see org.apache.wicket.Application#init() > >*/ > > @Override > > public void init() > > { > > super.init(); > > mountPage("encloselistitem", ListViewEnclosurePage.class); > > } > > } > > > > ListViewEnclosurePage.class > > public class ListViewEnclosurePage extends WebPage { > > > > public ListViewEnclosurePage() { > > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > > } > > > > public static class MyListView extends ListView { > > > > public MyListView( > > String id, > > List list) { > > super(id, list); > > } > > > > @Override > > protected void populateItem(ListItem item) { > > Label label = new Label("bar", item.getModel()); > > item.add(label); > > if (item.getIndex() == 1) { // any condition > > label.setVisible(false); > > } > > } > > } > > } > > > > ListViewEnclosurePage.html > > > > http://wicket.apache.org";> > > > > > > > > > > > > > > > > > > > > > wicket:id="bar">[Content] > > > > > > > > > > > > > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > -- > Regards - Ernesto Reinaldo Barreiro > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Aw: Re: ListItem and enclosure problem
Thanks for responding. Maybe i should have stated my goal clearly. I would like to remove the space occupied by empty list items. Basically i do it with wicket:enclosures. While not displaying the "empty element" markup the space is not occupied. Do you mean that i need to change it that way? http://wicket.apache.org";> [Content] This is not working to. ERROR - DefaultExceptionMapper - Unexpected error occurred org.apache.wicket.WicketRuntimeException: Could not find child with id: foo:bar in the wicket:enclosure at org.apache.wicket.markup.html.internal.Enclosure.checkChildComponent(Enclosure.java:250) at org.apache.wicket.markup.html.internal.Enclosure.getChildComponent(Enclosure.java:228) at org.apache.wicket.markup.html.internal.Enclosure.onInitialize(Enclosure.java:132) at org.apache.wicket.Component.fireInitialize(Component.java:877) at org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:961) at org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:938) This works but with multiple ul in markup and the empty ul is still displayed. http://wicket.apache.org";> [Content] Thanks for help Per > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr > Von: "Andrea Del Bene" > An: users@wicket.apache.org > Betreff: Re: ListItem and enclosure problem > > Hi, > > have a look at the answer here on StackOverflow: > https://stackoverflow.com/questions/44270160/how-to-access-html-element-which-doesnt-have-a-wicketid > Basically you should move your ListView to tag an remove wicket:id > from tag. > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro wrote: > > > Hello, > > > > i would like to enclose markup of a list item in wicket:enclosure. The > > enclosure is activated based on a child component on list item. > > So for i could not find any marker that this is not working. So i need to > > do something wrong. Any work around would be welcome. > > > > Thanks for your support > > Per > > > > > > WicketApplication.java > > public class WicketApplication extends WebApplication > > { > > /** > >* @see org.apache.wicket.Application#getHomePage() > >*/ > > @Override > > public Class getHomePage() > > { > > return HomePage.class; > > } > > > > /** > >* @see org.apache.wicket.Application#init() > >*/ > > @Override > > public void init() > > { > > super.init(); > > mountPage("encloselistitem", ListViewEnclosurePage.class); > > } > > } > > > > ListViewEnclosurePage.class > > public class ListViewEnclosurePage extends WebPage { > > > > public ListViewEnclosurePage() { > > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > > } > > > > public static class MyListView extends ListView { > > > > public MyListView( > > String id, > > List list) { > > super(id, list); > > } > > > > @Override > > protected void populateItem(ListItem item) { > > Label label = new Label("bar", item.getModel()); > > item.add(label); > > if (item.getIndex() == 1) { // any condition > > label.setVisible(false); > > } > > } > > } > > } > > > > ListViewEnclosurePage.html > > > > http://wicket.apache.org";> > > > > > > > > > > > > > > > > > > > > > wicket:id="bar">[Content] > > > > > > > > > > > > > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListItem and enclosure problem
Why to not put the thing in a panel? On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro wrote: > Hello, > > i would like to enclose markup of a list item in wicket:enclosure. The > enclosure is activated based on a child component on list item. > So for i could not find any marker that this is not working. So i need to > do something wrong. Any work around would be welcome. > > Thanks for your support > Per > > > WicketApplication.java > public class WicketApplication extends WebApplication > { > /** >* @see org.apache.wicket.Application#getHomePage() >*/ > @Override > public Class getHomePage() > { > return HomePage.class; > } > > /** >* @see org.apache.wicket.Application#init() >*/ > @Override > public void init() > { > super.init(); > mountPage("encloselistitem", ListViewEnclosurePage.class); > } > } > > ListViewEnclosurePage.class > public class ListViewEnclosurePage extends WebPage { > > public ListViewEnclosurePage() { > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > } > > public static class MyListView extends ListView { > > public MyListView( > String id, > List list) { > super(id, list); > } > > @Override > protected void populateItem(ListItem item) { > Label label = new Label("bar", item.getModel()); > item.add(label); > if (item.getIndex() == 1) { // any condition > label.setVisible(false); > } > } > } > } > > ListViewEnclosurePage.html > > http://wicket.apache.org";> > > > > > > > > > > wicket:id="bar">[Content] > > > > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Regards - Ernesto Reinaldo Barreiro
Re: ListItem and enclosure problem
Hi, have a look at the answer here on StackOverflow: https://stackoverflow.com/questions/44270160/how-to-access-html-element-which-doesnt-have-a-wicketid Basically you should move your ListView to tag an remove wicket:id from tag. On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro wrote: > Hello, > > i would like to enclose markup of a list item in wicket:enclosure. The > enclosure is activated based on a child component on list item. > So for i could not find any marker that this is not working. So i need to > do something wrong. Any work around would be welcome. > > Thanks for your support > Per > > > WicketApplication.java > public class WicketApplication extends WebApplication > { > /** >* @see org.apache.wicket.Application#getHomePage() >*/ > @Override > public Class getHomePage() > { > return HomePage.class; > } > > /** >* @see org.apache.wicket.Application#init() >*/ > @Override > public void init() > { > super.init(); > mountPage("encloselistitem", ListViewEnclosurePage.class); > } > } > > ListViewEnclosurePage.class > public class ListViewEnclosurePage extends WebPage { > > public ListViewEnclosurePage() { > add(new MyListView("foo", Arrays.asList("1", "2", "3"))); > } > > public static class MyListView extends ListView { > > public MyListView( > String id, > List list) { > super(id, list); > } > > @Override > protected void populateItem(ListItem item) { > Label label = new Label("bar", item.getModel()); > item.add(label); > if (item.getIndex() == 1) { // any condition > label.setVisible(false); > } > } > } > } > > ListViewEnclosurePage.html > > http://wicket.apache.org";> > > > > > > > > > > wicket:id="bar">[Content] > > > > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >