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 + ")"
|
||||
);
|
||||
|
||||
@FXML
|
||||
private CheckBox notEmptyRuleCheckBox;
|
||||
|
||||
@FXML
|
||||
private CheckBox integerRuleCheckBox;
|
||||
|
||||
@FXML
|
||||
private CheckBox doublerRuleCheckBox;
|
||||
|
||||
@FXML
|
||||
private CheckBox alphanumericRuleCheckBox;
|
||||
|
||||
@FXML
|
||||
private CheckBox uniqueRuleCheckBox;
|
||||
// @FXML
|
||||
// private CheckBox notEmptyRuleCheckBox;
|
||||
//
|
||||
// @FXML
|
||||
// private CheckBox integerRuleCheckBox;
|
||||
//
|
||||
// @FXML
|
||||
// private CheckBox doublerRuleCheckBox;
|
||||
//
|
||||
// @FXML
|
||||
// private CheckBox alphanumericRuleCheckBox;
|
||||
//
|
||||
// @FXML
|
||||
// private CheckBox uniqueRuleCheckBox;
|
||||
|
||||
@FXML
|
||||
private Spinner<Integer> minLengthSpinner;
|
||||
@@ -174,11 +174,6 @@ public class ValidationEditorController extends FXMLController {
|
||||
minLengthSpinner.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(maxLengthSpinner, enableMaxLengthRule);
|
||||
initTextInputControl(dateformatRuleTextField, enableDateRule);
|
||||
@@ -210,31 +205,31 @@ public class ValidationEditorController extends FXMLController {
|
||||
public void updateConfiguration() {
|
||||
|
||||
if (enableIntegerRule.isSelected()) {
|
||||
validationConfiguration.setIntegerRuleFor(selectedColumn.getValue(), integerRuleCheckBox.isSelected());
|
||||
validationConfiguration.setIntegerRuleFor(selectedColumn.getValue(), enableIntegerRule.isSelected());
|
||||
} else {
|
||||
validationConfiguration.setIntegerRuleFor(selectedColumn.getValue(), null);
|
||||
}
|
||||
|
||||
if (enableNotEmptyRule.isSelected()) {
|
||||
validationConfiguration.setNotEmptyRuleFor(selectedColumn.getValue(), notEmptyRuleCheckBox.isSelected());
|
||||
validationConfiguration.setNotEmptyRuleFor(selectedColumn.getValue(), enableNotEmptyRule.isSelected());
|
||||
} else {
|
||||
validationConfiguration.setNotEmptyRuleFor(selectedColumn.getValue(), null);
|
||||
}
|
||||
|
||||
if (enableUniqueRule.isSelected()) {
|
||||
validationConfiguration.setUniqueRuleFor(selectedColumn.getValue(), uniqueRuleCheckBox.isSelected());
|
||||
validationConfiguration.setUniqueRuleFor(selectedColumn.getValue(), enableUniqueRule.isSelected());
|
||||
} else {
|
||||
validationConfiguration.setUniqueRuleFor(selectedColumn.getValue(), null);
|
||||
}
|
||||
|
||||
if (enableDoubleRule.isSelected()) {
|
||||
validationConfiguration.setDoubleRuleFor(selectedColumn.getValue(), doublerRuleCheckBox.isSelected());
|
||||
validationConfiguration.setDoubleRuleFor(selectedColumn.getValue(), enableDoubleRule.isSelected());
|
||||
} else {
|
||||
validationConfiguration.setDoubleRuleFor(selectedColumn.getValue(), null);
|
||||
}
|
||||
|
||||
if (enableAlphanumericRule.isSelected()) {
|
||||
validationConfiguration.setAlphanumericRuleFor(selectedColumn.getValue(), alphanumericRuleCheckBox.isSelected());
|
||||
validationConfiguration.setAlphanumericRuleFor(selectedColumn.getValue(), enableAlphanumericRule.isSelected());
|
||||
} else {
|
||||
validationConfiguration.setAlphanumericRuleFor(selectedColumn.getValue(), null);
|
||||
}
|
||||
@@ -281,31 +276,26 @@ public class ValidationEditorController extends FXMLController {
|
||||
private void updateForm() {
|
||||
|
||||
updateCheckBox(
|
||||
notEmptyRuleCheckBox,
|
||||
validationConfiguration.getNotEmptyRuleFor(getSelectedColumn()),
|
||||
enableNotEmptyRule
|
||||
);
|
||||
|
||||
updateCheckBox(
|
||||
integerRuleCheckBox,
|
||||
validationConfiguration.getIntegerRuleFor(getSelectedColumn()),
|
||||
enableIntegerRule
|
||||
);
|
||||
|
||||
updateCheckBox(
|
||||
doublerRuleCheckBox,
|
||||
validationConfiguration.getDoubleRuleFor(getSelectedColumn()),
|
||||
enableDoubleRule
|
||||
);
|
||||
|
||||
updateCheckBox(
|
||||
alphanumericRuleCheckBox,
|
||||
validationConfiguration.getAlphanumericRuleFor(getSelectedColumn()),
|
||||
enableAlphanumericRule
|
||||
);
|
||||
|
||||
updateCheckBox(
|
||||
uniqueRuleCheckBox,
|
||||
validationConfiguration.getUniqueRuleFor(getSelectedColumn()),
|
||||
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) {
|
||||
ruleEnabled.setSelected(false);
|
||||
} else {
|
||||
rule.setSelected(value);
|
||||
ruleEnabled.setSelected(true);
|
||||
ruleEnabled.setSelected(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
rule.disableProperty().bind(ruleEnabled.selectedProperty().not());
|
||||
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.value.of = Value {0} is not part of this list {1}
|
||||
|
||||
validation.rule.label.not_empty = not empty:
|
||||
validation.rule.label.integer = integer:
|
||||
validation.rule.label.double = double:
|
||||
validation.rule.label.not_empty = not empty
|
||||
validation.rule.label.integer = integer
|
||||
validation.rule.label.double = double
|
||||
validation.rule.label.minlength = minimum length:
|
||||
validation.rule.label.maxlength = maximum length:
|
||||
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.value_of = value in list:
|
||||
validation.rule.label.groovy = groovy:
|
||||
validation.rules.active = active
|
||||
validation.rules.name = rule
|
||||
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.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.value.of = Der Wert {0} ist nicht in der Liste {1} enthalten
|
||||
|
||||
validation.rule.label.not_empty = Nicht leer:
|
||||
validation.rule.label.integer = Zahl:
|
||||
validation.rule.label.double = Gleitkommazahl:
|
||||
validation.rule.label.not_empty = Nicht leer
|
||||
validation.rule.label.integer = Zahl
|
||||
validation.rule.label.double = Gleitkommazahl
|
||||
validation.rule.label.minlength = Minimale L\u00e4nge:
|
||||
validation.rule.label.maxlength = Maximale L\u00e4nge:
|
||||
validation.rule.label.dateformat = Datumsformat:
|
||||
@@ -82,7 +82,7 @@ validation.rule.label.groovy = groovy:
|
||||
validation.rules.active = Aktiv
|
||||
validation.rules.name = Regel
|
||||
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.header = Pr\u00fcfregeln f\u00fcr die Spalte "{0}"
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
<?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 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">
|
||||
<columnConstraints>
|
||||
<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.unique" GridPane.columnIndex="1" GridPane.rowIndex="5" />
|
||||
<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="integerRuleCheckBox" mnemonicParsing="false" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
||||
<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="alphanumericRuleCheckBox" mnemonicParsing="false" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
||||
<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" />
|
||||
<Spinner fx:id="minLengthSpinner" GridPane.columnIndex="2" GridPane.rowIndex="6" />
|
||||
<CheckBox fx:id="enableMaxLengthRule" mnemonicParsing="false" GridPane.rowIndex="7" />
|
||||
|
||||
Reference in New Issue
Block a user