mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 13:38:23 +02:00
no need for 2 checkboxes when it is a boolean rule
This commit is contained in:
@@ -95,20 +95,20 @@ public class ValidationEditorController extends FXMLController {
|
|||||||
+ "|(?<COMMENT>" + COMMENT_PATTERN + ")"
|
+ "|(?<COMMENT>" + COMMENT_PATTERN + ")"
|
||||||
);
|
);
|
||||||
|
|
||||||
@FXML
|
// @FXML
|
||||||
private CheckBox notEmptyRuleCheckBox;
|
// private CheckBox notEmptyRuleCheckBox;
|
||||||
|
//
|
||||||
@FXML
|
// @FXML
|
||||||
private CheckBox integerRuleCheckBox;
|
// private CheckBox integerRuleCheckBox;
|
||||||
|
//
|
||||||
@FXML
|
// @FXML
|
||||||
private CheckBox doublerRuleCheckBox;
|
// private CheckBox doublerRuleCheckBox;
|
||||||
|
//
|
||||||
@FXML
|
// @FXML
|
||||||
private CheckBox alphanumericRuleCheckBox;
|
// private CheckBox alphanumericRuleCheckBox;
|
||||||
|
//
|
||||||
@FXML
|
// @FXML
|
||||||
private CheckBox uniqueRuleCheckBox;
|
// private CheckBox uniqueRuleCheckBox;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Spinner<Integer> minLengthSpinner;
|
private Spinner<Integer> minLengthSpinner;
|
||||||
@@ -174,11 +174,6 @@ public class ValidationEditorController extends FXMLController {
|
|||||||
minLengthSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, Integer.MAX_VALUE, 0));
|
minLengthSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, Integer.MAX_VALUE, 0));
|
||||||
maxLengthSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, Integer.MAX_VALUE, 0));
|
maxLengthSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, Integer.MAX_VALUE, 0));
|
||||||
|
|
||||||
initCheckBox(notEmptyRuleCheckBox, enableNotEmptyRule);
|
|
||||||
initCheckBox(integerRuleCheckBox, enableIntegerRule);
|
|
||||||
initCheckBox(doublerRuleCheckBox, enableDoubleRule);
|
|
||||||
initCheckBox(alphanumericRuleCheckBox, enableAlphanumericRule);
|
|
||||||
initCheckBox(uniqueRuleCheckBox, enableUniqueRule);
|
|
||||||
initSpinner(minLengthSpinner, enableMinLengthRule);
|
initSpinner(minLengthSpinner, enableMinLengthRule);
|
||||||
initSpinner(maxLengthSpinner, enableMaxLengthRule);
|
initSpinner(maxLengthSpinner, enableMaxLengthRule);
|
||||||
initTextInputControl(dateformatRuleTextField, enableDateRule);
|
initTextInputControl(dateformatRuleTextField, enableDateRule);
|
||||||
@@ -210,31 +205,31 @@ public class ValidationEditorController extends FXMLController {
|
|||||||
public void updateConfiguration() {
|
public void updateConfiguration() {
|
||||||
|
|
||||||
if (enableIntegerRule.isSelected()) {
|
if (enableIntegerRule.isSelected()) {
|
||||||
validationConfiguration.setIntegerRuleFor(selectedColumn.getValue(), integerRuleCheckBox.isSelected());
|
validationConfiguration.setIntegerRuleFor(selectedColumn.getValue(), enableIntegerRule.isSelected());
|
||||||
} else {
|
} else {
|
||||||
validationConfiguration.setIntegerRuleFor(selectedColumn.getValue(), null);
|
validationConfiguration.setIntegerRuleFor(selectedColumn.getValue(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableNotEmptyRule.isSelected()) {
|
if (enableNotEmptyRule.isSelected()) {
|
||||||
validationConfiguration.setNotEmptyRuleFor(selectedColumn.getValue(), notEmptyRuleCheckBox.isSelected());
|
validationConfiguration.setNotEmptyRuleFor(selectedColumn.getValue(), enableNotEmptyRule.isSelected());
|
||||||
} else {
|
} else {
|
||||||
validationConfiguration.setNotEmptyRuleFor(selectedColumn.getValue(), null);
|
validationConfiguration.setNotEmptyRuleFor(selectedColumn.getValue(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableUniqueRule.isSelected()) {
|
if (enableUniqueRule.isSelected()) {
|
||||||
validationConfiguration.setUniqueRuleFor(selectedColumn.getValue(), uniqueRuleCheckBox.isSelected());
|
validationConfiguration.setUniqueRuleFor(selectedColumn.getValue(), enableUniqueRule.isSelected());
|
||||||
} else {
|
} else {
|
||||||
validationConfiguration.setUniqueRuleFor(selectedColumn.getValue(), null);
|
validationConfiguration.setUniqueRuleFor(selectedColumn.getValue(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableDoubleRule.isSelected()) {
|
if (enableDoubleRule.isSelected()) {
|
||||||
validationConfiguration.setDoubleRuleFor(selectedColumn.getValue(), doublerRuleCheckBox.isSelected());
|
validationConfiguration.setDoubleRuleFor(selectedColumn.getValue(), enableDoubleRule.isSelected());
|
||||||
} else {
|
} else {
|
||||||
validationConfiguration.setDoubleRuleFor(selectedColumn.getValue(), null);
|
validationConfiguration.setDoubleRuleFor(selectedColumn.getValue(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableAlphanumericRule.isSelected()) {
|
if (enableAlphanumericRule.isSelected()) {
|
||||||
validationConfiguration.setAlphanumericRuleFor(selectedColumn.getValue(), alphanumericRuleCheckBox.isSelected());
|
validationConfiguration.setAlphanumericRuleFor(selectedColumn.getValue(), enableAlphanumericRule.isSelected());
|
||||||
} else {
|
} else {
|
||||||
validationConfiguration.setAlphanumericRuleFor(selectedColumn.getValue(), null);
|
validationConfiguration.setAlphanumericRuleFor(selectedColumn.getValue(), null);
|
||||||
}
|
}
|
||||||
@@ -281,31 +276,26 @@ public class ValidationEditorController extends FXMLController {
|
|||||||
private void updateForm() {
|
private void updateForm() {
|
||||||
|
|
||||||
updateCheckBox(
|
updateCheckBox(
|
||||||
notEmptyRuleCheckBox,
|
|
||||||
validationConfiguration.getNotEmptyRuleFor(getSelectedColumn()),
|
validationConfiguration.getNotEmptyRuleFor(getSelectedColumn()),
|
||||||
enableNotEmptyRule
|
enableNotEmptyRule
|
||||||
);
|
);
|
||||||
|
|
||||||
updateCheckBox(
|
updateCheckBox(
|
||||||
integerRuleCheckBox,
|
|
||||||
validationConfiguration.getIntegerRuleFor(getSelectedColumn()),
|
validationConfiguration.getIntegerRuleFor(getSelectedColumn()),
|
||||||
enableIntegerRule
|
enableIntegerRule
|
||||||
);
|
);
|
||||||
|
|
||||||
updateCheckBox(
|
updateCheckBox(
|
||||||
doublerRuleCheckBox,
|
|
||||||
validationConfiguration.getDoubleRuleFor(getSelectedColumn()),
|
validationConfiguration.getDoubleRuleFor(getSelectedColumn()),
|
||||||
enableDoubleRule
|
enableDoubleRule
|
||||||
);
|
);
|
||||||
|
|
||||||
updateCheckBox(
|
updateCheckBox(
|
||||||
alphanumericRuleCheckBox,
|
|
||||||
validationConfiguration.getAlphanumericRuleFor(getSelectedColumn()),
|
validationConfiguration.getAlphanumericRuleFor(getSelectedColumn()),
|
||||||
enableAlphanumericRule
|
enableAlphanumericRule
|
||||||
);
|
);
|
||||||
|
|
||||||
updateCheckBox(
|
updateCheckBox(
|
||||||
uniqueRuleCheckBox,
|
|
||||||
validationConfiguration.getUniqueRuleFor(getSelectedColumn()),
|
validationConfiguration.getUniqueRuleFor(getSelectedColumn()),
|
||||||
enableUniqueRule
|
enableUniqueRule
|
||||||
);
|
);
|
||||||
@@ -347,12 +337,11 @@ public class ValidationEditorController extends FXMLController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCheckBox(CheckBox rule, Boolean value, CheckBox ruleEnabled) {
|
private void updateCheckBox(Boolean value, CheckBox ruleEnabled) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
ruleEnabled.setSelected(false);
|
ruleEnabled.setSelected(false);
|
||||||
} else {
|
} else {
|
||||||
rule.setSelected(value);
|
ruleEnabled.setSelected(value);
|
||||||
ruleEnabled.setSelected(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,15 +381,6 @@ public class ValidationEditorController extends FXMLController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCheckBox(CheckBox rule, CheckBox ruleEnabled) {
|
|
||||||
rule.disableProperty().bind(ruleEnabled.selectedProperty().not());
|
|
||||||
ruleEnabled.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
if (!newValue) {
|
|
||||||
rule.setSelected(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initSpinner(Spinner rule, CheckBox ruleEnabled) {
|
private void initSpinner(Spinner rule, CheckBox ruleEnabled) {
|
||||||
rule.disableProperty().bind(ruleEnabled.selectedProperty().not());
|
rule.disableProperty().bind(ruleEnabled.selectedProperty().not());
|
||||||
ruleEnabled.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
ruleEnabled.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
|||||||
@@ -60,20 +60,20 @@ validation.message.header.length = number of headers is not correct! there are {
|
|||||||
validation.message.header.match = header number {0} does not match "{1}" should be "{2}"
|
validation.message.header.match = header number {0} does not match "{1}" should be "{2}"
|
||||||
validation.message.value.of = Value {0} is not part of this list {1}
|
validation.message.value.of = Value {0} is not part of this list {1}
|
||||||
|
|
||||||
validation.rule.label.not_empty = not empty:
|
validation.rule.label.not_empty = not empty
|
||||||
validation.rule.label.integer = integer:
|
validation.rule.label.integer = integer
|
||||||
validation.rule.label.double = double:
|
validation.rule.label.double = double
|
||||||
validation.rule.label.minlength = minimum length:
|
validation.rule.label.minlength = minimum length:
|
||||||
validation.rule.label.maxlength = maximum length:
|
validation.rule.label.maxlength = maximum length:
|
||||||
validation.rule.label.dateformat = date format:
|
validation.rule.label.dateformat = date format:
|
||||||
validation.rule.label.alphanumeric = alphanumeric:
|
validation.rule.label.alphanumeric = alphanumeric
|
||||||
validation.rule.label.regexp = regular expression:
|
validation.rule.label.regexp = regular expression:
|
||||||
validation.rule.label.value_of = value in list:
|
validation.rule.label.value_of = value in list:
|
||||||
validation.rule.label.groovy = groovy:
|
validation.rule.label.groovy = groovy:
|
||||||
validation.rules.active = active
|
validation.rules.active = active
|
||||||
validation.rules.name = rule
|
validation.rules.name = rule
|
||||||
validation.rules.value = value
|
validation.rules.value = value
|
||||||
validation.rule.label.unique = Unique in column:
|
validation.rule.label.unique = Unique in column
|
||||||
|
|
||||||
dialog.validation.rules.title = Validation rules
|
dialog.validation.rules.title = Validation rules
|
||||||
dialog.validation.rules.header = Validation rules of column "{0}"
|
dialog.validation.rules.header = Validation rules of column "{0}"
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ validation.message.header.length = Anzahl der \u00dcberschriften ist nicht korre
|
|||||||
validation.message.header.match = \u00dcberschrift in Spalte {0} stimmt nicht. "{1}" sollte "{3}" sein
|
validation.message.header.match = \u00dcberschrift in Spalte {0} stimmt nicht. "{1}" sollte "{3}" sein
|
||||||
validation.message.value.of = Der Wert {0} ist nicht in der Liste {1} enthalten
|
validation.message.value.of = Der Wert {0} ist nicht in der Liste {1} enthalten
|
||||||
|
|
||||||
validation.rule.label.not_empty = Nicht leer:
|
validation.rule.label.not_empty = Nicht leer
|
||||||
validation.rule.label.integer = Zahl:
|
validation.rule.label.integer = Zahl
|
||||||
validation.rule.label.double = Gleitkommazahl:
|
validation.rule.label.double = Gleitkommazahl
|
||||||
validation.rule.label.minlength = Minimale L\u00e4nge:
|
validation.rule.label.minlength = Minimale L\u00e4nge:
|
||||||
validation.rule.label.maxlength = Maximale L\u00e4nge:
|
validation.rule.label.maxlength = Maximale L\u00e4nge:
|
||||||
validation.rule.label.dateformat = Datumsformat:
|
validation.rule.label.dateformat = Datumsformat:
|
||||||
@@ -82,7 +82,7 @@ validation.rule.label.groovy = groovy:
|
|||||||
validation.rules.active = Aktiv
|
validation.rules.active = Aktiv
|
||||||
validation.rules.name = Regel
|
validation.rules.name = Regel
|
||||||
validation.rules.value = Wert
|
validation.rules.value = Wert
|
||||||
validation.rule.label.unique = Einmalig in Spalte:
|
validation.rule.label.unique = Einmalig in Spalte
|
||||||
|
|
||||||
dialog.validation.rules.title = Pr\u00fcfregeln
|
dialog.validation.rules.title = Pr\u00fcfregeln
|
||||||
dialog.validation.rules.header = Pr\u00fcfregeln f\u00fcr die Spalte "{0}"
|
dialog.validation.rules.header = Pr\u00fcfregeln f\u00fcr die Spalte "{0}"
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<?import org.fxmisc.richtext.CodeArea?>
|
|
||||||
<?import java.net.URL?>
|
<?import java.net.URL?>
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.CheckBox?>
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.Spinner?>
|
||||||
|
<?import javafx.scene.control.TextField?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
<?import org.fxmisc.richtext.CodeArea?>
|
||||||
|
|
||||||
<GridPane hgap="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="600.0" vgap="10.0" xmlns="http://javafx.com/javafx/8.0.101" xmlns:fx="http://javafx.com/fxml/1">
|
<GridPane hgap="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="600.0" vgap="10.0" xmlns="http://javafx.com/javafx/8.0.101" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="NEVER" maxWidth="50.0" prefWidth="50.0" />
|
<ColumnConstraints halignment="CENTER" hgrow="NEVER" maxWidth="50.0" prefWidth="50.0" />
|
||||||
@@ -39,15 +45,10 @@
|
|||||||
<Label text="%validation.rule.label.groovy" GridPane.columnIndex="1" GridPane.rowIndex="11" />
|
<Label text="%validation.rule.label.groovy" GridPane.columnIndex="1" GridPane.rowIndex="11" />
|
||||||
<Label text="%validation.rule.label.unique" GridPane.columnIndex="1" GridPane.rowIndex="5" />
|
<Label text="%validation.rule.label.unique" GridPane.columnIndex="1" GridPane.rowIndex="5" />
|
||||||
<CheckBox fx:id="enableNotEmptyRule" mnemonicParsing="false" GridPane.rowIndex="1" />
|
<CheckBox fx:id="enableNotEmptyRule" mnemonicParsing="false" GridPane.rowIndex="1" />
|
||||||
<CheckBox fx:id="notEmptyRuleCheckBox" mnemonicParsing="false" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
|
||||||
<CheckBox fx:id="enableIntegerRule" mnemonicParsing="false" GridPane.rowIndex="2" />
|
<CheckBox fx:id="enableIntegerRule" mnemonicParsing="false" GridPane.rowIndex="2" />
|
||||||
<CheckBox fx:id="integerRuleCheckBox" mnemonicParsing="false" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
|
||||||
<CheckBox fx:id="enableDoubleRule" mnemonicParsing="false" GridPane.rowIndex="3" />
|
<CheckBox fx:id="enableDoubleRule" mnemonicParsing="false" GridPane.rowIndex="3" />
|
||||||
<CheckBox fx:id="doublerRuleCheckBox" mnemonicParsing="false" GridPane.columnIndex="2" GridPane.rowIndex="3" />
|
|
||||||
<CheckBox fx:id="enableAlphanumericRule" mnemonicParsing="false" GridPane.rowIndex="4" />
|
<CheckBox fx:id="enableAlphanumericRule" mnemonicParsing="false" GridPane.rowIndex="4" />
|
||||||
<CheckBox fx:id="alphanumericRuleCheckBox" mnemonicParsing="false" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
|
||||||
<CheckBox fx:id="enableUniqueRule" mnemonicParsing="false" GridPane.rowIndex="5" />
|
<CheckBox fx:id="enableUniqueRule" mnemonicParsing="false" GridPane.rowIndex="5" />
|
||||||
<CheckBox fx:id="uniqueRuleCheckBox" mnemonicParsing="false" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
|
||||||
<CheckBox fx:id="enableMinLengthRule" mnemonicParsing="false" GridPane.rowIndex="6" />
|
<CheckBox fx:id="enableMinLengthRule" mnemonicParsing="false" GridPane.rowIndex="6" />
|
||||||
<Spinner fx:id="minLengthSpinner" GridPane.columnIndex="2" GridPane.rowIndex="6" />
|
<Spinner fx:id="minLengthSpinner" GridPane.columnIndex="2" GridPane.rowIndex="6" />
|
||||||
<CheckBox fx:id="enableMaxLengthRule" mnemonicParsing="false" GridPane.rowIndex="7" />
|
<CheckBox fx:id="enableMaxLengthRule" mnemonicParsing="false" GridPane.rowIndex="7" />
|
||||||
|
|||||||
Reference in New Issue
Block a user