Skip to content

Commit fb56d4a

Browse files
authored
Updates (#716)
* Updated gradle * Fixed issues #706 and #709 * Added drag n drop of .squid and prawn .xml and zipped onto Squid3 anywhere * Fixed #715 * Fixed bug in issue #714 * Updated dependencies and add explicit choice for common lead method for Unknowns * Refactored
1 parent 2bd8e45 commit fb56d4a

File tree

18 files changed

+283
-153
lines changed

18 files changed

+283
-153
lines changed

common.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ apply plugin: 'maven-publish'
77

88

99
String mavenGroupId = 'org.cirdles'
10-
String mavenVersion = '1.10.1'
10+
String mavenVersion = '1.10.2'
1111

1212
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
1313

squidApp/build.gradle

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if (!hasProperty('mainClass')) {
2121
mainClassName = 'org.cirdles.squid.gui.SquidUI'
2222

2323
dependencies {
24-
implementation 'org.jetbrains:annotations:22.0.0'
24+
implementation 'org.jetbrains:annotations:23.0.0'
2525
implementation project(":squidCore")
2626
implementation group: 'org.apache.xmlgraphics', name: 'batik-svg-dom', version: '1.14'
2727
implementation group: 'org.apache.xmlgraphics', name: 'fop', version: '2.7'
@@ -59,4 +59,8 @@ task fatAppJar(type: Jar) {
5959
configurations.all {
6060
// Check for updates every build when 0 or not when 2628000
6161
resolutionStrategy.cacheChangingModulesFor 2628000, 'seconds'
62+
}
63+
64+
repositories {
65+
mavenCentral()
6266
}

squidApp/src/main/java/org/cirdles/squid/gui/ProjectManagerController.java

+47-33
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package org.cirdles.squid.gui;
1717

18-
import javafx.beans.value.ChangeListener;
1918
import javafx.beans.value.ObservableValue;
2019
import javafx.collections.FXCollections;
2120
import javafx.event.ActionEvent;
@@ -28,6 +27,7 @@
2827
import org.cirdles.squid.exceptions.SquidException;
2928
import org.cirdles.squid.gui.dialogs.SquidMessageDialog;
3029
import org.cirdles.squid.parameters.parameterModels.ParametersModel;
30+
import org.cirdles.squid.parameters.parameterModels.commonPbModels.StaceyKramerCommonLeadModel;
3131
import org.cirdles.squid.projects.SquidProject;
3232
import org.cirdles.squid.tasks.Task;
3333
import org.cirdles.squid.tasks.TaskInterface;
@@ -41,6 +41,8 @@
4141
import static org.cirdles.squid.gui.SquidUIController.squidLabData;
4242
import static org.cirdles.squid.gui.SquidUIController.squidProject;
4343
import static org.cirdles.squid.gui.constants.Squid3GuiConstants.STYLE_MANAGER_TITLE;
44+
import static org.cirdles.squid.shrimp.CommonLeadSpecsForSpot.*;
45+
import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.REF_238U235U_RM_MODEL_NAME;
4446

4547
/**
4648
* FXML Controller class
@@ -51,7 +53,7 @@
5153
public class ProjectManagerController implements Initializable {
5254

5355
@FXML
54-
private TextField orignalPrawnFileName;
56+
private TextField originalPrawnFileName;
5557
@FXML
5658
private Label softwareVersionLabel;
5759
@FXML
@@ -103,11 +105,6 @@ public class ProjectManagerController implements Initializable {
103105
@FXML
104106
private Spinner<Double> assignedExternalErrThSpinner;
105107
@FXML
106-
private Button parametersSetDefaultsButton;
107-
108-
private TaskInterface task;
109-
private TaskDesign taskDesign;
110-
@FXML
111108
private ToggleGroup toggleGroupIsotope;
112109
@FXML
113110
private Label projectModeLabel;
@@ -121,6 +118,13 @@ public class ProjectManagerController implements Initializable {
121118
private HBox weightedMeansHBox;
122119
@FXML
123120
private Label weightedMeanRefMatLabel;
121+
@FXML
122+
private CheckBox useCommonPbModelForUnknownsCheckBox;
123+
124+
125+
126+
private TaskInterface task;
127+
private TaskDesign taskDesign;
124128

125129
/**
126130
* Initializes the controller class.
@@ -142,9 +146,9 @@ public void initialize(URL url, ResourceBundle rb) {
142146
SquidMessageDialog.showWarningDialog(squidException.getMessage(), primaryStageWindow);
143147
}
144148

145-
invalidSBMCounts.setText("" + ((Task)task).getCountOfShrimpFractionsWithInvalidSBMcounts());
146-
invalidSBMCounts.setVisible(((Task)task).getCountOfShrimpFractionsWithInvalidSBMcounts() > 0);
147-
invalidSBMCountsDescription.setVisible(((Task)task).getCountOfShrimpFractionsWithInvalidSBMcounts() > 0);
149+
invalidSBMCounts.setText("" + ((Task) task).getCountOfShrimpFractionsWithInvalidSBMcounts());
150+
invalidSBMCounts.setVisible(((Task) task).getCountOfShrimpFractionsWithInvalidSBMcounts() > 0);
151+
invalidSBMCountsDescription.setVisible(((Task) task).getCountOfShrimpFractionsWithInvalidSBMcounts() > 0);
148152
if (squidProject.isUseSBM()) {
149153
yesSBMRadioButton.setSelected(true);
150154
} else {
@@ -155,15 +159,20 @@ public void initialize(URL url, ResourceBundle rb) {
155159
} else {
156160
spotAverageRatioCalcRadioButton.setSelected(true);
157161
}
162+
163+
useCommonPbModelForUnknownsCheckBox.setSelected(squidProject.getCommonLeadForUnknownsMethodSelected() == 1);
164+
DEFAULT_COMMON_LEAD_METHOD_FOR_UNKNOWNS = useCommonPbModelForUnknownsCheckBox.isSelected() ? 1 : 0;
158165
}
159166

160-
orignalPrawnFileName.setEditable(false);
167+
originalPrawnFileName.setEditable(false);
161168

162169
preferredIndexIsotopeLabel.setVisible(squidProject.isTypeGeochron());
163170
isotopeHBox.setVisible(squidProject.isTypeGeochron());
164171
weightedMeansHBox.setVisible(squidProject.isTypeGeochron());
165172
weightedMeanRefMatLabel.setVisible(squidProject.isTypeGeochron());
166173

174+
175+
167176
setupListeners();
168177

169178
// detect if project opened from menu by deserialization
@@ -209,6 +218,13 @@ private void setUpParametersModelsComboBoxes() throws SquidException {
209218
if (task.getReferenceMaterialSpots().size() > 0) {
210219
try {
211220
task.setupSquidSessionSpecsAndReduceAndReport(false);
221+
222+
// issue #714 prime the models
223+
StaceyKramerCommonLeadModel.updatePhysicalConstants(squidProject.getTask().getPhysicalConstantsModel());
224+
StaceyKramerCommonLeadModel.updateU_Ratio(
225+
squidProject.getTask().getReferenceMaterialModel().getDatumByName(REF_238U235U_RM_MODEL_NAME).getValue().doubleValue());
226+
((Task) task).evaluateUnknownsWithChangedParameters(task.getUnknownSpots());
227+
212228
} catch (SquidException squidException) {
213229
SquidMessageDialog.showWarningDialog(squidException.getMessage(), primaryStageWindow);
214230
}
@@ -221,26 +237,11 @@ private void setUpParametersModelsComboBoxes() throws SquidException {
221237
}
222238

223239
private void setupListeners() {
224-
projectNameText.textProperty().addListener(new ChangeListener<String>() {
225-
@Override
226-
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
227-
squidProject.setProjectName(newValue);
228-
}
229-
});
240+
projectNameText.textProperty().addListener((observable, oldValue, newValue) -> squidProject.setProjectName(newValue));
230241

231-
analystNameText.textProperty().addListener(new ChangeListener<String>() {
232-
@Override
233-
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
234-
squidProject.setAnalystName(newValue);
235-
}
236-
});
242+
analystNameText.textProperty().addListener((observable, oldValue, newValue) -> squidProject.setAnalystName(newValue));
237243

238-
projectNotesText.textProperty().addListener(new ChangeListener<String>() {
239-
@Override
240-
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
241-
squidProject.setProjectNotes(newValue);
242-
}
243-
});
244+
projectNotesText.textProperty().addListener((observable, oldValue, newValue) -> squidProject.setProjectNotes(newValue));
244245

245246
pb208RadioButton.setVisible(!task.isDirectAltPD() && !task.getParentNuclide().contains("232"));
246247
if (!pb208RadioButton.isVisible() && task.getSelectedIndexIsotope().compareTo(Squid3Constants.IndexIsoptopesEnum.PB_208) == 0) {
@@ -302,7 +303,7 @@ private void setUpPrawnFile() {
302303
analystNameText.setText(squidProject.getAnalystName());
303304
projectNotesText.setText(squidProject.getProjectNotes());
304305

305-
orignalPrawnFileName.setText(squidProject.getPrawnFileHandler().getCurrentPrawnSourceFileLocation());
306+
originalPrawnFileName.setText(squidProject.getPrawnFileHandler().getCurrentPrawnSourceFileLocation());
306307

307308
squidFileNameText.setText(SquidUIController.projectFileName);
308309

@@ -339,7 +340,7 @@ private void yesSBMRadioButtonAction(ActionEvent event) {
339340
task.setupSquidSessionSpecsAndReduceAndReport(true);
340341
} catch (SquidException squidException) {
341342
boolean chooseNoSBM = SquidMessageDialog.showChoiceDialog(squidException.getMessage(), primaryStageWindow);
342-
if (chooseNoSBM){
343+
if (chooseNoSBM) {
343344
noSBMRadioButton.setSelected(true);
344345
}
345346
}
@@ -443,13 +444,23 @@ private void parametersSetDefaultsOnAction(ActionEvent actionEvent) {
443444

444445
taskDesign.setAnalystName(analystNameText.getText());
445446

447+
taskDesign.setCommonLeadForUnknownsMethodSelected(useCommonPbModelForUnknownsCheckBox.isSelected() ? METHOD_COMMON_LEAD_MODEL : METHOD_STACEY_KRAMER);
448+
446449
SquidUIController.squidPersistentState.updateSquidPersistentState();
447450
}
448451

452+
@FXML
453+
void useCommonPbModelForUnkownsAction(ActionEvent event) {
454+
squidProject.setCommonLeadForUnknownsMethodSelected(useCommonPbModelForUnknownsCheckBox.isSelected() ? METHOD_COMMON_LEAD_MODEL : METHOD_STACEY_KRAMER);
455+
DEFAULT_COMMON_LEAD_METHOD_FOR_UNKNOWNS = useCommonPbModelForUnknownsCheckBox.isSelected() ? METHOD_COMMON_LEAD_MODEL : METHOD_STACEY_KRAMER;
456+
}
457+
449458
@FXML
450459
private void refreshModelsAction(ActionEvent event) {
451460
try {
452461
task.refreshParametersFromModels(squidProject.isTypeGeochron(), true, false);
462+
physConstModelComboBox.setItems(FXCollections.observableArrayList(squidLabData.getPhysicalConstantsModels()));
463+
commonPbModelComboBox.setItems(FXCollections.observableArrayList(squidLabData.getCommonPbModels()));
453464
} catch (SquidException squidException) {
454465
SquidMessageDialog.showWarningDialog(squidException.getMessage(), primaryStageWindow);
455466
}
@@ -459,13 +470,16 @@ static class ParameterModelStringConverter extends StringConverter<ParametersMod
459470

460471
@Override
461472
public String toString(ParametersModel model) {
462-
return model.getModelNameWithVersion() + (model.isEditable() ? "" : " <Built-in>");
473+
if (model == null) {
474+
return null;
475+
} else {
476+
return model.getModelNameWithVersion() + (model.isEditable() ? "" : " <Built-in>");
477+
}
463478
}
464479

465480
@Override
466481
public ParametersModel fromString(String string) {
467482
return null;
468483
}
469484
}
470-
471485
}

squidApp/src/main/java/org/cirdles/squid/gui/SpotManagerController.java

+25-37
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929
import javafx.scene.input.MouseEvent;
3030
import javafx.scene.layout.HBox;
3131
import javafx.util.Callback;
32-
import javafx.util.StringConverter;
33-
import org.cirdles.squid.gui.dialogs.SquidMessageDialog;
3432
import org.cirdles.squid.exceptions.SquidException;
33+
import org.cirdles.squid.gui.dialogs.SquidMessageDialog;
3534
import org.cirdles.squid.gui.parameters.ParametersLauncher;
3635
import org.cirdles.squid.gui.parameters.ParametersManagerGUIController;
3736
import org.cirdles.squid.parameters.parameterModels.ParametersModel;
3837
import org.cirdles.squid.parameters.parameterModels.referenceMaterialModels.ReferenceMaterialModel;
3938
import org.cirdles.squid.prawn.PrawnFile;
4039
import org.cirdles.squid.prawn.PrawnFile.Run;
4140
import org.cirdles.squid.projects.SquidProject;
41+
import org.cirdles.squid.shrimp.ShrimpFractionExpressionInterface;
4242

4343
import java.math.BigDecimal;
4444
import java.math.RoundingMode;
@@ -53,6 +53,7 @@
5353
import static org.cirdles.squid.gui.constants.Squid3GuiConstants.STYLE_MANAGER_TITLE;
5454
import static org.cirdles.squid.parameters.util.RadDates.*;
5555
import static org.cirdles.squid.parameters.util.ReferenceMaterialEnum.r238_235s;
56+
import static org.cirdles.squid.shrimp.CommonLeadSpecsForSpot.METHOD_COMMON_LEAD_MODEL;
5657

5758
/**
5859
* FXML Controller class
@@ -380,7 +381,11 @@ private ContextMenu createRefMatSpotsViewContextMenu() {
380381
menuItem.setOnAction((evt) -> {
381382
squidProject.updateFilterForRefMatSpotNames("");
382383
squidProject.setReferenceMaterialModel(new ReferenceMaterialModel());
383-
updateReferenceMaterialsList(true);
384+
try {
385+
updateReferenceMaterialsList(true);
386+
} catch (SquidException e) {
387+
e.printStackTrace();
388+
}
384389
});
385390
contextMenu.getItems().add(menuItem);
386391
return contextMenu;
@@ -438,30 +443,16 @@ private void setUpParametersModelsComboBoxes() {
438443
// ReferenceMaterials
439444
refMatModelComboBox.setConverter(new ProjectManagerController.ParameterModelStringConverter());
440445
refMatModelComboBox.setItems(FXCollections.observableArrayList(squidLabData.getReferenceMaterialsWithNonZeroDate()));
441-
refMatModelComboBox.setConverter(new StringConverter<ParametersModel>() {
442-
@Override
443-
public String toString(ParametersModel model) {
444-
if (model == null) {
445-
return null;
446-
} else {
447-
return model.getModelNameWithVersion() + (model.isEditable() ? "" : " <Built-in>");
448-
}
449-
}
450-
451-
@Override
452-
public ParametersModel fromString(String userId) {
453-
return null;
454-
}
455-
});
456-
457446
updateViewRM();
458447

459448
refMatModelComboBox.valueProperty()
460449
.addListener((ObservableValue<? extends ParametersModel> observable, ParametersModel oldValue, ParametersModel newValue) -> {
461450
if ((oldValue != null) && (newValue != null) && (newValue.compareTo(oldValue) != 0)) {
462451
squidProject.setReferenceMaterialModel(newValue);
463452
squidProject.getTask().setChanged(true);
464-
try{squidProject.getTask().refreshParametersFromModels(false, false, true);}
453+
try{
454+
squidProject.getTask().refreshParametersFromModels(false, false, true);
455+
}
465456
catch(SquidException squidException){ SquidMessageDialog.showWarningDialog(squidException.getMessage(), primaryStageWindow);}
466457
alertForZeroNaturalUranium();
467458
}
@@ -509,21 +500,6 @@ public ParametersModel fromString(String userId) {
509500
// ConcentrationReferenceMaterials
510501
concRefMatModelComboBox.setConverter(new ProjectManagerController.ParameterModelStringConverter());
511502
concRefMatModelComboBox.setItems(FXCollections.observableArrayList(squidLabData.getReferenceMaterialsWithNonZeroConcentrations()));
512-
concRefMatModelComboBox.setConverter(new StringConverter<ParametersModel>() {
513-
@Override
514-
public String toString(ParametersModel model) {
515-
if (model == null) {
516-
return null;
517-
} else {
518-
return model.getModelNameWithVersion() + (model.isEditable() ? "" : " <Built-in>");
519-
}
520-
}
521-
522-
@Override
523-
public ParametersModel fromString(String userId) {
524-
return null;
525-
}
526-
});
527503
updateViewCM();
528504

529505
concRefMatModelComboBox.valueProperty()
@@ -567,7 +543,7 @@ private void filterRuns(String filterString) {
567543
}
568544

569545
@FXML
570-
private void setFilteredSpotsToRefMatAction(ActionEvent event) {
546+
private void setFilteredSpotsToRefMatAction(ActionEvent event) throws SquidException {
571547
squidProject.updateFilterForRefMatSpotNames(
572548
filterSpotNameText.getText().toUpperCase(Locale.ENGLISH).trim());
573549
updateReferenceMaterialsList(true);
@@ -580,7 +556,7 @@ private void setFilteredSpotsToConcRefMatAction(ActionEvent event) {
580556
updateConcReferenceMaterialsList(true);
581557
}
582558

583-
private void updateReferenceMaterialsList(boolean updateTaskStatus) {
559+
private void updateReferenceMaterialsList(boolean updateTaskStatus) throws SquidException {
584560
String filter = squidProject.getFilterForRefMatSpotNames();
585561
// initialize list
586562
shrimpRunsRefMat = runsModel.getViewableShrimpRuns();
@@ -599,6 +575,12 @@ private void updateReferenceMaterialsList(boolean updateTaskStatus) {
599575

600576
if (updateTaskStatus) {
601577
squidProject.getTask().setChanged(true);
578+
// issue #714
579+
// update ref mat spots to be model-based common lead
580+
for (ShrimpFractionExpressionInterface spot : squidProject.getTask().getReferenceMaterialSpots()){
581+
spot.getCommonLeadSpecsForSpot().setMethodSelected(METHOD_COMMON_LEAD_MODEL);
582+
spot.getCommonLeadSpecsForSpot().updateCommonLeadRatiosFromModel();
583+
}
602584
try {
603585
squidProject.getTask().setupSquidSessionSpecsAndReduceAndReport(false);
604586
}catch(SquidException squidException){
@@ -673,18 +655,24 @@ private void saveSpotNameAction(ActionEvent event) {
673655
private void viewRMmodelButton(ActionEvent event) {
674656
ParametersManagerGUIController.selectedReferenceMaterialModel = squidProject.getReferenceMaterialModel();
675657
parametersLauncher.launchParametersManager(ParametersLauncher.ParametersTab.refMat);
658+
refMatModelComboBox.setItems(FXCollections.observableArrayList(squidLabData.getReferenceMaterialsWithNonZeroDate()));
659+
concRefMatModelComboBox.setItems(FXCollections.observableArrayList(squidLabData.getReferenceMaterialsWithNonZeroConcentrations()));
676660
}
677661

678662
@FXML
679663
private void viewCMmodelButton(ActionEvent event) {
680664
ParametersManagerGUIController.selectedReferenceMaterialModel = squidProject.getConcentrationReferenceMaterialModel();
681665
parametersLauncher.launchParametersManager(ParametersLauncher.ParametersTab.refMat);
666+
refMatModelComboBox.setItems(FXCollections.observableArrayList(squidLabData.getReferenceMaterialsWithNonZeroDate()));
667+
concRefMatModelComboBox.setItems(FXCollections.observableArrayList(squidLabData.getReferenceMaterialsWithNonZeroConcentrations()));
682668
}
683669

684670
@FXML
685671
private void refreshRMmodelButton(ActionEvent event) {
686672
try {
687673
squidProject.getTask().refreshParametersFromModels(false, false, true);
674+
refMatModelComboBox.setItems(FXCollections.observableArrayList(squidLabData.getReferenceMaterialsWithNonZeroDate()));
675+
concRefMatModelComboBox.setItems(FXCollections.observableArrayList(squidLabData.getReferenceMaterialsWithNonZeroConcentrations()));
688676
}catch (SquidException squidException){
689677
SquidMessageDialog.showWarningDialog(squidException.getMessage(), primaryStageWindow);
690678
}

0 commit comments

Comments
 (0)