public class ClientValidationUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ClientValidationUtils.ValidationMessageKeys |
Modifier and Type | Field and Description |
---|---|
static String |
ALL_MSG_KEY |
static String |
AND_MSG_KEY |
static String |
ATMOST_MSG_KEY |
static String |
GENERIC_FIELD_MSG_KEY |
static String |
LABEL_KEY_SPLIT_PATTERN |
static String |
MUSTOCCURS_MSG_EQUAL_KEY |
static String |
MUSTOCCURS_MSG_KEY |
static String |
OR_MSG_KEY |
static String |
POSTREQ_MSG_KEY |
static String |
PREREQ_MSG_KEY |
Constructor and Description |
---|
ClientValidationUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addScriptToPage(View view,
InputField field,
String script)
Adds the script to the view to execute on a jQuery document ready event.
|
static String |
generateMessageText(String namespace,
String componentCode,
String messageKey,
List<String> params)
Returns formatted message text for the given message namespace, component, and key
|
static String |
generateValidatorMessagesOption()
Generates the js object used to override all default messages for validator jquery plugin
with custom messages retrieved from the message service
|
static String |
getRegexMethod(InputField field,
ValidCharactersConstraint validCharactersConstraint)
Returns the add method jquery validator call for the regular expression stored in
validCharactersConstraint.
|
static String |
getRegexMethodWithBooleanCheck(InputField field,
ValidCharactersConstraint validCharactersConstraint)
Returns the add method jquery validator call for the regular expression stored in
validCharactersConstraint that explicitly checks a boolean.
|
static void |
processAndApplyConstraints(InputField field,
View view,
Object model)
This method processes all the constraints on the InputField passed in and adds all the
necessary jQuery and js required (validator's rules, methods, and messages) to the View's
onDocumentReady call.
|
static void |
processCaseConstraint(InputField field,
View view,
CaseConstraint constraint,
String andedCase,
String validationState,
StateMapping stateMapping)
This method processes a single CaseConstraint.
|
static void |
processMustOccurConstraint(InputField field,
View view,
MustOccurConstraint mc,
String booleanStatement)
This method processes the MustOccurConstraint.
|
static void |
processPrerequisiteConstraint(InputField field,
PrerequisiteConstraint constraint,
View view)
Simpler version of processPrerequisiteConstraint
|
static void |
processPrerequisiteConstraint(InputField field,
PrerequisiteConstraint constraint,
View view,
String booleanStatement)
Processes a Prerequisite constraint that should be applied when the booleanStatement passed
in evaluates to true.
|
public static final String LABEL_KEY_SPLIT_PATTERN
public static final String PREREQ_MSG_KEY
public static final String POSTREQ_MSG_KEY
public static final String MUSTOCCURS_MSG_KEY
public static final String MUSTOCCURS_MSG_EQUAL_KEY
public static final String GENERIC_FIELD_MSG_KEY
public static final String ALL_MSG_KEY
public static final String ATMOST_MSG_KEY
public static final String AND_MSG_KEY
public static final String OR_MSG_KEY
public ClientValidationUtils()
public static String generateMessageText(String namespace, String componentCode, String messageKey, List<String> params)
namespace
- namespace code the message is associated with, if null the default namespace
will be usedcomponentCode
- component code the message is associated with, if null default component
code is usedmessageKey
- key for the message to retrieveparams
- list of parameters for the message textpublic static String generateValidatorMessagesOption()
public static String getRegexMethod(InputField field, ValidCharactersConstraint validCharactersConstraint)
field
- input fieldvalidCharactersConstraint
- constraint providing the regexpublic static String getRegexMethodWithBooleanCheck(InputField field, ValidCharactersConstraint validCharactersConstraint)
field
- input fieldvalidCharactersConstraint
- constraint providing the regexpublic static void processCaseConstraint(InputField field, View view, CaseConstraint constraint, String andedCase, String validationState, StateMapping stateMapping)
field
- input fieldview
- active viewconstraint
- case constraint providing the field referenceandedCase
- the boolean logic to be anded when determining if this case is satisfied
(used for nested CaseConstraints)validationState
- validation statestateMapping
- state mappingpublic static void addScriptToPage(View view, InputField field, String script)
view
- active viewfield
- input fieldscript
- script to run on the document ready eventpublic static void processPrerequisiteConstraint(InputField field, PrerequisiteConstraint constraint, View view)
field
- input fieldconstraint
- prerequisite constraint to processview
- active viewprocessPrerequisiteConstraint(org.kuali.rice.krad.uif.field.InputField,
PrerequisiteConstraint, View, String)
public static void processPrerequisiteConstraint(InputField field, PrerequisiteConstraint constraint, View view, String booleanStatement)
field
- input fieldconstraint
- prerequisite constraint to processview
- active viewbooleanStatement
- the booleanstatement in js - should return true when the validation
rule should be appliedpublic static void processMustOccurConstraint(InputField field, View view, MustOccurConstraint mc, String booleanStatement)
field
- input fieldview
- active viewmc
- must occur constraint to processbooleanStatement
- the booleanstatement in js - should return true when the validation
rule should be appliedpublic static void processAndApplyConstraints(InputField field, View view, Object model)
field
- input fieldview
- active viewmodel
- active modelCopyright © 2005–2014 The Kuali Foundation. All rights reserved.