Class DefaultTableEditorValidationHandler

  • All Implemented Interfaces:
    TableEditorValidationHandler

    public class DefaultTableEditorValidationHandler
    extends Object
    implements TableEditorValidationHandler

    A default implementation of the TableEditorValidationHandler interface.

    This implementation simply concatenates all error messages contained in the passed in FormValidatorResults objects and displays them in a message box. (For this purpose the application's MessageOutput object is used.) If validation was successful, no action is performed.

    Since:
    1.3
    Version:
    $Id$
    Author:
    Oliver Heger
    • Constructor Detail

      • DefaultTableEditorValidationHandler

        public DefaultTableEditorValidationHandler()
    • Method Detail

      • getOutput

        public MessageOutput getOutput()
        Returns the message output object used for displaying message boxes.
        Returns:
        the output object
      • setOutput

        public void setOutput​(MessageOutput output)
        Sets the message output object to be used for displaying message boxes. This object can be null, then no messages will be displayed.
        Parameters:
        output - the output object to be used
      • getApplication

        public Application getApplication()
        Returns a reference to the Application object. This object is used internally for accessing some global information.
        Returns:
        a reference to the used Application object (can be null)
      • setApplication

        public void setApplication​(Application app)
        Initializes this object with a reference to the central Application object. If no MessageOutput object has been set so far, this implementation obtains the MessageOutput from the application. It will be used in validationPerformed() for displaying error messages. The Application object itself is stored, too because it is needed for accessing some global information. If you want to use a different MessageOutput object than the one associated with the application, you have to call setOutput() explicitly.
        Parameters:
        app - the central Application object
      • validationPerformed

        public boolean validationPerformed​(Object table,
                                           Form editForm,
                                           TableTag tableTag,
                                           FormValidatorResults results,
                                           int row,
                                           int col)
        Reacts on a validation. If some fields are invalid, and the current message output object is not null, and the reference to the central Application object has been initialized, a message box will be displayed.
        Specified by:
        validationPerformed in interface TableEditorValidationHandler
        Parameters:
        table - the table component (this is expected to be of class javax.swing.JTable)
        editForm - the editor form
        tableTag - the tag with the table definition
        results - the object with the validation results
        row - the current row index
        col - the current column index
        Returns:
        a flag whether field values have been modified (this implementation always returns false)