Use RepeatingView#newChildId() in order to generate unique id for each of your LinkAndImagePanels while iterating through these like this:
for (LinkAndImagePanel panel : allPanels) { String id = repeater.newChildId(); repeater.add(new LinkAndImagePanel(id, entry)); } On Sun, Dec 12, 2010 at 10:02 PM, Ladislav DANKO <em...@1ac0.net> wrote: > Panel added > ... > view.add(new LinkAndImagePanel("linkandimagepanel")); > ... > > with apropriate panel markup and java code. > > Looks works when there is just one image but for two or more images > there is error: > Caused by: java.lang.IllegalArgumentException: A child with id > 'linkandimagepanel' already exists: > > How to add multiple panels in repeater? For Image there is param in > constructor, but for Panel? > > > > > > -----Original Message----- > > From: Martin Grigorov [mailto:mgrigo...@apache.org] > > Sent: Sunday, December 12, 2010 11:10 AM > > To: users@wicket.apache.org > > Subject: Re: repeters with > > > > the repeater should add a Panel (or a Fragment) instead of > > Image The Panel itself will contain something like: > > > > ExternalLink link = new ExternalLink("id", href); add(link); > > link.add(new Image("image", ...); > > > > On Sun, Dec 12, 2010 at 11:07 AM, Ladislav DANKO > > <em...@1ac0.net> wrote: > > > > > How is possible to make a nested html tag with AttributeModifier? > > > > > > Laco > > > > > > > -----Original Message----- > > > > From: Per Newgro [mailto:per.new...@gmx.ch] > > > > Sent: Sunday, December 12, 2010 10:23 AM > > > > To: users@wicket.apache.org > > > > Subject: Re: repeters with > > > > > > > > You could add Links (instead of the image) and use an > > > > AttributeModifier for the href. > > > > > > > > CHeers > > > > Per > > > > > > > > Am 12.12.2010 09:19, schrieb Ladislav DANKO: > > > > > Hi, > > > > > > > > > > from files in dir I do a list of photos. I do it this way: > > > > > public class InsertPhotos extends WebPage { > > > > > public InsertPhotos() throws IOException > > > > > { > > > > > > > > > > Folder folder = > > > > > ((Start)Application.get()).getPhotosFolder(); > > > > > File[] files = folder.getFiles(); > > > > > List<File> lList = Arrays.asList(files); > > > > > Collections.sort(lList); > > > > > > > > > > RepeatingView view = new RepeatingView("repeater"); > > > > > while(iterator.hasNext()) > > > > > { > > > > > iterator.next(); > > > > > String fileName = lList.get(i).getName(); > > > > > String path = "../../photos/" + fileName; > > > > > i++; > > > > > view.add(new > > Image(view.newChildId(), path)); > > > > > } > > > > > this.add(view); > > > > > } > > > > > } > > > > > > > > > > and markup: > > > > > <img wicket:id="repeater" style="width: 90px; padding: 2px;" /> > > > > > > > > > > so resulting markup is: > > > > > <img src="resources/../../photos/01.jpg" > > style="padding: 2px; width: > > > > > 90px;"/> > > > > > <img src="resources/../../photos/02.jpg" > > style="padding: 2px; width: > > > > > 90px;"/> > > > > > ... > > > > > > > > > > This works but now I need to make a clickable list of > > photos, so > > > > > resulting markup should be: > > > > > <a title="" rel="lightbox[svatebni]" > > > > href="resources/../../photos/1.jpg"> > > > > > <img style="width: 90px; padding: 2px;" > > > > > src="resources/../../photos/01.jpg" /> </a> <a title="" > > > > > rel="lightbox[svatebni]" href="resources/../../photos/1.jpg"> > > > > > <img style="width: 90px; padding: 2px;" > > > > > src="resources/../../photos/02.jpg" /> </a> ... > > > > > > > > > > I don't know how to add anchor around img tag, can > > someone help me > > > > > please? I was searching through doc and list but found nothing. > > > > > > > > > > Thanks, Laco > > > > > > > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > - > > > > > 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 > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > 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 > >