mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 13:38:23 +02:00
set the some default preferences if file not found
This commit is contained in:
@@ -457,6 +457,8 @@ public class SmartCSVController extends FXMLController {
|
|||||||
if (PREFERENCES_FILE.exists()) {
|
if (PREFERENCES_FILE.exists()) {
|
||||||
useLoadFileService(preferencesLoader, PREFERENCES_FILE,
|
useLoadFileService(preferencesLoader, PREFERENCES_FILE,
|
||||||
event -> setCsvPreference(preferencesLoader.getCSVpreference()));
|
event -> setCsvPreference(preferencesLoader.getCSVpreference()));
|
||||||
|
} else {
|
||||||
|
setCsvPreference(CsvPreference.EXCEL_NORTH_EUROPE_PREFERENCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ public class PreferencesController extends FXMLController {
|
|||||||
@FXML
|
@FXML
|
||||||
private ComboBox<String> quoteMode;
|
private ComboBox<String> quoteMode;
|
||||||
|
|
||||||
|
private String endOfLineSymbols;
|
||||||
|
|
||||||
private BooleanProperty valid = new SimpleBooleanProperty(true);
|
private BooleanProperty valid = new SimpleBooleanProperty(true);
|
||||||
|
|
||||||
|
|
||||||
@@ -104,10 +106,11 @@ public class PreferencesController extends FXMLController {
|
|||||||
surroundingSpacesNeedQuotes.setSelected(csvPreference.isSurroundingSpacesNeedQuotes());
|
surroundingSpacesNeedQuotes.setSelected(csvPreference.isSurroundingSpacesNeedQuotes());
|
||||||
ignoreEmptyLines.setSelected(csvPreference.isIgnoreEmptyLines());
|
ignoreEmptyLines.setSelected(csvPreference.isIgnoreEmptyLines());
|
||||||
quoteMode.getSelectionModel().select(getQuoteModeName(csvPreference.getQuoteMode()));
|
quoteMode.getSelectionModel().select(getQuoteModeName(csvPreference.getQuoteMode()));
|
||||||
|
endOfLineSymbols = csvPreference.getEndOfLineSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CsvPreference getCsvPreference() {
|
public CsvPreference getCsvPreference() {
|
||||||
return new CsvPreference.Builder(quoteChar.getText().charAt(0), delimiterChar.getText().charAt(0), "\n")
|
return new CsvPreference.Builder(quoteChar.getText().charAt(0), delimiterChar.getText().charAt(0), endOfLineSymbols)
|
||||||
.useQuoteMode(getQuoteMode(quoteMode.getSelectionModel().getSelectedItem()))
|
.useQuoteMode(getQuoteMode(quoteMode.getSelectionModel().getSelectedItem()))
|
||||||
.surroundingSpacesNeedQuotes(surroundingSpacesNeedQuotes.isSelected())
|
.surroundingSpacesNeedQuotes(surroundingSpacesNeedQuotes.isSelected())
|
||||||
.ignoreEmptyLines(ignoreEmptyLines.isSelected())
|
.ignoreEmptyLines(ignoreEmptyLines.isSelected())
|
||||||
|
|||||||
Reference in New Issue
Block a user