Gregory
Gregory

Reputation: 433

JideFX validators don't work

Am newbie with javafx. Want create simple form with out-of-the-box validation. As library have chosen JideFX. Tried repeat showcase (which is poor for my taste) - http://www.jidesoft.com/jidefx/JideFX_Validation_Developer_Guide.pdf. Have StackOverflowError as result only. Validator is called. Haven’t exception if validation is OK.

Using javafx-8, Java 8, Eclipse Luna, JideFX 0.9.1 (tried 0.9.1-b128 too). Do you have any suggestions? Code is bellow.

SimpleValidator.java

public class SimpleValidator implements Validator {

    @Override
    public ValidationEvent call(ValidationObject param) {
        if (param.getNewValue() != null
                && !param.getNewValue().toString().isEmpty()) {
            return ValidationEvent.OK;
        } else {
            return new ValidationEvent(ValidationEvent.VALIDATION_ERROR, 1,
                    "Error");
        }
    }
}

LoginController.java

public class LoginController {

    private static final Logger LOGGER = LoggerFactory
            .getLogger(LoginController.class);

    @FXML
    private TextField idField;
    //...
    @FXML
    private void initialize() {
        ValidationUtils.install(idField, new SimpleValidator());
    }

    public LoginController() {
        super();
    }
//...
}

Upvotes: 2

Views: 878

Answers (3)

Denis Kokorin
Denis Kokorin

Reputation: 895

I have encountered the same bug. Seems like JideFX is dead.

Use ControlsFX validation instead.

Upvotes: 0

Breno Salgado
Breno Salgado

Reputation: 1962

I've looked a bit into it, apparently this happens when you pass a message to ValidationEvent

return new ValidationEvent(ValidationEvent.VALIDATION_OK); //no error
return new ValidationEvent(ValidationEvent.VALIDATION_OK, 9999); //no error
return new ValidationEvent(ValidationEvent.VALIDATION_OK, 9999, ValidationEvent.FailBehavior.IGNORE); //no error
return new ValidationEvent(ValidationEvent.VALIDATION_OK, 9999, "teste"); //error
return new ValidationEvent(ValidationEvent.VALIDATION_OK, 9999, "teste", "teste"); //error

return new ValidationEvent(ValidationEvent.VALIDATION_OK, 9999, ValidationEvent.FailBehavior.IGNORE, "teste");

This could be related to TooltipEx causes stackoverflow #22

So, if you can do without the validation message...

I'll update this if I find out more

Upvotes: 0

agonist_
agonist_

Reputation: 5032

you can try FXForm2 it provide you easy way to build cool form quickly. Also, you have a validation feature. Check for samples here

Upvotes: 2

Related Questions