use of org.cirdles.squid.parameters.ParametersModelComparator in project Squid by CIRDLES.
the class ParametersManagerGUIController method refMatSaveAndRegisterEdit.
@FXML
private void refMatSaveAndRegisterEdit(ActionEvent event) throws SquidException {
boolean hasModelWithSameNameAndVersion = false;
String name = refMatModelName.getText();
String version = refMatVersion.getText();
for (int i = 0; i < refMatModels.size() && !hasModelWithSameNameAndVersion; i++) {
hasModelWithSameNameAndVersion = name.equals(refMatModels.get(i).getModelName()) && version.equals(refMatModels.get(i).getVersion());
}
if (!hasModelWithSameNameAndVersion || isEditingCurrRefMat) {
refMatModel.setIsEditable(true);
refMatModel.setModelName(refMatModelName.getText());
refMatModel.setLabName(refMatLabName.getText());
refMatModel.setVersion(refMatVersion.getText());
refMatModel.setDateCertified(refMatDateCertified.getText());
ObservableList<RefMatDataModel> dataModels = refMatDataTable.getItems();
dataModels.addAll(UUTable.getItems());
boolean[] isMeasures = new boolean[dataModels.size()];
for (int i = 0; i < isMeasures.length; i++) {
RefMatDataModel mod = dataModels.get(i);
isMeasures[i] = mod.getIsMeasured().isSelected();
}
((ReferenceMaterialModel) refMatModel).setDataMeasured(isMeasures);
refMatModel.setReferences(refMatReferencesArea.getText());
refMatModel.setComments(refMatCommentsArea.getText());
if (!isEditingCurrRefMat) {
refMatModels.add(refMatModel);
} else {
isEditingCurrRefMat = false;
refMatHolder = null;
}
refMatModels.sort(new ParametersModelComparator());
setUpRefMatCBItems();
refMatCB.getSelectionModel().select(refMatModels.indexOf(refMatModel));
refMatEditable(false);
setUpRefMatMenuItems(false, refMatModel.isEditable());
isEditingRefMat = false;
squidLabData.storeState();
} else {
SquidMessageDialog.showWarningDialog("A Reference Material with the same name and version exists.\n" + "Please change the name and/or version", squidLabDataWindow);
}
}
use of org.cirdles.squid.parameters.ParametersModelComparator in project Squid by CIRDLES.
the class ParametersManagerGUIController method commonPbSaveAndRegisterEdit.
@FXML
private void commonPbSaveAndRegisterEdit(ActionEvent event) throws SquidException {
boolean hasModelWithSameNameAndVersion = false;
String name = commonPbModelName.getText();
String version = commonPbVersion.getText();
for (int i = 0; i < commonPbModels.size() && !hasModelWithSameNameAndVersion; i++) {
hasModelWithSameNameAndVersion = name.equals(commonPbModels.get(i).getModelName()) && version.equals(commonPbModels.get(i).getVersion());
}
if (!hasModelWithSameNameAndVersion || isEditingCurrCommonPbModel) {
commonPbModel.setIsEditable(true);
commonPbModel.setModelName(commonPbModelName.getText());
commonPbModel.setLabName(commonPbLabName.getText());
commonPbModel.setVersion(commonPbVersion.getText());
commonPbModel.setDateCertified(commonPbDateCertified.getText());
commonPbModel.setReferences(commonPbReferencesArea.getText());
commonPbModel.setComments(commonPbCommentsArea.getText());
if (!isEditingCurrCommonPbModel) {
commonPbModels.add(commonPbModel);
} else {
isEditingCurrCommonPbModel = false;
commonPbModelHolder = null;
}
commonPbModels.sort(new ParametersModelComparator());
isEditingCommonPb = false;
setUpCommonPbCBItems();
commonPbCB.getSelectionModel().select(commonPbModels.indexOf(commonPbModel));
commonPbModelEditable(false);
setUpCommonPbMenuItems(false, commonPbModel.isEditable());
squidLabData.storeState();
} else {
SquidMessageDialog.showWarningDialog("A Common Lead Model with the same name and version exists.\n" + "Please change the name and/or version", squidLabDataWindow);
}
}
use of org.cirdles.squid.parameters.ParametersModelComparator in project Squid by CIRDLES.
the class ParametersManagerGUIController method refMatRemoveCurrMod.
@FXML
private void refMatRemoveCurrMod(ActionEvent event) throws SquidException {
refMatModels.remove(refMatModel);
refMatModels.sort(new ParametersModelComparator());
setUpRefMatCBItems();
refMatCB.getSelectionModel().selectFirst();
refMatEditable(false);
setUpRefMatMenuItems(false, refMatModel.isEditable());
squidLabData.storeState();
}
use of org.cirdles.squid.parameters.ParametersModelComparator in project Squid by CIRDLES.
the class SquidLabData method updateSquidLabData.
private void updateSquidLabData() throws SquidException {
referenceMaterials.removeAll(ReferenceMaterialModel.getDefaultModels());
referenceMaterials.addAll(ReferenceMaterialModel.getDefaultModels());
referenceMaterials.sort(new ParametersModelComparator());
physicalConstantsModels.removeAll(PhysicalConstantsModel.getDefaultModels());
physicalConstantsModels.addAll(PhysicalConstantsModel.getDefaultModels());
physicalConstantsModels.sort(new ParametersModelComparator());
commonPbModels.removeAll(CommonPbModel.getDefaultModels());
commonPbModels.addAll(CommonPbModel.getDefaultModels());
commonPbModels.sort(new ParametersModelComparator());
physConstDefault = PhysicalConstantsModel.getDefaultModel(SQUID2_DEFAULT_PHYSICAL_CONSTANTS_MODEL_V1, "1.0");
refMatDefault = ReferenceMaterialModel.getDefaultModel("z6266 ID-TIMS (559.0 Ma)", "1.0");
refMatConcDefault = ReferenceMaterialModel.getDefaultModel("z6266 ID-TIMS (559.0 Ma)", "1.0");
commonPbDefault = CommonPbModel.getDefaultModel("Stacey-Kramers@559.0Ma (z6266)", "1.0");
version = CURRENT_VERSION;
specialWMSortingReportTable = null;
specialRMWMSortingReportTable = null;
defaultReportTable = null;
defaultReportTableRM = null;
storeState();
}
use of org.cirdles.squid.parameters.ParametersModelComparator in project Squid by CIRDLES.
the class SquidUIController method synchronizeTaskLabDataAndSquidVersion.
private void synchronizeTaskLabDataAndSquidVersion() throws SquidException {
if (squidProject != null && squidProject.getTask() != null) {
TaskInterface task = squidProject.getTask();
SquidProject.setProjectChanged(((Task) task).synchronizeTaskVersion());
(((Task) task).verifySquidLabDataParameters()).forEach(model -> {
if (model instanceof PhysicalConstantsModel) {
squidLabData.addPhysicalConstantsModel(model);
squidLabData.getPhysicalConstantsModels().sort(new ParametersModelComparator());
} else if (model instanceof CommonPbModel) {
squidLabData.addcommonPbModel(model);
squidLabData.getCommonPbModels().sort(new ParametersModelComparator());
} else if (model instanceof ReferenceMaterialModel) {
squidLabData.addReferenceMaterial(model);
squidLabData.getReferenceMaterials().sort(new ParametersModelComparator());
}
});
squidProject.setReferenceMaterialModel(task.getReferenceMaterialModel());
squidProject.setConcentrationReferenceMaterialModel(task.getConcentrationReferenceMaterialModel());
if (SquidProject.isProjectChanged()) {
// dec 2021 for issue #674
task.setExtPErrU(squidProject.getExtPErrU());
task.setExtPErrTh(squidProject.getExtPErrTh());
// next two lines make sure 15-digit rounding is used by reprocessing data
task.setChanged(true);
task.setupSquidSessionSpecsAndReduceAndReport(true);
((Task) task).initTaskDefaultSquidReportTables(true);
ProjectFileUtilities.serializeSquidProject(squidProject, projectFileName);
SquidMessageDialog.showInfoDialog("The project file has been updated for this version of Squid3.\n", primaryStageWindow);
}
}
}
Aggregations