List of usage examples for org.apache.wicket.markup.html.form Form visitChildren
public final <R> R visitChildren(final IVisitor<Component, R> visitor)
From source file:org.dcm4chee.web.common.markup.BaseForm.java
License:LGPL
public static void addInvalidComponentsToAjaxRequestTarget(final AjaxRequestTarget target, final Form<?> form) { IVisitor<Component> visitor = new IVisitor<Component>() { public Object component(Component c) { if (c instanceof FormComponent<?>) { FormComponent<?> fc = (FormComponent<?>) c; if (!fc.isValid()) { target.addComponent(fc); }/*w w w . j a v a 2 s. co m*/ } return IVisitor.CONTINUE_TRAVERSAL; } }; form.visitChildren(visitor); }
From source file:org.dcm4chee.wizard.common.component.ExtendedForm.java
License:LGPL
public static void addInvalidComponentsToAjaxRequestTarget(final AjaxRequestTarget target, final Form<?> form) { form.visitChildren(new IVisitor<Component, Void>() { public void component(Component component, IVisit<Void> visit) { if (component instanceof FormComponent<?>) { FormComponent<?> formComponent = (FormComponent<?>) component; if (!formComponent.isValid()) target.add(formComponent); }/*from ww w .j av a 2 s .c om*/ } }); }
From source file:org.dcm4chee.wizard.common.component.ExtendedForm.java
License:LGPL
public static void addFormComponentsToAjaxRequestTarget(final AjaxRequestTarget target, final Form<?> form) { form.visitChildren(new IVisitor<Component, Void>() { public void component(Component component, IVisit<Void> visit) { if (component.getOutputMarkupId()) target.add(component);/*from www . jav a 2s . c o m*/ } }); }
From source file:org.geoserver.web.data.layergroup.LayerGroupEditPage.java
License:Open Source License
public LayerGroupEditPage(PageParameters parameters) { String groupName = parameters.getString(GROUP); String wsName = parameters.getString(WORKSPACE); LayerGroupInfo lg = wsName != null ? getCatalog().getLayerGroupByName(wsName, groupName) : getCatalog().getLayerGroupByName(groupName); if (lg == null) { error(new ParamResourceModel("LayerGroupEditPage.notFound", this, groupName).getString()); doReturn(LayerGroupPage.class); return;/*from w w w. j a v a 2s . c o m*/ } initUI(lg); if (!isAuthenticatedAsAdmin()) { Form f = (Form) get("form"); //global layer groups only editable by full admin if (lg.getWorkspace() == null) { //disable all form components but cancel f.visitChildren(new IVisitor<Component>() { @Override public Object component(Component c) { if (!(c instanceof AbstractLink && "cancel".equals(c.getId()))) { c.setEnabled(false); } return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; } }); f.get("save").setVisible(false); info(new StringResourceModel("globalLayerGroupReadOnly", this, null).getString()); } //always disable the workspace toggle f.get("workspace").setEnabled(false); } }
From source file:org.geoserver.web.GeoServerWicketTestSupport.java
License:Open Source License
public void prefillForm(final FormTester tester) { Form form = tester.getForm(); form.visitChildren(new Component.IVisitor() { public Object component(Component component) { if (component instanceof FormComponent) { FormComponent fc = (FormComponent) component; String name = fc.getInputName(); String value = fc.getValue(); tester.setValue(name, value); }/*ww w . j av a 2 s .c o m*/ return Component.IVisitor.CONTINUE_TRAVERSAL; } }); }
From source file:org.geoserver.wms.eo.web.EoLayerGroupEditPage.java
License:Open Source License
public EoLayerGroupEditPage(PageParameters parameters) { String groupName = parameters.getString(GROUP); String wsName = parameters.getString(WORKSPACE); LayerGroupInfo lg = wsName != null ? getCatalog().getLayerGroupByName(wsName, groupName) : getCatalog().getLayerGroupByName(groupName); if (lg == null) { error(new ParamResourceModel("LayerGroupEditPage.notFound", this, groupName).getString()); doReturn(LayerGroupPage.class); return;/* ww w .ja va 2 s. c om*/ } initUI(lg); if (!isAuthenticatedAsAdmin()) { Form f = (Form) get("form"); //global layer groups only editable by full admin if (lg.getWorkspace() == null) { //disable all form components but cancel f.visitChildren(new IVisitor<Component>() { @Override public Object component(Component c) { if (!(c instanceof AbstractLink && "cancel".equals(c.getId()))) { c.setEnabled(false); } return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; } }); f.get("save").setVisible(false); info(new StringResourceModel("globalLayerGroupReadOnly", this, null).getString()); } //always disable the workspace toggle f.get("workspace").setEnabled(false); } }