List of usage examples for org.apache.wicket.markup.repeater RepeatingView iterator
@Override
public Iterator<Component> iterator()
From source file:jdave.wicket.ComponentSpecification.java
License:Apache License
/** * Select an item from a <code>RepeatingView</code>. *///from w w w .ja v a 2 s . co m @SuppressWarnings("unchecked") public <T> Item<T> itemAt(final RepeatingView view, final int index) { final Iterator<? extends Component> items = view.iterator(); for (int i = 0; i < index; i++) { items.next(); } return (Item<T>) items.next(); }
From source file:jp.go.nict.langrid.management.web.view.page.admin.GridSettingsResultPage.java
License:Open Source License
/** * /*from ww w . j ava 2s . c o m*/ * */ public GridSettingsResultPage(int days, RepeatingView repeatingView) { try { add(new Label("commercial", ServiceFactory.getInstance().getGridService().isCommercialUse() ? MessageManager.getMessage("LanguageGridOperator.gridSettings.label.useType.commercial.Permit") : MessageManager .getMessage("LanguageGridOperator.gridSettings.label.useType.commercial.Profibit"))); add(new Label("enabled", ServiceFactory.getInstance().getGridService().isAutoApproveEnabled() ? MessageManager.getMessage("LanguageGridOperator.gridSettings.table.AutoApprove.Enable") : MessageManager.getMessage("LanguageGridOperator.gridSettings.table.AutoApprove.Disable"))); } catch (ServiceManagerException e) { doErrorProcess(e); } WebMarkupContainer wc = new WebMarkupContainer("clear-container"); wc.add(new Label("cleared", MessageManager.getMessage("LanguageGridOperator.message.clear.Complete", getLocale()))); int i = 0; Iterator it = repeatingView.iterator(); while (it.hasNext()) { AccessLimitFieldPanel alfp = (AccessLimitFieldPanel) it.next(); if (alfp.getCount().getInput() == null || alfp.getCount().getInput().length() == 0) { continue; } WebMarkupContainer repeat = new WebMarkupContainer(view.newChildId()); repeat.add(new Label("value", format(alfp))); view.add(repeat); i++; } if (i > 0) { wc.setVisible(false); } add(new Label("days", String.valueOf(days))); add(wc); add(view); }
From source file:jp.go.nict.langrid.management.web.view.page.admin.PreventionOfFraudulentUsageResultPage.java
License:Open Source License
/** * //from w ww .j a va2s.c o m * */ public PreventionOfFraudulentUsageResultPage(int days, RepeatingView repeatingView) { Label label = new Label("cleared", MessageManager.getMessage("LanguageGridOperator.message.clear.Complete", getLocale())); int i = 0; Iterator it = repeatingView.iterator(); while (it.hasNext()) { AccessLimitFieldPanel alfp = (AccessLimitFieldPanel) it.next(); if (alfp.getCount().getInput() == null || alfp.getCount().getInput().length() == 0) { continue; } WebMarkupContainer repeat = new WebMarkupContainer(view.newChildId()); repeat.add(new Label("value", format(alfp))); view.add(repeat); i++; } if (i > 0) { label.setVisible(false); } add(new Label("days", String.valueOf(days))); add(label); add(view); }
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 ww w . ja v a 2 s . 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); }
From source file:org.geoserver.geopkg.GeoPackageMimeTypeTest.java
License:Open Source License
@Test public void testGeoPackageFormat() { // Opening the selected page tester.startPage(new MapPreviewPage()); tester.assertRenderedPage(MapPreviewPage.class); tester.assertNoErrorMessage();/*from w ww . ja v a 2 s . c o m*/ // Getting the wms outputformats available Component component = tester.getComponentFromLastRenderedPage( "table:listContainer:items:1:itemProperties:4:component:menu:wmsFormats"); assertNotNull(component); assertTrue(component instanceof RepeatingView); // Get the list of all the format RepeatingView view = (RepeatingView) component; Iterator<? extends Component> iterator = view.iterator(); // Check that GeoPackage has been found boolean gpkgFound = false; // Get the string for the application/x-gpkg mimetype ParamResourceModel rm = new ParamResourceModel("format.wms.application/x-gpkg", null, ""); String mbtiles = rm.getString(); while (iterator.hasNext()) { Component comp = iterator.next(); assertTrue(comp instanceof Label); Label lb = (Label) comp; String test = lb.getDefaultModelObjectAsString(); if (test.contains(mbtiles)) { gpkgFound = true; } } // Ensure the GeoPackage string has been found assertTrue(gpkgFound); }
From source file:org.geoserver.mbtiles.MBTilesMimeTypeTest.java
License:Open Source License
@Test public void testMBTilesFormat() { // Opening the selected page tester.startPage(new MapPreviewPage()); tester.assertRenderedPage(MapPreviewPage.class); tester.assertNoErrorMessage();/*from w w w . ja v a2s. co m*/ // Getting the wms outputformats available Component component = tester.getComponentFromLastRenderedPage( "table:listContainer:items:1:itemProperties:4:component:menu:wmsFormats"); assertNotNull(component); assertTrue(component instanceof RepeatingView); // Get the list of all the format RepeatingView view = (RepeatingView) component; Iterator<? extends Component> iterator = view.iterator(); // Check that MBTiles has been found boolean mbtilesFound = false; // Get the string for the application/x-sqlite3 mimetype ParamResourceModel rm = new ParamResourceModel("format.wms.application/x-sqlite3", null, ""); String mbtiles = rm.getString(); while (iterator.hasNext()) { Component comp = iterator.next(); assertTrue(comp instanceof Label); Label lb = (Label) comp; String test = lb.getDefaultModelObjectAsString(); if (test.contains(mbtiles)) { mbtilesFound = true; } } // Ensure the MBTiles string has been found assertTrue(mbtilesFound); }
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 ava 2s . c o 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); } }