mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 13:38:23 +02:00
editor should support new config ... first steps
This commit is contained in:
@@ -47,6 +47,15 @@ public class ValidationConfiguration {
|
||||
this.fieldConfigurations = fieldConfigurations;
|
||||
}
|
||||
|
||||
public FieldConfiguration getFieldConfiguration(String column) {
|
||||
for (FieldConfiguration fieldConfiguration: fieldConfigurations) {
|
||||
if (fieldConfiguration.getName().equals(column)) {
|
||||
return fieldConfiguration;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[] headerNames() {
|
||||
if (fieldConfigurations != null) {
|
||||
List<String> headerNames = new ArrayList<>();
|
||||
|
||||
@@ -3,7 +3,7 @@ package ninja.javafx.smartcsv.validation;
|
||||
/**
|
||||
* @author abi
|
||||
*/
|
||||
public class DateFormatHelper {
|
||||
public class ValidationFormatHelper {
|
||||
|
||||
|
||||
public static String dateFormat(String format, String defaultFormat) {
|
||||
@@ -35,4 +35,9 @@ public class DateFormatHelper {
|
||||
}
|
||||
return defaultFormat;
|
||||
}
|
||||
|
||||
public static Integer doubleToInteger(Double value) {
|
||||
if (value == null) return null;
|
||||
return (int)Math.round(value);
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static ninja.javafx.smartcsv.validation.DateFormatHelper.dateFormat;
|
||||
import static ninja.javafx.smartcsv.validation.ValidationFormatHelper.dateFormat;
|
||||
import static ninja.javafx.smartcsv.validation.ValidationFormatHelper.doubleToInteger;
|
||||
|
||||
/**
|
||||
* This class checks all the validations defined in the
|
||||
@@ -252,8 +253,5 @@ public class Validator {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Integer doubleToInteger(Double value) {
|
||||
if (value == null) return null;
|
||||
return (int)Math.round(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user