you're wellcome!

On Thu, Jun 8, 2017 at 12:42 PM, Per Newgro <[email protected]> wrote:

> Thanks a lot Andrea,
>
> that did work. Now i get only markup of visible items.
>
> My Solution looks now:
>
> <code>
> ListViewEnclosurePage.html
> <!DOCTYPE html>
> <html xmlns:wicket="http://wicket.apache.org";>
>   <head>
>     <meta charset="utf-8" />
>     <link href='http://fonts.googleapis.com/css?family=Yanone+
> Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
>   </head>
>   <body>
>     <div>
>       <ul>
>         <wicket:enclosure child="foo">
>           <li wicket:id="foo">
>             <span wicket:id="bar">[Content]</span>
>           </li>
>         </wicket:enclosure>
>       </ul>
>     </div>
>   </body>
> </html>
>
> ListViewEnclosurePage$MyListView.java
>   public static class MyListView extends ListView<String> {
>
>     public MyListView(
>         String id,
>         List<? extends String> list) {
>       super(id, list);
>     }
>
>     @Override
>     protected void populateItem(ListItem<String> item) {
>       Label label = new Label("bar", item.getModel());
>       item.add(label);
>       if (item.getIndex() == 1) {
>         item.setVisible(false);
>       }
>     }
>   }
> </code>
>
> Thanks for your support
> Per
>
> > Gesendet: Donnerstag, 08. Juni 2017 um 12:30 Uhr
> > Von: "Andrea Del Bene" <[email protected]>
> > An: [email protected]
> > 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 <[email protected]> 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
> > > <ul>
> > >   <li id="foo:0"><span id="bar">1</span></li>
> > >   <li id="foo:1"><span id="bar">2</span></li>
> > >   <li id="foo:2"><span id="bar">3</span></li>
> > > </ul>
> > >
> > > should become in case foo:1:bar is invisible
> > >
> > > <ul>
> > >   <li id="foo:0"><span id="bar">1</span></li>
> > >   <li id="foo:2"><span id="bar">3</span></li>
> > > </ul>
> > >
> > > Thank you
> > > Per
> > >
> > > > Gesendet: Donnerstag, 08. Juni 2017 um 11:40 Uhr
> > > > Von: "Andrea Del Bene" <[email protected]>
> > > > An: [email protected]
> > > > Betreff: Re: Re: ListItem and enclosure problem
> > > >
> > > > Sorry, in your case this HTML should work better:
> > > >
> > > > <wicket:enclosure child="foo">
> > > >     <ul >
> > > >           <li wicket:id="foo">
> > > >                <span wicket:id="bar">[Content]</span>
> > > >            </li>
> > > >         </ul>
> > > > </wicket:enclosure>
> > > >
> > > > 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 <[email protected]>
> 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" <[email protected]>
> > > > > > An: "[email protected]" <[email protected]>
> > > > > > Betreff: Re: ListItem and enclosure problem
> > > > > >
> > > > > > Why to not put the <ul> thing in a panel?
> > > > > >
> > > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro <[email protected]>
> > > 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
> > > > > > >
> > > > > > > <code>
> > > > > > > WicketApplication.java
> > > > > > > public class WicketApplication extends WebApplication
> > > > > > > {
> > > > > > >   /**
> > > > > > >    * @see org.apache.wicket.Application#getHomePage()
> > > > > > >    */
> > > > > > >   @Override
> > > > > > >   public Class<? extends WebPage> 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<String> {
> > > > > > >
> > > > > > >     public MyListView(
> > > > > > >         String id,
> > > > > > >         List<? extends String> list) {
> > > > > > >         super(id, list);
> > > > > > >     }
> > > > > > >
> > > > > > >     @Override
> > > > > > >     protected void populateItem(ListItem<String> item) {
> > > > > > >       Label label = new Label("bar", item.getModel());
> > > > > > >       item.add(label);
> > > > > > >       if (item.getIndex() == 1) { // any condition
> > > > > > >         label.setVisible(false);
> > > > > > >       }
> > > > > > >     }
> > > > > > >   }
> > > > > > > }
> > > > > > >
> > > > > > > ListViewEnclosurePage.html
> > > > > > > <!DOCTYPE html>
> > > > > > > <html xmlns:wicket="http://wicket.apache.org";>
> > > > > > >         <head>
> > > > > > >                 <meta charset="utf-8" />
> > > > > > >                 <link href='http://fonts.googleapis.
> > > > > com/css?family=Yanone+
> > > > > > > Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
> > > > > > >         </head>
> > > > > > >         <body>
> > > > > > >                 <div>
> > > > > > >                         <ul>
> > > > > > >                                 <wicket:enclosure
> child="foo:bar">
> > > > > > >                                         <li wicket:id="foo">
> > > > > > >                                                 <span
> > > > > > > wicket:id="bar">[Content]</span>
> > > > > > >                                         </li>
> > > > > > >                                 </wicket:enclosure>
> > > > > > >                         </ul>
> > > > > > >                 </div>
> > > > > > >         </body>
> > > > > > > </html>
> > > > > > > </code>
> > > > > > >
> > > > > > > ------------------------------------------------------------
> > > ---------
> > > > > > > To unsubscribe, e-mail: [email protected]
> > > > > > > For additional commands, e-mail: [email protected]
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Regards - Ernesto Reinaldo Barreiro
> > > > > >
> > > > >
> > > > > ------------------------------------------------------------
> ---------
> > > > > To unsubscribe, e-mail: [email protected]
> > > > > For additional commands, e-mail: [email protected]
> > > > >
> > > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to