mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 13:38:23 +02:00
the most senseless combination of rules are not possible any more
This commit is contained in:
@@ -28,6 +28,8 @@ package ninja.javafx.smartcsv.fx.validation;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import ninja.javafx.smartcsv.fx.FXMLController;
|
||||
@@ -181,11 +183,30 @@ public class ValidationEditorController extends FXMLController {
|
||||
initTextInputControl(valueOfRuleTextField, enableValueOfRule);
|
||||
initCodeAreaControl(groovyRuleTextArea, enableGroovyRule);
|
||||
|
||||
listenToExcludingRuleCombinations();
|
||||
|
||||
selectedColumn.addListener(observable -> {
|
||||
updateForm();
|
||||
});
|
||||
}
|
||||
|
||||
private void listenToExcludingRuleCombinations() {
|
||||
addDependencyListener(enableIntegerRule, enableDoubleRule, enableAlphanumericRule, enableDateRule);
|
||||
addDependencyListener(enableDoubleRule, enableIntegerRule, enableAlphanumericRule, enableDateRule);
|
||||
addDependencyListener(enableAlphanumericRule, enableIntegerRule, enableDoubleRule, enableDateRule);
|
||||
addDependencyListener(enableDateRule, enableIntegerRule, enableDoubleRule, enableAlphanumericRule);
|
||||
}
|
||||
|
||||
private void addDependencyListener(CheckBox rule, CheckBox... dependentRules) {
|
||||
rule.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) {
|
||||
for (CheckBox dependentRule: dependentRules) {
|
||||
dependentRule.selectedProperty().setValue(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String getSelectedColumn() {
|
||||
return selectedColumn.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user