org.archiviststoolkit.util
Class JGoodiesValidationUtils

java.lang.Object
  extended by org.archiviststoolkit.util.JGoodiesValidationUtils

public final class JGoodiesValidationUtils
extends java.lang.Object

Consists only of static convenience methods used throughout the examples of the JGoodies Validation tutorial.


Method Summary
static java.beans.PropertyChangeListener createDebugPropertyChangeListener()
          Returns a listener that writes bean property changes to the console.
static javax.swing.Action getCloseAction()
          Creates and returns an Action that exists the system if performed.
static com.jgoodies.validation.ValidationResult getErrorsResult()
          Lazily creates and returns an example ValidationResult that contains only errors.
static com.jgoodies.validation.ValidationResult getMixedResult()
          Lazily creates and returns an example ValidationResult that contains errors and warnings.
static com.jgoodies.validation.ValidationResult getWarningsResult()
          Lazily creates and returns an example ValidationResult that contains only warnings.
static void locateOnScreenCenter(java.awt.Component component)
          Locates the given component on the screen's center.
static void showValidationMessage(java.awt.Component parent, java.lang.String headerText, com.jgoodies.validation.ValidationResult validationResult)
           
static void showValidationMessage(java.util.EventObject e, java.lang.String headerText, com.jgoodies.validation.ValidationResult validationResult)
          Opens a message dialog that shows the validation result, things the user must fix, before the selection can change.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createDebugPropertyChangeListener

public static java.beans.PropertyChangeListener createDebugPropertyChangeListener()
Returns a listener that writes bean property changes to the console. The log entry includes the PropertyChangeEvent's source, property name, old value, and new value.

Returns:
a debug listener that logs bean changes to the console

getCloseAction

public static javax.swing.Action getCloseAction()
Creates and returns an Action that exists the system if performed.

Returns:
an Action that exists the system if performed
See Also:
System.exit(int)

getErrorsResult

public static com.jgoodies.validation.ValidationResult getErrorsResult()
Lazily creates and returns an example ValidationResult that contains only errors.

Returns:
a ValidationResult that contains only errors

getMixedResult

public static com.jgoodies.validation.ValidationResult getMixedResult()
Lazily creates and returns an example ValidationResult that contains errors and warnings.

Returns:
a ValidationResult that contains errors and warnings

getWarningsResult

public static com.jgoodies.validation.ValidationResult getWarningsResult()
Lazily creates and returns an example ValidationResult that contains only warnings.

Returns:
a ValidationResult that contains only warnings

locateOnScreenCenter

public static void locateOnScreenCenter(java.awt.Component component)
Locates the given component on the screen's center.

Parameters:
component - the component to be centered

showValidationMessage

public static void showValidationMessage(java.util.EventObject e,
                                         java.lang.String headerText,
                                         com.jgoodies.validation.ValidationResult validationResult)
Opens a message dialog that shows the validation result, things the user must fix, before the selection can change.

Parameters:
headerText - the text displayed above the validation message
validationResult - the validation result to be displayed
Throws:
java.lang.IllegalArgumentException - if the validation result is empty

showValidationMessage

public static void showValidationMessage(java.awt.Component parent,
                                         java.lang.String headerText,
                                         com.jgoodies.validation.ValidationResult validationResult)