@@ -0,0 +1,2775 @@
+/**%0A * Copyright (C) 2010 Asterios Raptis%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *         http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage de.alpharogroup.wicket.behaviors.validators;%0A%0Aimport java.util.Date;%0A%0Aimport org.apache.wicket.markup.html.form.Form;%0Aimport org.apache.wicket.markup.html.form.FormComponent;%0Aimport org.apache.wicket.markup.html.form.validation.AbstractFormValidator;%0Aimport org.apache.wicket.util.lang.Args;%0A%0A/**%0A * The class %7B@link DateRangeFormValidator%7D can validate two %7B@link Date%7D objects from the two%0A * %7B@link FormComponent%7D's given to this validator.%0A * %0A * %3Cbr%3E%3Cbr%3E%3Cbr%3E%0A * Example: %3Cbr%3E%3Cbr%3E%0A * %3Ccode%3E%0A * %09%09form.add(new DateRangeFormValidator(startDateFormComponent, endDateFormComponent));%0A * %3C/code%3E%0A */%0Apublic class DateRangeFormValidator extends AbstractFormValidator%0A%7B%0A%0A%09/** The Constant serialVersionUID. */%0A%09private static final long serialVersionUID = 1L;%0A%0A%09/** The form component that represents the start date . */%0A%09private final FormComponent%3CDate%3E startDateFormComponent;%0A%0A%09/** The form component that represents the end date . */%0A%09private final FormComponent%3CDate%3E endDateFormComponent;%0A%0A%09/**%0A%09 * Instantiates a new %7B@link DateRangeFormValidator%7D.%0A%09 *%0A%09 * @param startDateFormComponent%0A%09 *            the start date form component%0A%09 * @param endDateFormComponent%0A%09 *            the end date form component%0A%09 */%0A%09public DateRangeFormValidator(final FormComponent%3CDate%3E startDateFormComponent,%0A%09%09final FormComponent%3CDate%3E endDateFormComponent)%0A%09%7B%0A%09%09this.startDateFormComponent = Args.notNull(startDateFormComponent,%0A%09%09%09%22startDateFormComponent%22);%0A%09%09this.endDateFormComponent = Args.notNull(endDateFormComponent, %22endDateFormComponent%22);%0A%09%7D%0A%0A%09/**%0A%09 * %7B@inheritDoc%7D%0A%09 */%0A%09@Override%0A%09public FormComponent%3C?%3E%5B%5D getDependentFormComponents()%0A%09%7B%0A%09%09return new FormComponent%5B%5D %7B startDateFormComponent, endDateFormComponent %7D;%0A%09%7D%0A%0A%09/**%0A%09 * %7B@inheritDoc%7D%0A%09 */%0A%09@Override%0A%09public void validate(Form%3C?%3E form)%0A%09%7B%0A%09%09Date startDate = startDateFormComponent.getConvertedInput();%0A%09%09Date endDate = endDateFormComponent.getConvertedInput();%0A%0A%09%09if (endDate.before(startDate))%0A%09%09%7B%0A%09%09%09error(endDateFormComponent, resourceKey());%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * %7B@inheritDoc%7D%0A%09 */%0A%09@Override%0A%09protected String resourceKey()%0A%09%7B%0A%09%09return %22global.validation.error.enddate.before.startdate%22;%0A%09%7D%0A%0A%7D%0A

Create DateRangeFormValidator.java