controlsfx / controlsfx/controlsfx

Initial StyleClassValidationDecoration and CompoundValidationDecoration are not applied

Open
#894 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
1.7k
Forks
300
Avg merge
16d 17h
Merged PRs (30d)
1

Description

**[Original report](https://bitbucket.org/controlsfx/controlsfx/issue/703) by Vitaly Romashkin (Bitbucket: [rvit34](https://bitbucket.org/rvit34), GitHub: [rvit34](https://github.com/rvit34)).**

----------------------------------------

Look at a simple code sample below:

*sample.fxml*

```
#!fxml




```
*Main.java*

```
#!java

package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application {

@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("init CCS Validation Decoration bug");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}

public static void main(String[] args) {
launch(args);
}
}
```
*Controller.java*

```
#!java

package sample;

import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import org.controlsfx.validation.ValidationSupport;
import org.controlsfx.validation.Validator;
import org.controlsfx.validation.decoration.StyleClassValidationDecoration;

public class Controller {

@FXML
private TextField txtValidationField;

public void initialize(){
ValidationSupport validationSupport = new ValidationSupport();
validationSupport.setValidationDecorator(new StyleClassValidationDecoration());
validationSupport.registerValidator(txtValidationField,true, Validator.createEmptyValidator("field is empty"));
validationSupport.initInitialDecoration(); // initial decoration is on
}

}
```
I will see the same issue if I use *CompoundValidationDecoration* but
there is not such problem with default *GraphicValidationDecoration*

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.