private ListItem<T> activeConfirm;
@Override
protected void populateItem(final ListItem<T> userListItem) {
userListItem.add(new Label("item.name", userListItem.getModelObject().toString()));
Panel confirm = new EmptyPanel("confirm");
userListItem.add(confirm);
userListItem.setOutputMarkupId(true);
final AjaxLink<String> deleteLink = new AjaxLink<String>("item.delete") {
private static final long serialVersionUID = 2004369349622394213L;
@Override
public boolean isVisible() {
return isDeleteLinkVisibleFor(userListItem.getModelObject());
}
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
if (activeConfirm != null) {
activeConfirm.get("confirm").replaceWith(new EmptyPanel("confirm"));
ajaxRequestTarget.add(activeConfirm);
activeConfirm = null;
}
final Model<T> model = new Model<T>(userListItem.getModelObject());
ConfirmPanel<T> confirmPanel = new ConfirmPanel<T>("confirm", model, userListItem) {