Class ToolTipFieldMarker
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.window.ctrl.ToolTipFieldMarker
-
- All Implemented Interfaces:
EventListener,FormControllerValidationListener
public class ToolTipFieldMarker extends Object implements FormControllerValidationListener
A specialized
FormControllerValidationListenerimplementation 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
FormValidationMessageFormatobject. 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
FormControlleronly.- Version:
- $Id: ToolTipFieldMarker.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description ToolTipFieldMarker(FormValidationMessageFormat messageFormat)Creates a new instance ofToolTipFieldMarkerand initializes it with the givenFormValidationMessageFormatobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidvalidationPerformed(FormControllerValidationEvent event)A validation operation has been performed.
-
-
-
Constructor Detail
-
ToolTipFieldMarker
public ToolTipFieldMarker(FormValidationMessageFormat messageFormat)
Creates a new instance ofToolTipFieldMarkerand initializes it with the givenFormValidationMessageFormatobject.- Parameters:
messageFormat- theFormValidationMessageFormatobject (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:
validationPerformedin interfaceFormControllerValidationListener- Parameters:
event- the validation event
-
-