I'll try this again and see whether the mail list is feeling friendlier this morning than it was Saturday.-- Forwarded message --From: Scott Swank
[EMAIL PROTECTED]Date: Sep 30, 2006 3:02 PMSubject: modal window link from inside a repeater (ListView)To:
wicket-user@lists.sourceforge.netHello again.I am trying to open a modal window from within a repeater. In the example application Library, my goal is equivalent to opening BookDetails in a ModalWindow instead of going to a separate page.
All of the below works perfectly if I place the html anchor outside of the html table and if I add() the AjaxLink outside of the ListView. I have a simple panel:wicket:panel div wicket:id=editItemPopup/div
table tr thProduct/th thSku/th thPrice/th th wicket:id=day17/1/th /tr
tr wicket:id=items td wicket:id=productThe Hotel/td td wicket:id=skuKing/td td wicket:id=price$100/td
td a wicket:id=openEditItem href=""> span wicket:id=available20/span /a /td /tr
/table/wicket:panelpublic class ProductPanel extends Panel { private static final long serialVersionUID = -3546659646601591561L; private Availability availability;
public ProductPanel(String id) { super(id); final ModalWindow editItemWindow = new ModalWindow(editItemPopup); editItemWindow.setTitle(Add/Edit Item);
editItemWindow.setContent(new EditItemPanel(editItemWindow.getContentId())); add(editItemWindow); add(new Label(day1, 10/1)); ListWarehouseItem whsItems = WarehouseService
.getAvailability(ProductType.HOTEL); availability = new Availability(whsItems); ListView itemView = new ListView(items, availability.getSkuAvailabilities()) {
private static final long serialVersionUID = 7672521500786369826L; @Override protected void populateItem(ListItem listItem) {SkuAvailability skuAvailability = (SkuAvailability) listItem
.getModelObject();Sku sku = skuAvailability.getSku();listItem.add(new Label(product, sku.getProductName()));listItem.add
(new Label(sku,
sku.getName()));listItem.add(new Label(price, String.valueOf(skuAvailability .getWarehouseItem().getPrice(;Date d = availability.getEventDates
().first();WarehouseItem wItem = skuAvailability.getWarehouseItem(d);add(new AjaxLink(openEditItem) { private static final long serialVersionUID = 1L;
public void onClick(AjaxRequestTarget target) { editItemWindow.show(target); }});int qty = 0;if (wItem != null)
qty = wItem.getQuantityAvailable();listItem.add(new Label(available, String.valueOf(qty))); } }; add(itemView); }
}Unfortunately, when I add the AjaxLink within the ListView I get the following exception. I'm likely missing something rather simple, but thus far it's eluding me. Thank you for your time.
WicketMessage: Error attaching this container for rendering: [MarkupContainer [Component id = items, page = com.vegas.pos.PosPage, path = 0:navTabs:panel:productTabs:panel:items.ProductPanel$1, isVisible = true, isVersioned = false]]
Root cause:java.lang.IllegalArgumentException: A child with id 'openEditItem' already exists:[MarkupContainer [Component id = items, page = com.vegas.pos.PosPage, path = 0:navTabs:panel:productTabs:panel:
items.ProductPanel$1, isVisible = true, isVersioned = false]] at wicket.MarkupContainer.add(MarkupContainer.java:156) at com.vegas.pos.browse.ProductPanel$1.populateItem(ProductPanel.java:58) at
wicket.markup.html.list.ListView.internalOnAttach(ListView.java:580) at wicket.Component.internalAttach(Component.java:2521) at wicket.MarkupContainer.internalAttach(MarkupContainer.java:341) at
wicket.MarkupContainer.internalAttach(MarkupContainer.java:354) at wicket.MarkupContainer.internalAttach(MarkupContainer.java:354) at wicket.MarkupContainer.internalAttach(MarkupContainer.java:354)
at wicket.MarkupContainer.internalAttach(MarkupContainer.java:354) at wicket.MarkupContainer.internalAttach(MarkupContainer.java:354) at wicket.Page.renderPage(Page.java:387) at wicket.request.target.component.BookmarkablePageRequestTarget.respond
(BookmarkablePageRequestTarget.java:226) at wicket.request.compound.DefaultResponseStrategy.respond(DefaultResponseStrategy.java:49) at wicket.request.compound.AbstractCompoundRequestCycleProcessor.respond
(AbstractCompoundRequestCycleProcessor.java:66) at wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:858) at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:885) at
wicket.RequestCycle.step(RequestCycle.java:966) at wicket.RequestCycle.steps(RequestCycle.java:1040) at wicket.RequestCycle.request(RequestCycle.java:454) at wicket.protocol.http.WicketServlet.doGet
(WicketServlet.java:216) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle
(ServletHolder.java:358) at