15
15
*/
16
16
package org .cirdles .squid .gui ;
17
17
18
- import javafx .beans .value .ChangeListener ;
19
18
import javafx .beans .value .ObservableValue ;
20
19
import javafx .collections .FXCollections ;
21
20
import javafx .event .ActionEvent ;
28
27
import org .cirdles .squid .exceptions .SquidException ;
29
28
import org .cirdles .squid .gui .dialogs .SquidMessageDialog ;
30
29
import org .cirdles .squid .parameters .parameterModels .ParametersModel ;
30
+ import org .cirdles .squid .parameters .parameterModels .commonPbModels .StaceyKramerCommonLeadModel ;
31
31
import org .cirdles .squid .projects .SquidProject ;
32
32
import org .cirdles .squid .tasks .Task ;
33
33
import org .cirdles .squid .tasks .TaskInterface ;
41
41
import static org .cirdles .squid .gui .SquidUIController .squidLabData ;
42
42
import static org .cirdles .squid .gui .SquidUIController .squidProject ;
43
43
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 ;
44
46
45
47
/**
46
48
* FXML Controller class
51
53
public class ProjectManagerController implements Initializable {
52
54
53
55
@ FXML
54
- private TextField orignalPrawnFileName ;
56
+ private TextField originalPrawnFileName ;
55
57
@ FXML
56
58
private Label softwareVersionLabel ;
57
59
@ FXML
@@ -103,11 +105,6 @@ public class ProjectManagerController implements Initializable {
103
105
@ FXML
104
106
private Spinner <Double > assignedExternalErrThSpinner ;
105
107
@ FXML
106
- private Button parametersSetDefaultsButton ;
107
-
108
- private TaskInterface task ;
109
- private TaskDesign taskDesign ;
110
- @ FXML
111
108
private ToggleGroup toggleGroupIsotope ;
112
109
@ FXML
113
110
private Label projectModeLabel ;
@@ -121,6 +118,13 @@ public class ProjectManagerController implements Initializable {
121
118
private HBox weightedMeansHBox ;
122
119
@ FXML
123
120
private Label weightedMeanRefMatLabel ;
121
+ @ FXML
122
+ private CheckBox useCommonPbModelForUnknownsCheckBox ;
123
+
124
+
125
+
126
+ private TaskInterface task ;
127
+ private TaskDesign taskDesign ;
124
128
125
129
/**
126
130
* Initializes the controller class.
@@ -142,9 +146,9 @@ public void initialize(URL url, ResourceBundle rb) {
142
146
SquidMessageDialog .showWarningDialog (squidException .getMessage (), primaryStageWindow );
143
147
}
144
148
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 );
148
152
if (squidProject .isUseSBM ()) {
149
153
yesSBMRadioButton .setSelected (true );
150
154
} else {
@@ -155,15 +159,20 @@ public void initialize(URL url, ResourceBundle rb) {
155
159
} else {
156
160
spotAverageRatioCalcRadioButton .setSelected (true );
157
161
}
162
+
163
+ useCommonPbModelForUnknownsCheckBox .setSelected (squidProject .getCommonLeadForUnknownsMethodSelected () == 1 );
164
+ DEFAULT_COMMON_LEAD_METHOD_FOR_UNKNOWNS = useCommonPbModelForUnknownsCheckBox .isSelected () ? 1 : 0 ;
158
165
}
159
166
160
- orignalPrawnFileName .setEditable (false );
167
+ originalPrawnFileName .setEditable (false );
161
168
162
169
preferredIndexIsotopeLabel .setVisible (squidProject .isTypeGeochron ());
163
170
isotopeHBox .setVisible (squidProject .isTypeGeochron ());
164
171
weightedMeansHBox .setVisible (squidProject .isTypeGeochron ());
165
172
weightedMeanRefMatLabel .setVisible (squidProject .isTypeGeochron ());
166
173
174
+
175
+
167
176
setupListeners ();
168
177
169
178
// detect if project opened from menu by deserialization
@@ -209,6 +218,13 @@ private void setUpParametersModelsComboBoxes() throws SquidException {
209
218
if (task .getReferenceMaterialSpots ().size () > 0 ) {
210
219
try {
211
220
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
+
212
228
} catch (SquidException squidException ) {
213
229
SquidMessageDialog .showWarningDialog (squidException .getMessage (), primaryStageWindow );
214
230
}
@@ -221,26 +237,11 @@ private void setUpParametersModelsComboBoxes() throws SquidException {
221
237
}
222
238
223
239
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 ));
230
241
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 ));
237
243
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 ));
244
245
245
246
pb208RadioButton .setVisible (!task .isDirectAltPD () && !task .getParentNuclide ().contains ("232" ));
246
247
if (!pb208RadioButton .isVisible () && task .getSelectedIndexIsotope ().compareTo (Squid3Constants .IndexIsoptopesEnum .PB_208 ) == 0 ) {
@@ -302,7 +303,7 @@ private void setUpPrawnFile() {
302
303
analystNameText .setText (squidProject .getAnalystName ());
303
304
projectNotesText .setText (squidProject .getProjectNotes ());
304
305
305
- orignalPrawnFileName .setText (squidProject .getPrawnFileHandler ().getCurrentPrawnSourceFileLocation ());
306
+ originalPrawnFileName .setText (squidProject .getPrawnFileHandler ().getCurrentPrawnSourceFileLocation ());
306
307
307
308
squidFileNameText .setText (SquidUIController .projectFileName );
308
309
@@ -339,7 +340,7 @@ private void yesSBMRadioButtonAction(ActionEvent event) {
339
340
task .setupSquidSessionSpecsAndReduceAndReport (true );
340
341
} catch (SquidException squidException ) {
341
342
boolean chooseNoSBM = SquidMessageDialog .showChoiceDialog (squidException .getMessage (), primaryStageWindow );
342
- if (chooseNoSBM ){
343
+ if (chooseNoSBM ) {
343
344
noSBMRadioButton .setSelected (true );
344
345
}
345
346
}
@@ -443,13 +444,23 @@ private void parametersSetDefaultsOnAction(ActionEvent actionEvent) {
443
444
444
445
taskDesign .setAnalystName (analystNameText .getText ());
445
446
447
+ taskDesign .setCommonLeadForUnknownsMethodSelected (useCommonPbModelForUnknownsCheckBox .isSelected () ? METHOD_COMMON_LEAD_MODEL : METHOD_STACEY_KRAMER );
448
+
446
449
SquidUIController .squidPersistentState .updateSquidPersistentState ();
447
450
}
448
451
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
+
449
458
@ FXML
450
459
private void refreshModelsAction (ActionEvent event ) {
451
460
try {
452
461
task .refreshParametersFromModels (squidProject .isTypeGeochron (), true , false );
462
+ physConstModelComboBox .setItems (FXCollections .observableArrayList (squidLabData .getPhysicalConstantsModels ()));
463
+ commonPbModelComboBox .setItems (FXCollections .observableArrayList (squidLabData .getCommonPbModels ()));
453
464
} catch (SquidException squidException ) {
454
465
SquidMessageDialog .showWarningDialog (squidException .getMessage (), primaryStageWindow );
455
466
}
@@ -459,13 +470,16 @@ static class ParameterModelStringConverter extends StringConverter<ParametersMod
459
470
460
471
@ Override
461
472
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
+ }
463
478
}
464
479
465
480
@ Override
466
481
public ParametersModel fromString (String string ) {
467
482
return null ;
468
483
}
469
484
}
470
-
471
485
}
0 commit comments