List of usage examples for org.apache.wicket.markup.repeater RepeatingView remove
public MarkupContainer remove(final Component component)
From source file:com.userweave.components.image.ImageListPanel.java
License:Open Source License
private WebMarkupContainer createImageContainer(final ValueListController<ByteArray> controller) { final WebMarkupContainer imageContainer = new WebMarkupContainer("imageContainer"); imageContainer.setOutputMarkupId(true); final RepeatingView images = new RepeatingView("repeater"); for (final ByteArray byteArray : controller.getValues()) { final WebMarkupContainer image = new WebMarkupContainer(images.newChildId()); ImageDisplayPanel imagePanel = new ImageDisplayPanel("image", byteArray, 0, 0); imagePanel.setDefaultModel(new Model<ByteArray>(byteArray)); Dimension d = controller.getLargestDimension(); imagePanel.add(new AttributeAppender("style", new Model<String>("width:" + d.width + "px;height:" + d.height + "px"), ";")); image.add(imagePanel);//from www.j a v a 2s .co m image.add(new AuthOnlyAjaxLink("delete") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { controller.removeValue(byteArray); images.remove(image); target.add(imageContainer); } }); images.add(image); } imageContainer.add(images); return imageContainer; }
From source file:com.userweave.components.valueListPanel.ValueListPanel.java
License:Open Source License
private void addListRow(final RepeatingView repeating, final T value) { final WebMarkupContainer item = new WebMarkupContainer(repeating.newChildId()); repeating.add(item);/*w w w . ja v a 2 s .c o m*/ Component listComponent = getListComponent("rowDisplay", value); item.add(listComponent); final IModel model = listComponent.getDefaultModel(); item.add(new Link("delete") { @Override public void onClick() { repeating.remove(item); controller.removeValue((T) model.getObject()); } }); }
From source file:com.userweave.pages.configuration.project.ProjectInvitationsListPanel.java
License:Open Source License
/** * Default constructor./*from www. j a v a2s .c om*/ * * @param id * Component id. * @param recipant * User to load messages for. */ public ProjectInvitationsListPanel(String id, final User recipant) { super(id); setOutputMarkupId(true); setDefaultModel(new LoadableDetachableModel() { private static final long serialVersionUID = 1L; @Override protected Object load() { return projectInvitationDao.findByRecipant(recipant); } }); addNoInvitaitonsLabel(); final RepeatingView rv = new RepeatingView("rv"); add(rv); for (final ProjectInvitation invitation : (List<ProjectInvitation>) getDefaultModelObject()) { noInvitations.setVisible(false); rv.add(new ProjectInvitationListItem(rv.newChildId(), invitation) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target, boolean accept) { rv.remove(this); onRemoveInvitation(target); if (rv.size() == 0) { noInvitations.setVisible(true); target.addComponent(noInvitations); } if (accept) { setResponsePage(new ConfigurationPage(invitation.getProject())); } else { target.addComponent(ProjectInvitationsListPanel.this); } } }); } }
From source file:jp.go.nict.langrid.management.web.view.page.language.component.form.panel.RepeatingLanguagePathPanel.java
License:Open Source License
private void setLanguagePathComponents(final RepeatingView repeater, String metaKey) { AbstractLanguagePathPanel panel = makeLanguagePathPanel(pathType, metaKey); repeater.add(panel);/* ww w .ja va 2s . com*/ AjaxSubmitLink link = new AjaxSubmitLink("removePathLink") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { if (!isRemovableComponent()) { return; } repeater.remove(getParent()); Iterator ite = repeater.iterator(); while (ite.hasNext()) { AbstractLanguagePathPanel panel = (AbstractLanguagePathPanel) ite.next(); if (repeater.size() == 1) { panel.switchVisible(); } } setRewriteComponent(target); } private static final long serialVersionUID = 1L; }; link.setDefaultFormProcessing(false).setVisible(!pathType.equals(LanguagePathType.UNKNOWN)) .setOutputMarkupPlaceholderTag(true); panel.add(link); if (repeater.size() == 1) { link.setVisible(false); } panel.addVisibleComponent(link); }