Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
75 views
in Technique[技术] by (71.8m points)

java - JavaFX BooleanBinding Partially Working for Multiple Validation

I have a BooleanBinding in JavaFX whose logic is like:

if certificationType is not equal to noCertificationType 
then
   return true
else if (certificationType is equal to recordsVerificationCertificationType or landHoldingsCertificationType) and applicationPropertyObservableList is not empty 
then
   return true
else
   return false
end if

I wrote a method to express such validation as follows:

private BooleanBinding certificationTypeBooleanBinding() {
    return Bindings.createBooleanBinding(() ->
            !this.certificationType.getValue().equals(Applications.noCertificationType()) || (
                    (this.certificationType.getValue().equals(Applications.recordsVerificationCertificationType()) ||
                            this.certificationType.getValue().equals(Applications.landHoldingsCertificationType())
                    ) && !this.applicationPropertyObservableList.getValue().isEmpty()
            ), this.certificationType, this.applicationPropertyObservableList);
}

Only !this.certificationType.getValue().equals(Applications.noCertificationType()) works. The or (|| ()) part does not.

How do I make it work? Thank you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...