Top Description Inners Fields Constructors Methods
net.synedra.validatorfx

public Class Check

extends Object
Class Inheritance
Imports
java.util.ArrayList, .HashMap, .List, .Map, java.util.function.Consumer, .Function, javafx.application.Platform, javafx.beans.property.ReadOnlyObjectProperty, .ReadOnlyObjectWrapper, javafx.beans.value.ChangeListener, .ObservableValue, .WeakChangeListener, javafx.scene.Node

A check represents a check for validity in a form.
Author
[email protected]

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class

Field Summary

Modifier and TypeField and Description
private List<Consumer<Check.Context>>
private Function<ValidationMessage, Decoration>
private List<Decoration>
private Map<String, ObservableValue<? extends Object>>
private ChangeListener<? super Object>
private ChangeListener<? super Object>
private ChangeListener<? super Object>
private ChangeListener<? super Object>
private ValidationResult
private List<Node>
private ReadOnlyObjectWrapper<ValidationResult>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Clear this check, i.e. remove its decorations and set empty validation result.

public Check
decorates(Node target)

public Check
public Check
dependsOn(String key, ObservableValue<? extends Object> dependency)

public Check
explicit()

Sets this check to not be reevaluated automatically (i.e. recheck must be called explicetly).

public ValidationResult

Returns:

validation result
getValidationResult
()

Retrieves current validation result

public Check
immediate()

Sets this check to be immediately evaluated if one of its dependencies changes.

public Check
immediateClear()

Sets this check to be immediately cleared (but not rechecked) if one of its dependencies changes.

public void
recheck()

Evaluate all dependencies and apply decorations of this check.

private void
private void
private void
private void
public ReadOnlyObjectProperty<ValidationResult>

Returns:

The Validation result property.
validationResultProperty
()

Can be used to track validation result changes

public Check
withMethod(Consumer<Check.Context>
The code to be called in order to check the validity of this Check.
checkMethod
)

Add a method to be called in order to perform this check.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

checkMethodsback to summary
private List<Consumer<Check.Context>> checkMethods
decorationFactoryback to summary
private Function<ValidationMessage, Decoration> decorationFactory
decorationsback to summary
private List<Decoration> decorations
dependenciesback to summary
private Map<String, ObservableValue<? extends Object>> dependencies
immediateClearListenerback to summary
private ChangeListener<? super Object> immediateClearListener
immediateClearWeakListenerback to summary
private ChangeListener<? super Object> immediateClearWeakListener
immediateListenerback to summary
private ChangeListener<? super Object> immediateListener
immediateWeakListenerback to summary
private ChangeListener<? super Object> immediateWeakListener
nextValidationResultback to summary
private ValidationResult nextValidationResult
targetsback to summary
private List<Node> targets
validationResultPropertyback to summary
private ReadOnlyObjectWrapper<ValidationResult> validationResultProperty

Constructor Detail

Checkback to summary
public Check()

Method Detail

clearback to summary
public void clear()

Clear this check, i.e. remove its decorations and set empty validation result.

decoratesback to summary
public Check decorates(Node target)
decoratingWithback to summary
public Check decoratingWith(Function<ValidationMessage, Decoration> decorationFactory)
dependsOnback to summary
public Check dependsOn(String key, ObservableValue<? extends Object> dependency)
explicitback to summary
public Check explicit()

Sets this check to not be reevaluated automatically (i.e. recheck must be called explicetly). This mode is the default. This method must be called after setting dependencies.

getValidationResultback to summary
public ValidationResult getValidationResult()

Retrieves current validation result

Returns:ValidationResult

validation result

immediateback to summary
public Check immediate()

Sets this check to be immediately evaluated if one of its dependencies changes. This method must be called after setting dependencies.

immediateClearback to summary
public Check immediateClear()

Sets this check to be immediately cleared (but not rechecked) if one of its dependencies changes. This method must be called after setting dependencies.

recheckback to summary
public void recheck()

Evaluate all dependencies and apply decorations of this check. You should not normally need to call this method directly.

removeAllListenersback to summary
private void removeAllListeners()
removeDecorationsback to summary
private void removeDecorations()
removeListenerback to summary
private void removeListener(ChangeListener<? super Object> listener)
setNextValidationResultback to summary
private void setNextValidationResult()
validationResultPropertyback to summary
public ReadOnlyObjectProperty<ValidationResult> validationResultProperty()

Can be used to track validation result changes

Returns:ReadOnlyObjectProperty<ValidationResult>

The Validation result property.

withMethodback to summary
public Check withMethod(Consumer<Check.Context> checkMethod)

Add a method to be called in order to perform this check. If called multiple times, multiple check methods can be registered.

Parameters
checkMethod:Consumer<Check.Context>

The code to be called in order to check the validity of this Check.

net.synedra.validatorfx back to summary

public Class Check.Context

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
error(String
The text to be presented to the user as error message.
message
)

Emit an error.

public <
The type the value should be casted into
T
>
T

Returns:

The current value of the given depency
get
(String
The key the dependency has been given
key
)

Get the current value of a dependency.

public Iterable<String>
keys()

public void
warn(String
The text to be presented to the user as warning message.
message
)

Emit a warning.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Contextback to summary
private Context()

Method Detail

errorback to summary
public void error(String message)

Emit an error.

Parameters
message:String

The text to be presented to the user as error message.

getback to summary
public <T> T get(String key)

Get the current value of a dependency.

Parameters
<T>
The type the value should be casted into
key:String

The key the dependency has been given

Returns:T

The current value of the given depency

Annotations
@SuppressWarnings:unchecked
keysback to summary
public Iterable<String> keys()
warnback to summary
public void warn(String message)

Emit a warning.

Parameters
message:String

The text to be presented to the user as warning message.