Example usage for org.apache.wicket.markup.repeater RepeatingView size

List of usage examples for org.apache.wicket.markup.repeater RepeatingView size

Introduction

In this page you can find the example usage for org.apache.wicket.markup.repeater RepeatingView size.

Prototype

public int size() 

Source Link

Document

Get the number of children in this container.

Usage

From source file:com.effectivemaven.centrepoint.web.EditPanelConfigurationPageTest.java

License:Apache License

@SuppressWarnings("unchecked")
private void assertForm(String name, String value) {
    wicketTester.assertComponent(EDIT_PANEL_CONFIG_FORM + ":row", RepeatingView.class);
    RepeatingView rv = (RepeatingView) wicketTester
            .getComponentFromLastRenderedPage(EDIT_PANEL_CONFIG_FORM + ":row");
    assert rv.size() == 1;
    WebMarkupContainer c = (WebMarkupContainer) rv.get(0);
    assert name.equals(c.get("name").getDefaultModelObjectAsString());
    TextField<String> field = (TextField<String>) c.get("value");
    assert field.getModelObject() == value;
}

From source file:com.userweave.pages.configuration.project.ProjectInvitationsListPanel.java

License:Open Source License

/**
 * Default constructor./*from  www  . jav a 2s  .c  o  m*/
 * 
 * @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);/*from   w  ww.  j  a v a2 s . c o  m*/
    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);
}

From source file:jp.go.nict.langrid.management.web.view.page.language.component.panel.MultidirectionalLanguagePathPanel.java

License:Open Source License

private Component getMultihopLanguagePathLabel(LanguagePath[] paths) throws InvalidLanguageTagException {
    WebMarkupContainer container = new WebMarkupContainer("multihopContainer");
    RepeatingView rv = new RepeatingView("multihops");
    if (paths != null) {
        for (LanguagePath path : paths) {
            WebMarkupContainer wmc = new WebMarkupContainer(rv.newChildId());
            rv.add(wmc.add(new Label("multihopLanguages",
                    LanguagePathUtil.makeLanguagePathString(new LanguagePath[] { path },
                            MetaAttribute.SUPPORTEDLANGUAGEPATHS_PATHLIST, getLocale()))
                                    .setRenderBodyOnly(true)));
        }/*from  www. ja v  a2s  .  co  m*/
    }
    container.add(rv);
    container.setVisible(rv.size() != 0);
    addCount += rv.size();
    return container;
}

From source file:jp.go.nict.langrid.management.web.view.page.language.component.panel.MultidirectionalLanguagePathPanel.java

License:Open Source License

private Component getSingleLanguagePathLabel(LanguagePath[] paths) throws InvalidLanguageTagException {
    WebMarkupContainer container = new WebMarkupContainer("singleContainer");
    RepeatingView rv = new RepeatingView("singles");
    if (paths != null) {
        WebMarkupContainer wmc = new WebMarkupContainer(rv.newChildId());
        rv.add(wmc.add(new Label("singleLanguages",
                LanguagePathUtil.makeLanguagePathString(paths, MetaAttribute.SUPPORTEDLANGUAGES, getLocale()))
                        .setRenderBodyOnly(true)));
    }//from   w w w .  ja v a 2  s.com
    container.add(rv);
    container.setVisible(rv.size() != 0);
    addCount += rv.size();
    return container;
}

From source file:jp.go.nict.langrid.management.web.view.page.language.component.panel.MultidirectionalLanguagePathPanel.java

License:Open Source License

private Component getCombinationPathViewComponent(LanguagePath[] paths) throws InvalidLanguageTagException {
    WebMarkupContainer container = new WebMarkupContainer("combinationContainer");
    RepeatingView rv = new RepeatingView("combinations");
    if (paths != null) {
        for (LanguagePath path : paths) {
            WebMarkupContainer wmc = new WebMarkupContainer(rv.newChildId());
            rv.add(wmc.add(new Label("combinationPairs",
                    LanguagePathUtil.makeLanguagePathString(new LanguagePath[] { path },
                            MetaAttribute.SUPPORTEDLANGUAGEPAIRS_ANYCOMBINATION, getLocale()))
                                    .setRenderBodyOnly(true)));
        }/*from  w ww  . j  a  va  2 s . c o  m*/
    }
    container.add(rv);
    container.setVisible(rv.size() != 0);
    addCount += rv.size();
    return container;
}

From source file:jp.go.nict.langrid.management.web.view.page.language.component.panel.MultidirectionalLanguagePathPanel.java

License:Open Source License

private Component getMultidirectionalPathViewComponent(Collection<LanguagePath[]> pathList)
        throws InvalidLanguageTagException {
    WebMarkupContainer container = new WebMarkupContainer("multidirectionalContainer");
    RepeatingView rv = new RepeatingView("multidirectionals");
    if (pathList != null) {
        for (LanguagePath[] paths : pathList) {
            WebMarkupContainer wmc = new WebMarkupContainer(rv.newChildId());
            rv.add(wmc.add(new Label("multidirectionalPairs",
                    LanguagePathUtil.makeLanguagePathString(paths,
                            MetaAttribute.SUPPORTEDLANGUAGEPAIRS_PAIRLIST, getLocale()))
                                    .setRenderBodyOnly(true)));
        }/*  w  ww  . j  a v  a2  s  . c  o  m*/
    }
    container.add(rv);
    container.setVisible(rv.size() != 0);
    addCount += rv.size();
    return container;
}

From source file:org.artifactory.webapp.wicket.page.browse.treebrowser.tabs.general.GeneralTabPanel.java

License:Open Source License

public GeneralTabPanel(String id, RepoAwareActionableItem repoItem) {
    super(id);/*w ww.ja  va2 s.co m*/
    setOutputMarkupId(true);
    this.repoItem = repoItem;

    add(new GeneralInfoPanel("generalInfoPanel").init(repoItem));

    if (shouldDisplayDistributionManagement()) {
        RepeatingView distributionManagement = new RepeatingView("distributionManagement");
        add(distributionManagement);

        //TODO [mamo]: make it generic, let addon contribute ui sections
        AddonsManager addonsManager = ContextHelper.get().beanForType(AddonsManager.class);
        GemsWebAddon gemsWebAddon = addonsManager.addonByType(GemsWebAddon.class);
        if (!gemsWebAddon.isDefault() && repoItem.getRepo().getType().equals(RepoType.Gems)) {
            distributionManagement.add(gemsWebAddon.buildDistributionManagementPanel(
                    distributionManagement.newChildId(), repoItem.getRepoPath()));
        }

        NpmWebAddon npmWebAddon = addonsManager.addonByType(NpmWebAddon.class);
        if (!npmWebAddon.isDefault() && repoItem.getRepo().getType().equals(RepoType.Npm)) {
            distributionManagement.add(npmWebAddon.buildDistributionManagementPanel(
                    distributionManagement.newChildId(), repoItem.getRepoPath()));
        }

        NuGetWebAddon nuGetWebAddon = addonsManager.addonByType(NuGetWebAddon.class);
        if (!nuGetWebAddon.isDefault() && repoItem.getRepo().getType().equals(RepoType.NuGet)) {
            distributionManagement.add(nuGetWebAddon.buildDistributionManagementPanel(
                    distributionManagement.newChildId(), repoItem.getRepoPath()));
        }

        DebianWebAddon debianWebAddon = addonsManager.addonByType(DebianWebAddon.class);
        if (!debianWebAddon.isDefault() && repoItem.getRepo().getType().equals(RepoType.Debian)) {
            distributionManagement.add(debianWebAddon.buildDistributionManagementPanel(
                    distributionManagement.newChildId(), repoItem.getRepoPath()));
        }

        PypiWebAddon pypiWebAddon = addonsManager.addonByType(PypiWebAddon.class);
        if (!pypiWebAddon.isDefault() && repoItem.getRepo().getType().equals(RepoType.Pypi)) {
            distributionManagement.add(pypiWebAddon.buildDistributionManagementPanel(
                    distributionManagement.newChildId(), repoItem.getRepoPath()));
        }

        GitLfsWebAddon lfsWebAddon = addonsManager.addonByType(GitLfsWebAddon.class);
        if (!lfsWebAddon.isDefault() && RepoType.GitLfs.equals(repoItem.getRepo().getType())) {
            distributionManagement.add(lfsWebAddon.buildDistributionManagementPanel(
                    distributionManagement.newChildId(), repoItem.getRepoPath()));
        }

        if (distributionManagement.size() == 0) {
            distributionManagement
                    .add(new DistributionManagementPanel(distributionManagement.newChildId(), repoItem));
        }
    } else {
        add(new WebMarkupContainer("distributionManagement"));
    }

    add(checksumInfo());

    add(new ActionsPanel("actionsPanel", repoItem));

    WebMarkupContainer markupContainer = new WebMarkupContainer("dependencyDeclarationPanel");
    add(markupContainer);

    org.artifactory.fs.ItemInfo itemInfo = repoItem.getItemInfo();
    if (!itemInfo.isFolder()) {
        ModuleInfo moduleInfo = null;
        if (repoItem.getRepo().isMavenRepoLayout()) {
            MavenArtifactInfo mavenArtifactInfo = MavenArtifactInfo.fromRepoPath(itemInfo.getRepoPath());
            if (mavenArtifactInfo.isValid()) {
                moduleInfo = new ModuleInfoBuilder().organization(mavenArtifactInfo.getGroupId())
                        .module(mavenArtifactInfo.getArtifactId()).baseRevision(mavenArtifactInfo.getVersion())
                        .classifier(mavenArtifactInfo.getClassifier()).ext(mavenArtifactInfo.getType()).build();
            }
        }

        if (moduleInfo == null) {
            moduleInfo = repositoryService.getItemModuleInfo(itemInfo.getRepoPath());
        }

        if (moduleInfo.isValid()) {
            this.replace(new DependencyDeclarationPanel(markupContainer.getId(), moduleInfo,
                    repoItem.getRepo().getRepoLayout()));
        }
    }

    add(new VirtualRepoListPanel("virtualRepoList", repoItem));
    addMessage();
}

From source file:org.efaps.ui.wicket.components.table.row.RowPanel.java

License:Apache License

/**
 * @param _wicketId wicket id for this component
 * @param _model model for this component
 * @param _tablePanel tablepanel this row is in
 * @param _updateListMenu must the listmenu be updated
 * @param _idx index of the current row//from   w w  w  .j a va2s .  c o  m
 * @throws EFapsException on error
 *
 */
public RowPanel(final String _wicketId, final IModel<UIRow> _model, final TablePanel _tablePanel,
        final boolean _updateListMenu, final int _idx) throws EFapsException {
    super(_wicketId, _model);
    final UIRow uirow = (UIRow) super.getDefaultModelObject();

    final UITable uiTable = (UITable) _tablePanel.getDefaultModelObject();
    int i = uiTable.getTableId();

    final RepeatingView cellRepeater = new RepeatingView("cellRepeater");
    add(cellRepeater);

    boolean firstCell = false;
    if (uiTable.isShowCheckBoxes()) {
        final CheckBoxField checkbox = new CheckBoxField(cellRepeater.newChildId(), uirow.getInstanceKey());
        checkbox.setOutputMarkupId(true);
        checkbox.add(AttributeModifier.append("class", "eFapsTableCheckBoxCell eFapsTableCellClear"));
        cellRepeater.add(checkbox);
        i++;
        firstCell = true;
    }
    if (uiTable.isEditable()) {
        final AjaxAddRemoveRowPanel remove = new AjaxAddRemoveRowPanel(cellRepeater.newChildId(),
                Model.of(uiTable), this);
        remove.setOutputMarkupId(true);
        remove.add(AttributeModifier.append("class", "eFapsTableRemoveRowCell eFapsTableCellClear"));
        cellRepeater.add(remove);
        i++;
        firstCell = true;
    }

    for (final IFilterable filterable : uirow.getCells()) {
        Component cell = null;
        boolean fixedWidth = false;
        if (filterable instanceof AbstractUIField) {
            fixedWidth = ((AbstractUIField) filterable).getFieldConfiguration().isFixedWidth();
            cell = new FieldPanel(cellRepeater.newChildId(), Model.of((AbstractUIField) filterable));
        }
        cell.setOutputMarkupId(true);
        if (fixedWidth) {
            if (firstCell) {
                firstCell = false;
                cell.add(AttributeModifier.append("class",
                        "eFapsTableFirstCell eFapsTableCell" + " eFapsCellFixedWidth" + i));
            } else {
                cell.add(AttributeModifier.append("class", "eFapsTableCell eFapsCellFixedWidth" + i));
            }
        } else {
            if (firstCell) {
                firstCell = false;
                cell.add(AttributeModifier.append("class",
                        "eFapsTableFirstCell eFapsTableCell" + " eFapsCellWidth" + i));
            } else {
                cell.add(AttributeModifier.append("class", "eFapsTableCell eFapsCellWidth" + i));
            }
        }
        if (cellRepeater.size() < 1) {
            cell.add(AttributeModifier.append("class", "eFapsTableCellClear"));
        }
        cellRepeater.add(cell);
        i++;
    }

    final RepeatingView hiddenRepeater = new RepeatingView("hiddenRepeater");
    this.add(hiddenRepeater);
    for (final IHidden hidden : uirow.getHidden()) {
        if (!hidden.isAdded()) {
            hiddenRepeater.add(hidden.getComponent(hiddenRepeater.newChildId()));
            hidden.setAdded(true);
        }
    }
    this.add(new RowId("rowId", Model.of((AbstractInstanceObject) uirow)));
}

From source file:org.openengsb.ui.admin.testClient.TestClientTest.java

License:Apache License

@Test
public void testCreateTextFieldsFor2StringArguments() throws Exception {
    setupAndStartTestClientPage();//from  w w  w  .  j  a  v  a2 s  . co  m
    RepeatingView argList = (RepeatingView) tester
            .getComponentFromLastRenderedPage("methodCallForm:argumentListContainer:argumentList");

    setServiceInDropDown(2);
    setMethodInDropDown(0);
    Assert.assertEquals(2, argList.size());
    Iterator<? extends Component> iterator = argList.iterator();
    while (iterator.hasNext()) {
        Component next = iterator.next();
        tester.assertComponent(next.getPageRelativePath() + ":valueEditor", InputField.class);
    }
}