org.jtheque.core.utils.ui.constraints
Class ConstraintManager

java.lang.Object
  extended by org.jtheque.core.utils.ui.constraints.ConstraintManager

public final class ConstraintManager
extends java.lang.Object

A constraint manager.

Author:
Baptiste Wicht

Method Summary
static void addConstraint(java.lang.String fieldName, Constraint constraint)
          Add a constraint.
static void configure(javax.swing.JTextField field, java.lang.String fieldName)
          Configure a JTextField with the constraint.
static Constraint getConstraint(java.lang.String fieldName)
          Return the constraint for a specific field.
static void validate(java.lang.String fieldName, java.lang.Object field, java.util.Collection<JThequeError> errors)
          Validate the field with the constraint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addConstraint

public static void addConstraint(java.lang.String fieldName,
                                 Constraint constraint)
Add a constraint.

Parameters:
fieldName - The name of the field.
constraint - The constraint.

getConstraint

public static Constraint getConstraint(java.lang.String fieldName)
Return the constraint for a specific field.

Parameters:
fieldName - The name of the field to get the constraint for.
Returns:
The constraint for the field.

validate

public static void validate(java.lang.String fieldName,
                            java.lang.Object field,
                            java.util.Collection<JThequeError> errors)
Validate the field with the constraint.

Parameters:
fieldName - The name of the field.
field - The field.
errors - The errors list to fill.

configure

public static void configure(javax.swing.JTextField field,
                             java.lang.String fieldName)
Configure a JTextField with the constraint.

Parameters:
field - The field to configure.
fieldName - The name of the field.


Copyright © 2009 JTheque. All Rights Reserved.