Added some optimizations and new taxonomy names
This commit is contained in:
@@ -10,6 +10,7 @@ import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javafx.application.HostServices;
|
||||
import javafx.collections.transformation.SortedList;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -380,87 +381,87 @@ public class StringAnalysisTabNew2 {
|
||||
* iscvv: false
|
||||
* string length: 1
|
||||
*/
|
||||
public void populateFields() {
|
||||
// corpus changed if: current one is null (this is first run of the app)
|
||||
// or if currentCorpus != gui's corpus
|
||||
boolean corpusChanged = currentCorpusType == null
|
||||
|| currentCorpusType != corpus.getCorpusType();
|
||||
|
||||
// keep ngram value if set
|
||||
if (ngramValue == null) {
|
||||
ngramValueCB.getSelectionModel().select("1");
|
||||
ngramValue = 1;
|
||||
}
|
||||
|
||||
// TODO: check for GOS, GIGAFIDA, SOLAR...
|
||||
// refresh and:
|
||||
// TODO if current value != null && is in new calculateFor ? keep : otherwise reset
|
||||
if (calculateFor == null) {
|
||||
calculateForCB.getSelectionModel().select(calculateForCB.getItems().get(0));
|
||||
calculateFor = CalculateFor.factory(calculateForCB.getItems().get(0));
|
||||
}
|
||||
|
||||
if (!filter.hasMsd()) {
|
||||
// if current corpus doesn't have msd data, disable this field
|
||||
msd = new ArrayList<>();
|
||||
msdTF.setText("");
|
||||
msdTF.setDisable(true);
|
||||
logger.info("no msd data");
|
||||
} else {
|
||||
if (ValidationUtil.isEmpty(msd)
|
||||
|| (!ValidationUtil.isEmpty(msd) && corpusChanged)) {
|
||||
// msd has not been set previously
|
||||
// or msd has been set but the corpus changed -> reset
|
||||
msd = new ArrayList<>();
|
||||
msdTF.setText("");
|
||||
msdTF.setDisable(false);
|
||||
logger.info("msd reset");
|
||||
} else if (!ValidationUtil.isEmpty(msd) && !corpusChanged) {
|
||||
// if msd has been set, but corpus type remained the same, we can keep any set msd value
|
||||
msdTF.setText(StringUtils.join(msdStrings, " "));
|
||||
msdTF.setDisable(false);
|
||||
logger.info("msd kept");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: taxonomy: refresh and keep if in new taxonomy, otherwise empty (no selection)
|
||||
|
||||
// keep skip value
|
||||
if (skipValue == null) {
|
||||
skipValueCB.getSelectionModel().select("0");
|
||||
skipValue = 0;
|
||||
}
|
||||
|
||||
// keep calculateCvv
|
||||
calculatecvvCB.setSelected(calculateCvv);
|
||||
|
||||
// keep string length if set
|
||||
if (stringLength != null) {
|
||||
stringLengthTF.setText(String.valueOf(stringLength));
|
||||
} else {
|
||||
stringLengthTF.setText("1");
|
||||
stringLength = 1;
|
||||
}
|
||||
|
||||
// TODO: trigger on rescan
|
||||
if ((currentCorpusType != null && currentCorpusType != corpus.getCorpusType())) {
|
||||
// user changed corpus (by type) or by selection & triggered a rescan of headers
|
||||
// see if we read taxonomy from headers, otherwise use default values for given corpus
|
||||
ObservableList<String> tax = corpus.getTaxonomy();
|
||||
taxonomyCCBValues = tax != null ? tax : Taxonomy.getDefaultForComboBox(corpus.getCorpusType());
|
||||
|
||||
currentCorpusType = corpus.getCorpusType();
|
||||
// setTaxonomyIsDirty(false);
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
// see if we read taxonomy from headers, otherwise use default values for given corpus
|
||||
ObservableList<String> tax = corpus.getTaxonomy();
|
||||
taxonomyCCBValues = tax != null ? tax : Taxonomy.getDefaultForComboBox(corpus.getCorpusType());
|
||||
taxonomyCCB.getItems().addAll(taxonomyCCBValues);
|
||||
|
||||
}
|
||||
// public void populateFields() {
|
||||
// // corpus changed if: current one is null (this is first run of the app)
|
||||
// // or if currentCorpus != gui's corpus
|
||||
// boolean corpusChanged = currentCorpusType == null
|
||||
// || currentCorpusType != corpus.getCorpusType();
|
||||
//
|
||||
// // keep ngram value if set
|
||||
// if (ngramValue == null) {
|
||||
// ngramValueCB.getSelectionModel().select("1");
|
||||
// ngramValue = 1;
|
||||
// }
|
||||
//
|
||||
// // TODO: check for GOS, GIGAFIDA, SOLAR...
|
||||
// // refresh and:
|
||||
// // TODO if current value != null && is in new calculateFor ? keep : otherwise reset
|
||||
// if (calculateFor == null) {
|
||||
// calculateForCB.getSelectionModel().select(calculateForCB.getItems().get(0));
|
||||
// calculateFor = CalculateFor.factory(calculateForCB.getItems().get(0));
|
||||
// }
|
||||
//
|
||||
// if (!filter.hasMsd()) {
|
||||
// // if current corpus doesn't have msd data, disable this field
|
||||
// msd = new ArrayList<>();
|
||||
// msdTF.setText("");
|
||||
// msdTF.setDisable(true);
|
||||
// logger.info("no msd data");
|
||||
// } else {
|
||||
// if (ValidationUtil.isEmpty(msd)
|
||||
// || (!ValidationUtil.isEmpty(msd) && corpusChanged)) {
|
||||
// // msd has not been set previously
|
||||
// // or msd has been set but the corpus changed -> reset
|
||||
// msd = new ArrayList<>();
|
||||
// msdTF.setText("");
|
||||
// msdTF.setDisable(false);
|
||||
// logger.info("msd reset");
|
||||
// } else if (!ValidationUtil.isEmpty(msd) && !corpusChanged) {
|
||||
// // if msd has been set, but corpus type remained the same, we can keep any set msd value
|
||||
// msdTF.setText(StringUtils.join(msdStrings, " "));
|
||||
// msdTF.setDisable(false);
|
||||
// logger.info("msd kept");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // TODO: taxonomy: refresh and keep if in new taxonomy, otherwise empty (no selection)
|
||||
//
|
||||
// // keep skip value
|
||||
// if (skipValue == null) {
|
||||
// skipValueCB.getSelectionModel().select("0");
|
||||
// skipValue = 0;
|
||||
// }
|
||||
//
|
||||
// // keep calculateCvv
|
||||
// calculatecvvCB.setSelected(calculateCvv);
|
||||
//
|
||||
// // keep string length if set
|
||||
// if (stringLength != null) {
|
||||
// stringLengthTF.setText(String.valueOf(stringLength));
|
||||
// } else {
|
||||
// stringLengthTF.setText("1");
|
||||
// stringLength = 1;
|
||||
// }
|
||||
//
|
||||
// // TODO: trigger on rescan
|
||||
// if ((currentCorpusType != null && currentCorpusType != corpus.getCorpusType())) {
|
||||
// // user changed corpus (by type) or by selection & triggered a rescan of headers
|
||||
// // see if we read taxonomy from headers, otherwise use default values for given corpus
|
||||
// ObservableList<String> tax = corpus.getTaxonomy();
|
||||
// taxonomyCCBValues = tax != null ? tax : Taxonomy.getDefaultForComboBox(corpus.getCorpusType());
|
||||
//
|
||||
// currentCorpusType = corpus.getCorpusType();
|
||||
// // setTaxonomyIsDirty(false);
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// // see if we read taxonomy from headers, otherwise use default values for given corpus
|
||||
// ObservableList<String> tax = corpus.getTaxonomy();
|
||||
// taxonomyCCBValues = tax != null ? tax : Taxonomy.getDefaultForComboBox(corpus.getCorpusType());
|
||||
// taxonomyCCB.getItems().addAll(taxonomyCCBValues);
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* Toggles visibility for panes which hold fields for skipgram value (not applicable when calculating for letters) etc.,
|
||||
|
||||
Reference in New Issue
Block a user