Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.view.swing
Class ValidationHelper  view ValidationHelper download ValidationHelper.java

java.lang.Object
  extended byorg.scopemvc.view.swing.ValidationHelper

public class ValidationHelper
extends java.lang.Object

Handles ModelBindable.validationFailed(java.lang.Exception)>ModelBindable.validationFailed(java.lang.Exception) 55 and ModelBindable.validationSuccess()>ModelBindable.validationSuccess() 55 by setting the background colour of the parent component to a new colour and being able to generate an "error tooltip" that is coloured and contains the localized error message from the validation failure.

Version:
$Revision: 1.3 $ $Date: 2002/02/09 15:57:36 $

Field Summary
private  java.awt.Color originalBackground
          Keep the parent's original background colour so it can be restored when validation succeeds.
private  java.lang.String originalTooltipText
          Keep the parent's tooltip text so we can restore it on validation success.
private  javax.swing.JComponent parent
          Owning JComponent of this helper.
static java.awt.Color VALIDATION_FAILED_COLOR
           
private  java.lang.String validationError
          The localized error text from the exception that caused the validation failure.
 
Constructor Summary
ValidationHelper(javax.swing.JComponent inComponent)
           
 
Method Summary
private  void clearTooltip()
          Marvellous hack to hide any shown tooltips.
 javax.swing.JToolTip createToolTip(javax.swing.JToolTip inTip)
          Parent should call this in its createTooltip() to allow helper to substitute an error tooltip.
 void validationFailed(java.lang.Exception inException)
          Signal that validation failed.
 void validationSuccess()
          Signal that validation succeeded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validationError

private java.lang.String validationError
The localized error text from the exception that caused the validation failure.


parent

private javax.swing.JComponent parent
Owning JComponent of this helper.


originalTooltipText

private java.lang.String originalTooltipText
Keep the parent's tooltip text so we can restore it on validation success.


originalBackground

private java.awt.Color originalBackground
Keep the parent's original background colour so it can be restored when validation succeeds.


VALIDATION_FAILED_COLOR

public static final java.awt.Color VALIDATION_FAILED_COLOR
Constructor Detail

ValidationHelper

public ValidationHelper(javax.swing.JComponent inComponent)
Method Detail

validationFailed

public void validationFailed(java.lang.Exception inException)
Signal that validation failed.


validationSuccess

public void validationSuccess()
Signal that validation succeeded.


clearTooltip

private void clearTooltip()
Marvellous hack to hide any shown tooltips.


createToolTip

public javax.swing.JToolTip createToolTip(javax.swing.JToolTip inTip)
Parent should call this in its createTooltip() to allow helper to substitute an error tooltip.