Open daniel-sarov opened 3 years ago
What does this flag do in controlsfx? In the JavaDoc I haven't found a good description. What is the desired behavior?
With this flag there is a way to suppress error decorations, when the "validators" are registered in "validationSupport" in controlsfx with: validationSupport.setErrorDecorationEnabled(false). Later, when we actually want to validate (on submit button for example) we need to reset it to default value: validationSupport.setErrorDecorationEnabled(true). This way, fields still get validated by every change but error decorations are not shown until we actually want them to be shown.
https://github.com/controlsfx/controlsfx/issues/226 https://stackoverflow.com/questions/41603284/validate-javafx-form-only-after-submission-using-validationsupport
It would be nice after "ControlsFxVisualizer" initialization in View like this: ValidationVisualizer visualizer = new ControlsFxVisualizer(); visualizer.initVisualization(...); to use similar methods to the following where it is necessary : visualizer.hideErrorDecoration() , visualizer.showErrorDecoration() or like in controlsfx - setErrorDecorationEnabled(...)
This sounds good. We would need to:
ValidationVisualizer
interface: BooleanProperty decorationEnabledProperty()
, void setDecorationEnabled(boolean value)
and boolean isDecorationEnabled()
. Add default implementations for these methods to prevent this from being a breaking change. By default, isDecorationEnabled
has to return true
.BooleanProperty decorationEnabled = new SimpleBooleanProperty(true)
to ValidationVisualizerBase
(including overwrite the accessors from ValidationVisualizer
interface)ValidationVisualizerBase#initVisualization
so that it only invokes apply{Required}Visualization
if isDecorationEnabled()
is true
. This has to be the case both initially and in the listener on the messages listproperty of the result.Adjustments to the actual visualizer implementations like ControlsFXVisualization
shouldn't be needed as far as I can see.
However, I'm not sure if I will find the time to implement this in the near future. If you like, I'm happy to accept a PR for this feature.
Ok, when i have spare time , i will do it and send PR.
Are there any plans to include on demand validation, using ControlsFxVisualizer , like in controlsfx : validationSupport.setErrorDecorationEnabled(true or false)?