Holger's
Java API

com.antelmann.util.gui
Interface FormValidator<T>

All Known Implementing Classes:
JPasswordChangeForm, JWorkUnitForm

public interface FormValidator<T>

used for form dialogs that update data. Both methods defined by this interface are called upon pressing the 'OK'-button on a FormDialog.

Author:
Holger Antelmann
See Also:
FormDialog

Method Summary
 T commitFormAction(JComponent formComponent)
          This method processes/stores all relevant information from the form and returns the object that was committed.
 void validateForm(JComponent formComponent)
          validates the given form by checking it for consistency.
 

Method Detail

validateForm

void validateForm(JComponent formComponent)
                  throws FormValidationException
validates the given form by checking it for consistency. If the form consistency check passed, the method simply returns gracefully. This method is always called before the form is then actually committed after pressing 'ok' in the form dialog. The FormDialog remains visible even after a FormValidation was thrown.

Parameters:
formComponent - the component that contains the fields to be validated
Throws:
FormValidationException - if any editable part of the form is inconsistent

commitFormAction

T commitFormAction(JComponent formComponent)
                   throws Exception
This method processes/stores all relevant information from the form and returns the object that was committed. It can be savely assumed that the validation has already passed before this method is called. If an exception occurs, it will be caught and shown by the FormDialog upon pressing the ok-button. The FormDialog will be disposed after this method returns.

Parameters:
formComponent - the component that contains the fields to be submitted for action
Returns:
the object that was committed by this method or null.
Throws:
Exception - if something prevented the successfull processing of the form


(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads