001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket.markup.html.form.validation; 018 019import org.apache.wicket.markup.html.form.Form; 020import org.apache.wicket.markup.html.form.FormComponent; 021import org.apache.wicket.util.io.IClusterable; 022 023/** 024 * Interface that represents validators that check multiple components. These validators are added 025 * to the form and only executed if all form components returned by 026 * {@link IFormValidator#getDependentFormComponents()} have been successfully validated before this 027 * validator runs. 028 * 029 * 030 * @see AbstractFormValidator 031 * @see org.apache.wicket.validation.IValidator 032 * @author Igor Vaynberg (ivaynberg) 033 */ 034public interface IFormValidator extends IClusterable 035{ 036 /** 037 * @return array of {@link FormComponent}s that this validator depends on 038 */ 039 FormComponent<?>[] getDependentFormComponents(); 040 041 /** 042 * This method is ran if all components returned by 043 * {@link IFormValidator#getDependentFormComponents()} are valid. 044 * 045 * <p> 046 * To report validation error use 047 * {@link FormComponent#error(org.apache.wicket.validation.IValidationError)} by using any of 048 * the dependent form components or extend from AbstractFormValidator and use its 049 * {@link AbstractFormValidator#error(FormComponent, String, java.util.Map)} method. 050 * 051 * @param form 052 * form this validator is added to 053 */ 054 void validate(Form<?> form); 055}