public class ValidationResult
extends java.lang.Object
Validator.validating(ValidationObject)
. There are three
things on the result. FAIL_BEHAVIOR_REVERT
, which means JideTable will not accept the new input and just revert the
value in the cell to the old value and stop cell editing as normal.Modifier and Type | Field and Description |
---|---|
static int |
FAIL_BEHAVIOR_PERSIST
When validation fails, do not stop cell editing until user enters a valid value or press ESCAPE to cancel the
editing.
|
static int |
FAIL_BEHAVIOR_RESET
When validation fails, reset the value to null.
|
static int |
FAIL_BEHAVIOR_REVERT
When validation fails, reverts back to the previous valid value and stop cell editting as normal.
|
static ValidationResult |
OK
The shared ValidationResult when the validation result is valid.
|
Constructor and Description |
---|
ValidationResult()
Creates an empty ValidationResult.
|
ValidationResult(boolean valid)
Creates an empty ValidationResult.
|
ValidationResult(int id)
Creates an invalid ValidationResult with an id and no message.
|
ValidationResult(int id,
boolean valid,
int failBehavoir)
Creates an ValidationResult with an id and an error behavior.
|
ValidationResult(int id,
boolean valid,
int failBehavoir,
java.lang.String message)
Creates an ValidationResult with an id, a message and an error behavior.
|
ValidationResult(int id,
boolean valid,
java.lang.String message)
Creates an ValidationResult with an id and a message.
|
ValidationResult(int id,
java.lang.String message)
Creates an invalid ValidationResult with an id and a message.
|
Modifier and Type | Method and Description |
---|---|
int |
getFailBehavior()
Gets the behavior if validation fails.
|
int |
getId()
Gets the id of the ValidationResult.
|
java.lang.String |
getMessage()
Gets the message associated with the ValidationResult.
|
boolean |
isValid()
Checks if the validation state is valid.
|
void |
setFailBehavior(int failBehavior)
Sets the behavior if validation fails.
|
void |
setId(int id)
Sets the id of the ValidationResult.
|
void |
setMessage(java.lang.String message)
Sets the message associated with the ValidationResult.
|
void |
setValid(boolean valid)
Sets the validation state.
|
java.lang.String |
toString() |
public static final int FAIL_BEHAVIOR_REVERT
public static final int FAIL_BEHAVIOR_PERSIST
public static final int FAIL_BEHAVIOR_RESET
public static final ValidationResult OK
public ValidationResult()
public ValidationResult(int id)
id
- the result id. You can create the id by your definitionpublic ValidationResult(boolean valid)
valid
- a boolean value to indicate if the value input is validpublic ValidationResult(int id, java.lang.String message)
id
- the result id. You can create the id by your definitionmessage
- the message you want to display to the customerpublic ValidationResult(int id, boolean valid, java.lang.String message)
id
- the result id. You can create the id by your definitionvalid
- a boolean value to indicate if the value input is validmessage
- the message you want to display to the customerpublic ValidationResult(int id, boolean valid, int failBehavoir)
id
- the result id. You can create the id by your definitionvalid
- a boolean value to indicate if the value input is validfailBehavoir
- the behaviorpublic ValidationResult(int id, boolean valid, int failBehavoir, java.lang.String message)
id
- the result id. You can create the id by your definitionvalid
- a boolean value to indicate if the value input is validfailBehavoir
- the behaviormessage
- the message you want to display to the customerpublic int getId()
public void setId(int id)
id
- the result id. You can create the id by your definitionpublic boolean isValid()
public void setValid(boolean valid)
valid
- a boolean value to indicate if the value input is validpublic java.lang.String getMessage()
public void setMessage(java.lang.String message)
message
- the new message.public int getFailBehavior()
public void setFailBehavior(int failBehavior)
FAIL_BEHAVIOR_PERSIST
, FAIL_BEHAVIOR_REVERT
, and FAIL_BEHAVIOR_RESET
.
If you used a constructor without this parameter, the default value for behavior is FAIL_BEHAVIOR_REVERT
, which means JideTable will not accept the new input and just revert the
value in the cell to the old value and stop cell editing as normal.failBehavior
- the behaviorpublic java.lang.String toString()
toString
in class java.lang.Object