Class ToolTipFieldMarker

  • All Implemented Interfaces:
    EventListener, FormControllerValidationListener

    public class ToolTipFieldMarker
    extends Object
    implements FormControllerValidationListener

    A specialized FormControllerValidationListener implementation that is able to adapt the tool tips of input elements for which validation messages are available.

    An instance of this class can be registered as validation listener at a FormController. Whenever a validation event is received the instance iterates over the validation results for all input fields. The texts for error and warning messages are extracted and combined. Then they are set as additional tool tip for the corresponding input element. This is an easy but powerful means to give feedback about validation results to the user: the user just have to move the mouse over a control, and all related validation messages are displayed.

    The tool tip texts produced by this class can be configured by associating an instance with a FormValidationMessageFormat object. This object knows how to translate validation messages to text. It is invoked for each field with validation messages, and the text produced by it is set as additional tool tip text.

    Implementation note: This class is not thread-safe. An instance can be associated with a single FormController only.

    Version:
    $Id: ToolTipFieldMarker.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • ToolTipFieldMarker

        public ToolTipFieldMarker​(FormValidationMessageFormat messageFormat)
        Creates a new instance of ToolTipFieldMarker and initializes it with the given FormValidationMessageFormat object.
        Parameters:
        messageFormat - the FormValidationMessageFormat object (must not be null)
        Throws:
        IllegalArgumentException - if the format object is null
    • Method Detail

      • validationPerformed

        public void validationPerformed​(FormControllerValidationEvent event)
        A validation operation has been performed. This implementation determines the fields for which validation messages exist. It creates corresponding tool tips for the messages and sets them.
        Specified by:
        validationPerformed in interface FormControllerValidationListener
        Parameters:
        event - the validation event