- java.lang.Object
-
- org.controlsfx.validation.ValidationResult
-
public class ValidationResult extends Object
Validation result. Can generally be thought of a collection of validation messages. Allows for quick an painless accumulation of the messages. Also provides ability to combine validation results
-
-
Constructor Summary
Constructors Constructor Description ValidationResult()
Creates empty validation result
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ValidationResult
add(ValidationMessage message)
Add one message to validation result.ValidationResult
addAll(Collection<? extends ValidationMessage> messages)
Add collection of validation messages.ValidationResult
addAll(ValidationMessage... messages)
Add several validation messages.ValidationResult
addErrorIf(Control target, String text, boolean condition)
Add one error to validation result with conditionValidationResult
addInfoIf(Control target, String text, boolean condition)
Add one info to validation result with conditionValidationResult
addMessageIf(Control target, String text, Severity severity, boolean condition)
Add one message to validation result with condition.ValidationResult
addWarningIf(Control target, String text, boolean condition)
Add one warning to validation result with conditionValidationResult
combine(ValidationResult validationResult)
Combine validation result with another.ValidationResult
combineAll(Collection<ValidationResult> validationResults)
Combine validation result with others.ValidationResult
combineAll(ValidationResult... validationResults)
Combine validation result with others.ValidationResult
copy()
Creates a copy of validation resultstatic ValidationResult
fromError(Control target, String text)
Factory method to create validation result out of one errorstatic ValidationResult
fromErrorIf(Control target, String text, boolean condition)
Factory method to create validation result out of one errorstatic ValidationResult
fromInfo(Control target, String text)
Factory method to create validation result out of one infostatic ValidationResult
fromInfoIf(Control target, String text, boolean condition)
Factory method to create validation result out of one infostatic ValidationResult
fromMessageIf(Control target, String text, Severity severity, boolean condition)
Factory method to create validation result out of one message.static ValidationResult
fromMessages(Collection<? extends ValidationMessage> messages)
Factory method to create validation result out of collection of messagesstatic ValidationResult
fromMessages(ValidationMessage... messages)
Factory method to create validation result out of several messagesstatic ValidationResult
fromResults(Collection<ValidationResult> results)
Factory method to create validation result out of collection of validation resultsstatic ValidationResult
fromResults(ValidationResult... results)
Factory method to create validation result out of several validation resultsstatic ValidationResult
fromWarning(Control target, String text)
Factory method to create validation result out of one warningstatic ValidationResult
fromWarningIf(Control target, String text, boolean condition)
Factory method to create validation result out of one warningCollection<ValidationMessage>
getErrors()
Retrieve errors represented by validation resultCollection<ValidationMessage>
getInfos()
Retrieve infos represented by validation resultCollection<ValidationMessage>
getMessages()
Retrieve all messages represented by validation resultCollection<ValidationMessage>
getWarnings()
Retrieve warnings represented by validation result
-
-
-
Method Detail
-
fromMessageIf
public static final ValidationResult fromMessageIf(Control target, String text, Severity severity, boolean condition)
Factory method to create validation result out of one message. Messages withSeverity.OK
will be ignored.- Parameters:
target
- validation targettext
- message textseverity
- message severitycondition
- condition on which message will be added to validation result- Returns:
- New instance of validation result
-
fromErrorIf
public static final ValidationResult fromErrorIf(Control target, String text, boolean condition)
Factory method to create validation result out of one error- Parameters:
target
- validation targettext
- message textcondition
- condition on which message will be added to validation result- Returns:
- New instance of validation result
-
fromWarningIf
public static final ValidationResult fromWarningIf(Control target, String text, boolean condition)
Factory method to create validation result out of one warning- Parameters:
target
- validation targettext
- message textcondition
- condition on which message will be added to validation result- Returns:
- New instance of validation result
-
fromInfoIf
public static final ValidationResult fromInfoIf(Control target, String text, boolean condition)
Factory method to create validation result out of one info- Parameters:
target
- validation targettext
- message textcondition
- condition on which message will be added to validation result- Returns:
- New instance of validation result
-
fromError
public static final ValidationResult fromError(Control target, String text)
Factory method to create validation result out of one error- Parameters:
target
- validation targettext
- message text- Returns:
- New instance of validation result
-
fromWarning
public static final ValidationResult fromWarning(Control target, String text)
Factory method to create validation result out of one warning- Parameters:
target
- validation targettext
- message text- Returns:
- New instance of validation result
-
fromInfo
public static final ValidationResult fromInfo(Control target, String text)
Factory method to create validation result out of one info- Parameters:
target
- validation targettext
- message text- Returns:
- New instance of validation result
-
fromMessages
public static final ValidationResult fromMessages(ValidationMessage... messages)
Factory method to create validation result out of several messages- Parameters:
messages
-- Returns:
- New instance of validation result
-
fromMessages
public static final ValidationResult fromMessages(Collection<? extends ValidationMessage> messages)
Factory method to create validation result out of collection of messages- Parameters:
messages
-- Returns:
- New instance of validation result
-
fromResults
public static final ValidationResult fromResults(ValidationResult... results)
Factory method to create validation result out of several validation results- Parameters:
results
- results- Returns:
- New instance of validation result, combining all into one
-
fromResults
public static final ValidationResult fromResults(Collection<ValidationResult> results)
Factory method to create validation result out of collection of validation results- Parameters:
results
- results- Returns:
- New instance of validation result, combining all into one
-
copy
public ValidationResult copy()
Creates a copy of validation result- Returns:
- copy of validation result
-
add
public ValidationResult add(ValidationMessage message)
Add one message to validation result. Messages withSeverity.OK
will be ignored.- Parameters:
message
- validation message- Returns:
- updated validation result
-
addMessageIf
public ValidationResult addMessageIf(Control target, String text, Severity severity, boolean condition)
Add one message to validation result with condition. Messages withSeverity.OK
will be ignored.- Parameters:
target
- validation targettext
- message textseverity
- message severitycondition
- condition on which message will be added- Returns:
- updated validation result
-
addErrorIf
public ValidationResult addErrorIf(Control target, String text, boolean condition)
Add one error to validation result with condition- Parameters:
target
- validation targettext
- message textcondition
- condition on which error will be added- Returns:
- updated validation result
-
addWarningIf
public ValidationResult addWarningIf(Control target, String text, boolean condition)
Add one warning to validation result with condition- Parameters:
target
- validation targettext
- message textcondition
- condition on which warning will be added- Returns:
- updated validation result
-
addInfoIf
public ValidationResult addInfoIf(Control target, String text, boolean condition)
Add one info to validation result with condition- Parameters:
target
- validation targettext
- message textcondition
- condition on which info will be added- Returns:
- updated validation result
-
addAll
public ValidationResult addAll(Collection<? extends ValidationMessage> messages)
Add collection of validation messages. Messages withSeverity.OK
will be ignored.- Parameters:
messages
-- Returns:
- updated validation result
-
addAll
public ValidationResult addAll(ValidationMessage... messages)
Add several validation messages. Messages withSeverity.OK
will be ignored.- Parameters:
messages
-- Returns:
- updated validation result
-
combine
public ValidationResult combine(ValidationResult validationResult)
Combine validation result with another. This will create a new instance of combined validation result- Parameters:
validationResult
-- Returns:
- new instance of combined validation result
-
combineAll
public ValidationResult combineAll(Collection<ValidationResult> validationResults)
Combine validation result with others. This will create a new instance of combined validation result- Parameters:
validationResults
-- Returns:
- new instance of combined validation result
-
combineAll
public ValidationResult combineAll(ValidationResult... validationResults)
Combine validation result with others. This will create a new instance of combined validation result- Parameters:
validationResults
-- Returns:
- new instance of combined validation result
-
getErrors
public Collection<ValidationMessage> getErrors()
Retrieve errors represented by validation result- Returns:
- an unmodifiable collection of errors
-
getWarnings
public Collection<ValidationMessage> getWarnings()
Retrieve warnings represented by validation result- Returns:
- an unmodifiable collection of warnings
-
getInfos
public Collection<ValidationMessage> getInfos()
Retrieve infos represented by validation result- Returns:
- an unmodifiable collection of infos
-
getMessages
public Collection<ValidationMessage> getMessages()
Retrieve all messages represented by validation result- Returns:
- an unmodifiable collection of messages
-
-