org.hackystat.projectbrowser.page.validator
Class ProjectDateValidator

java.lang.Object
  extended by org.apache.wicket.markup.html.form.validation.AbstractFormValidator
      extended by org.hackystat.projectbrowser.page.validator.ProjectDateValidator
All Implemented Interfaces:
java.io.Serializable, org.apache.wicket.IClusterable, org.apache.wicket.markup.html.form.validation.IFormValidator

public class ProjectDateValidator
extends org.apache.wicket.markup.html.form.validation.AbstractFormValidator

Provides a project date validator. This validator will work with forms that have a multiple selection menu for Projects, plus either one or two date fields. It provides two constructors: one for forms with a Project menu and one date, and one for forms with a Project menu and two dates.

Author:
Philip Johnson
See Also:
Serialized Form

Constructor Summary
ProjectDateValidator(org.apache.wicket.markup.html.form.FormComponent projectMenu, org.apache.wicket.markup.html.form.FormComponent dateField)
          Takes a Project menu and a single Date field.
ProjectDateValidator(org.apache.wicket.markup.html.form.FormComponent projectMenu, org.apache.wicket.markup.html.form.FormComponent startDateField, org.apache.wicket.markup.html.form.FormComponent endDateField)
          Takes a Project menu (ListMultipleChoice) and two Date fields (DateTextField).
 
Method Summary
 org.apache.wicket.markup.html.form.FormComponent[] getDependentFormComponents()
          Returns the form components.
 void validate(org.apache.wicket.markup.html.form.Form projectDateForm)
          Performs the validation.
 
Methods inherited from class org.apache.wicket.markup.html.form.validation.AbstractFormValidator
error, error, error, error, messageModel, resourceKey, variablesMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectDateValidator

public ProjectDateValidator(org.apache.wicket.markup.html.form.FormComponent projectMenu,
                            org.apache.wicket.markup.html.form.FormComponent dateField)
Takes a Project menu and a single Date field.

Parameters:
projectMenu - The project menu component.
dateField - The Date field component.

ProjectDateValidator

public ProjectDateValidator(org.apache.wicket.markup.html.form.FormComponent projectMenu,
                            org.apache.wicket.markup.html.form.FormComponent startDateField,
                            org.apache.wicket.markup.html.form.FormComponent endDateField)
Takes a Project menu (ListMultipleChoice) and two Date fields (DateTextField).

Parameters:
projectMenu - The project menu component.
startDateField - The Date field component.
endDateField - The Date field component.
Method Detail

getDependentFormComponents

public org.apache.wicket.markup.html.form.FormComponent[] getDependentFormComponents()
Returns the form components.

Returns:
The form components.

validate

public void validate(org.apache.wicket.markup.html.form.Form projectDateForm)
Performs the validation. Note that this validation must handle a projectMenu plus a single date, or a projectMenu plus two dates (start and end date). This method is ran if all components returned by getDependentFormComponents() are valid.

Parameters:
projectDateForm - The form to validate.