Skip to content

Commit 85c445d

Browse files
authored
Fixed task editor and browser layouts and misc issues (#551)
* Fixed lauyout of task editor for lorge count of species * Fixed #549 and refactored * Tweaked task browser * Fixed #541 * Tweaked labels per #550 * Updated labels per #550 * Fixed #538 and #550 * Refactored * Reversed changes to WM algorithm per @sbodorkos * Updated default report handling and example project files * Fixed #552 * Refactored
1 parent 2d07f13 commit 85c445d

File tree

28 files changed

+202
-314
lines changed

28 files changed

+202
-314
lines changed

gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
action.build.args=clean build test
2+
action.clean.args=clean

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,8 @@ private void saveSquidProjectMenuItemAction(ActionEvent event) {
758758
try {
759759
ProjectFileUtilities.serializeSquidProject(squidProject, squidPersistentState.getMRUProjectFile().getCanonicalPath());
760760
squidProjectOriginalHash = squidProject.hashCode();
761-
} catch (IOException iOException) {
761+
} catch (IOException | SquidException ex) {
762+
SquidMessageDialog.showWarningDialog(ex.getMessage(), null);
762763
}
763764
}
764765
}
@@ -1517,6 +1518,7 @@ public void launchCommonLeadAssignment() {
15171518
private void launchConcordiaAndWeightedMeanPlots() {
15181519
mainPane.getChildren().remove(plotUI);
15191520
squidProject.getTask().buildSquidSpeciesModelList();
1521+
squidProject.getTask().updateAllExpressions(true);
15201522
if (confirmReduction()) {
15211523
PlotsController.currentlyPlottedSampleTreeNode = null;
15221524
launchInterpretations();
@@ -1909,6 +1911,11 @@ private void editExistingTaskMenuItemAction(ActionEvent event) {
19091911
launchTaskEditor(TaskEditTypeEnum.EDIT_EXISTING_TASK);
19101912
}
19111913

1914+
@FXML
1915+
private void videoTutorialsGoogleDriveMenuItemAction(ActionEvent event) {
1916+
BrowserControl.showURI("https://drive.google.com/drive/folders/1PnGhJENKeN6lLJyruc8mGewiUp1DAeCX?usp=sharing");
1917+
}
1918+
19121919
private class HighlightMainMenu {
19131920

19141921
private Menu highlightedMenu;

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

+5-10
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,6 @@ private void populateMasses() {
422422

423423
Collections.sort(allMasses, new IntuitiveStringComparator<>());
424424

425-
// allMasses.remove(DEFAULT_BACKGROUND_MASS_LABEL);
426-
// if (taskEditor.getIndexOfBackgroundSpecies() >= 0) {
427-
// allMasses.add((allMasses.size() > taskEditor.getIndexOfBackgroundSpecies()
428-
// ? taskEditor.getIndexOfBackgroundSpecies() : allMasses.size()),
429-
// DEFAULT_BACKGROUND_MASS_LABEL);
430-
// }
431425
int count = 1;
432426
for (String mass : allMasses) {
433427
StackPane massText;
@@ -452,6 +446,10 @@ private void populateMasses() {
452446
massText.setTranslateX(1 * count++);
453447
defaultMassesListTextFlow.getChildren().add(massText);
454448
}
449+
// pad
450+
Label padLabel = new Label(" ");
451+
padLabel.setTranslateX(1 * count++);
452+
defaultMassesListTextFlow.getChildren().add(padLabel);
455453
}
456454

457455
private void populateRatios() {
@@ -491,11 +489,8 @@ private void populateRatios() {
491489
public static StackPane makeMassStackPane(String massName, String color) {
492490
Text massText = new Text(massName);
493491
massText.setFont(new Font("Monospaced Bold", 12));
494-
// if (massName.compareTo(DEFAULT_BACKGROUND_MASS_LABEL) == 0) {
495-
// massText.setFill(Paint.valueOf("red"));
496-
// }
497492

498-
Shape circle = new Ellipse(15, 15, 20, 14);
493+
Shape circle = new Ellipse(15, 15, 20, 13);
499494
circle.setFill(Paint.valueOf(color));
500495
circle.setStroke(Paint.valueOf("black"));
501496
circle.setStrokeWidth(1);

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

+25-20
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import javafx.scene.control.MenuItem;
3131
import javafx.scene.control.RadioButton;
3232
import javafx.scene.control.ScrollPane;
33+
import javafx.scene.control.SplitPane;
3334
import javafx.scene.control.TextArea;
3435
import javafx.scene.control.TextField;
3536
import javafx.scene.control.ToggleGroup;
@@ -151,6 +152,16 @@ public class TaskFolderBrowserController implements Initializable {
151152
@Override
152153
public void initialize(URL url, ResourceBundle rb) {
153154
populateListOfTasks();
155+
156+
taskListAnchorPane.prefHeightProperty().bind(taskListScrollPane.heightProperty());
157+
taskListAnchorPane.prefWidthProperty().bind(taskListScrollPane.widthProperty());
158+
listViewOfTasksInFolder.prefHeightProperty().bind(taskListAnchorPane.prefHeightProperty());
159+
listViewOfTasksInFolder.prefWidthProperty().bind(taskListAnchorPane.prefWidthProperty());
160+
161+
taskDetailAnchorPane.prefHeightProperty().bind(taskScrollPane.heightProperty());
162+
taskDetailAnchorPane.prefWidthProperty().bind(taskScrollPane.widthProperty());
163+
taskManagerGridPane.prefHeightProperty().bind(taskDetailAnchorPane.heightProperty());
164+
taskManagerGridPane.prefWidthProperty().bind(taskDetailAnchorPane.widthProperty());
154165
}
155166

156167
private void populateListOfTasks() {
@@ -252,7 +263,7 @@ public boolean accept(File file, String name) {
252263
SquidMessageDialog.showWarningDialog("No valid Squid2.5 tasks found.", primaryStageWindow);
253264
nameOfTasksFolderLabel.setText("No Valid Squid2.5 Tasks Selected");
254265
}
255-
266+
256267
editTaskButton.setDisable(true);
257268
replaceTaskButton.setDisable(true);
258269
saveTaskButton.setDisable(true);
@@ -318,15 +329,15 @@ public void changed(ObservableValue<? extends TaskInterface> observable, TaskInt
318329

319330
taskListAnchorPane.getChildren().add(listViewOfTasksInFolder);
320331

321-
taskListAnchorPane.prefHeightProperty().bind(taskListScrollPane.heightProperty());
322-
taskListAnchorPane.prefWidthProperty().bind(taskListScrollPane.widthProperty());
323-
listViewOfTasksInFolder.prefHeightProperty().bind(taskListAnchorPane.prefHeightProperty());
324-
listViewOfTasksInFolder.prefWidthProperty().bind(taskListAnchorPane.prefWidthProperty());
325-
326-
taskDetailAnchorPane.prefHeightProperty().bind(taskScrollPane.heightProperty());
327-
taskDetailAnchorPane.prefWidthProperty().bind(taskScrollPane.widthProperty());
328-
taskManagerGridPane.prefHeightProperty().bind(taskDetailAnchorPane.heightProperty());
329-
taskManagerGridPane.prefWidthProperty().bind(taskDetailAnchorPane.widthProperty());
332+
// taskListAnchorPane.prefHeightProperty().bind(taskListScrollPane.heightProperty());
333+
// taskListAnchorPane.prefWidthProperty().bind(taskListScrollPane.widthProperty());
334+
// listViewOfTasksInFolder.prefHeightProperty().bind(taskListAnchorPane.prefHeightProperty());
335+
// listViewOfTasksInFolder.prefWidthProperty().bind(taskListAnchorPane.prefWidthProperty());
336+
//
337+
// taskDetailAnchorPane.prefHeightProperty().bind(taskScrollPane.heightProperty());
338+
// taskDetailAnchorPane.prefWidthProperty().bind(taskScrollPane.widthProperty());
339+
// taskManagerGridPane.prefHeightProperty().bind(taskDetailAnchorPane.heightProperty());
340+
// taskManagerGridPane.prefWidthProperty().bind(taskDetailAnchorPane.widthProperty());
330341
}
331342
}
332343

@@ -361,12 +372,6 @@ private void populateMasses(TaskInterface task) {
361372

362373
Collections.sort(allMasses, new IntuitiveStringComparator<>());
363374

364-
// allMasses.remove(DEFAULT_BACKGROUND_MASS_LABEL);
365-
// if (task.getIndexOfBackgroundSpecies() >= 0) {
366-
// allMasses.add((allMasses.size() > task.getIndexOfBackgroundSpecies()
367-
// ? task.getIndexOfBackgroundSpecies() : allMasses.size()),
368-
// DEFAULT_BACKGROUND_MASS_LABEL);
369-
// }
370375
int count = 1;
371376
for (String mass : allMasses) {
372377
StackPane massText;
@@ -377,14 +382,14 @@ private void populateMasses(TaskInterface task) {
377382
} else {
378383
massText = makeMassStackPane(mass, "white");
379384

380-
// if (REQUIRED_NOMINAL_MASSES.contains(mass)) {
381-
// massText = TaskEditorController.makeMassStackPane(mass, "pink");
382-
// } else {
383-
// massText = TaskEditorController.makeMassStackPane(mass, "white");
384385
}
385386
massText.setTranslateX(1 * count++);
386387
defaultMassesListTextFlow.getChildren().add(massText);
387388
}
389+
// pad
390+
Label padLabel = new Label(" ");
391+
padLabel.setTranslateX(1 * count++);
392+
defaultMassesListTextFlow.getChildren().add(padLabel);
388393
}
389394

390395
private void populateRatios(TaskInterface task) {

squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/plots/plotControllers/PlotsController.java

+6
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ public void showExcludedSpots(boolean doShow) {
150150
plot.setProperty(SHOW_UNINCLUDED.getTitle(), doShow);
151151
}
152152

153+
@Override
154+
public double getTaskParameterExtPErrU() {
155+
return ((Task) squidProject.getTask()).getExtPErrU();
156+
}
157+
158+
153159
public static enum PlotTypes {
154160
CONCORDIA("CONCORDIA"),
155161
TERA_WASSERBURG("TERA_WASSERBURG"),

squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/plots/squid/PlotRefreshInterface.java

+1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ public interface PlotRefreshInterface {
2929
public void setXAxisExpressionName(String xAxisExpressionName);
3030
public void setYAxisExpressionName(String yAxisExpressionName);
3131
public void showExcludedSpots(boolean doShow);
32+
public double getTaskParameterExtPErrU();
3233
}

squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/plots/squid/WeightedMeanPlot.java

+19-8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import org.cirdles.squid.gui.dateInterpretations.plots.plotControllers.PlotsController;
5050
import static org.cirdles.squid.gui.utilities.stringUtilities.StringTester.stringIsSquidRatio;
5151
import org.cirdles.squid.shrimp.ShrimpFractionExpressionInterface;
52+
import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.MIN_206PB238U_EXT_1SIGMA_ERR_PCT;
5253
import org.cirdles.squid.tasks.expressions.spots.SpotSummaryDetails;
5354
import static org.cirdles.squid.utilities.conversionUtilities.RoundingUtilities.squid3RoundedToSize;
5455

@@ -325,15 +326,15 @@ public void paint(GraphicsContext g2d) {
325326

326327
g2d.setFill(Paint.valueOf("RED"));
327328

328-
g2d.fillText(plotTitle
329-
+ (referenceMaterialAge > 0.0 ? " (" +new BigDecimal(referenceMaterialAge).movePointLeft(6).toBigInteger().toString()
330-
+ " Ma)" : ""), 45, 45);
329+
g2d.fillText(plotTitle
330+
+ (referenceMaterialAge > 0.0 ? " (" + new BigDecimal(referenceMaterialAge).movePointLeft(6).toBigInteger().toString()
331+
+ " Ma)" : ""), 45, 45);
331332

332333
g2d.setFill(Paint.valueOf("RED"));
333334

334335
Text text = new Text();
335336
text.setFont(Font.font("SansSerif", 15));
336-
int rightOfText = 450;
337+
int rightOfText = 275;
337338
int textWidth = 0;
338339
int widthOffset = 10;
339340
int currentTextHeightPixels = 75;
@@ -392,21 +393,31 @@ public void paint(GraphicsContext g2d) {
392393
g2d.fillText(String.valueOf(countOfIncluded) + " of " + String.valueOf(shrimpFractions.size()), rightOfText + widthOffset, currentTextHeightPixels);
393394

394395
} else {
395-
396+
// Reference Materials WM
396397
text.setText("Wtd Mean of Ref Mat Pb/" + ((String) (ageOrValueLookupString.contains("Th") ? "Th" : "U")) + " calibr.");
397398
textWidth = (int) text.getLayoutBounds().getWidth();
398399
g2d.fillText(text.getText(), rightOfText - textWidth, currentTextHeightPixels);
399400
g2d.fillText(Double.toString(weightedMeanStats[0]), rightOfText + widthOffset, currentTextHeightPixels);
400401

401-
text.setText("1%\u03C3 error of mean");
402+
text.setText("1\u03C3 error of mean (%)");
402403
textWidth = (int) text.getLayoutBounds().getWidth();
403404
g2d.fillText(text.getText(), rightOfText - textWidth, currentTextHeightPixels += heightOffset);
404405
g2d.fillText(Double.toString(weightedMeanStats[2] / weightedMeanStats[0] * 100.0), rightOfText + widthOffset, currentTextHeightPixels);
405406

406-
text.setText("1\u03C3 external spot-to-spot error");
407+
text.setText("1\u03C3 external spot-to-spot error (%)");
407408
textWidth = (int) text.getLayoutBounds().getWidth();
408409
g2d.fillText(text.getText(), rightOfText - textWidth, currentTextHeightPixels += heightOffset);
409-
g2d.fillText(Double.toString(weightedMeanStats[1] / weightedMeanStats[0] * 100.0), rightOfText + widthOffset, currentTextHeightPixels);
410+
double min206238ExtOneSigmaPct = weightedMeanRefreshInterface.getTaskParameterExtPErrU();
411+
if (weightedMeanStats[6] == 0.0) {
412+
g2d.fillText(Double.toString(min206238ExtOneSigmaPct) + " (1\u03C3 ext error = 0.0 %)", rightOfText + widthOffset, currentTextHeightPixels);
413+
} else {
414+
double externalSpotToSpotError = weightedMeanStats[1] / weightedMeanStats[0] * 100.0;
415+
if (min206238ExtOneSigmaPct > externalSpotToSpotError) {
416+
g2d.fillText(Double.toString(min206238ExtOneSigmaPct) + " (1\u03C3 ext error = " + externalSpotToSpotError + " %)", rightOfText + widthOffset, currentTextHeightPixels);
417+
} else {
418+
g2d.fillText(Double.toString(externalSpotToSpotError) + " (min 1\u03C3 ext error = " + min206238ExtOneSigmaPct + " %)", rightOfText + widthOffset, currentTextHeightPixels);
419+
}
420+
}
410421

411422
text.setText("MSWD");
412423
textWidth = (int) text.getLayoutBounds().getWidth();

squidApp/src/main/java/org/cirdles/squid/gui/squidReportTable/SquidReportSettingsController.java

+30-31
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
import static org.cirdles.squid.constants.Squid3Constants.ABS_UNCERTAINTY_DIRECTIVE;
6161
import org.cirdles.squid.constants.Squid3Constants.SpotTypes;
62+
import org.cirdles.squid.exceptions.SquidException;
6263
import static org.cirdles.squid.gui.SquidUI.*;
6364
import static org.cirdles.squid.gui.SquidUIController.*;
6465
import static org.cirdles.squid.squidReports.squidReportTables.SquidReportTable.NAME_OF_WEIGHTEDMEAN_PLOT_SORT_REPORT;
@@ -295,6 +296,7 @@ public SquidReportTableInterface fromString(String string) {
295296
task.setSelectedUnknownReportModel(selectedUnknownReportModel);
296297
// makeDefaultButton.setDisable(isDefaultLab.get());// selectedUnknownReportModel.isDefault() || selectedUnknownReportModel.amWeightedMeanPlotAndSortReport() || !saveButton.isDisabled());
297298
}
299+
processButtons();
298300

299301
}
300302
});
@@ -306,10 +308,10 @@ private void selectSquidReportTableByPriors() {
306308
SquidReportTableInterface selectedReportModel = (isRefMat) ? selectedRefMatReportModel : selectedUnknownReportModel;
307309
SquidReportTableInterface defaultReportModel = (isRefMat) ? Task.squidLabData.getDefaultReportTableRM() : Task.squidLabData.getDefaultReportTable();
308310

309-
if (defaultReportModel != null) {
310-
reportTableCB.getSelectionModel().select(defaultReportModel);
311-
} else if (selectedReportModel != null) {
311+
if (selectedReportModel != null) {
312312
reportTableCB.getSelectionModel().select(selectedReportModel);
313+
} else if (defaultReportModel != null) {
314+
reportTableCB.getSelectionModel().select(defaultReportModel);
313315
} else {
314316
reportTableCB.getSelectionModel().selectFirst();
315317
}
@@ -321,7 +323,8 @@ private void selectSquidReportTableByPriors() {
321323
}
322324

323325
private void populateSquidReportTableChoiceBox() {
324-
reportTableCB.getItems().setAll(FXCollections.observableArrayList(getTables()));
326+
List<SquidReportTableInterface> tables = getTables();
327+
reportTableCB.getItems().setAll(FXCollections.observableArrayList(tables));
325328
}
326329

327330
private void initListViews() {
@@ -1011,35 +1014,29 @@ private List<SquidReportTableInterface> getTables() {
10111014
? task.getSquidReportTablesRefMat()
10121015
: task.getSquidReportTablesUnknown();
10131016

1014-
// remove labdatadefault
1015-
SquidReportTableInterface saveTable = null;
1016-
for (SquidReportTableInterface table : tables) {
1017-
if (table.getReportTableName().compareTo(NAME_OF_WEIGHTEDMEAN_PLOT_SORT_REPORT) == 0) {
1018-
table.setIsLabDataDefault(false);
1017+
SquidReportTableInterface defaultLabDataRT;
1018+
if (isRefMat) {
1019+
defaultLabDataRT = Task.squidLabData.getDefaultReportTableRM();
1020+
} else {
1021+
defaultLabDataRT = Task.squidLabData.getDefaultReportTable();
1022+
// backwards fix
1023+
if (defaultLabDataRT.getReportTableName().toUpperCase().startsWith("BUILTIN")) {
1024+
defaultLabDataRT = null;
1025+
Task.squidLabData.setDefaultReportTable(null);
10191026
}
1027+
}
1028+
1029+
for (SquidReportTableInterface table : tables) {
10201030
if (table.isIsLabDataDefault()) {
1021-
saveTable = table;
1031+
table.setIsBuiltInSquidDefault(false);
10221032
}
1033+
table.setIsLabDataDefault(false);
10231034
}
10241035

1025-
SquidReportTableInterface defaultRT;
1026-
if (isRefMat) {
1027-
defaultRT = Task.squidLabData.getDefaultReportTableRM();
1028-
} else {
1029-
defaultRT = Task.squidLabData.getDefaultReportTable();
1030-
}
1031-
if (saveTable != null) {
1032-
if (defaultRT != null) {
1033-
if (saveTable.getReportTableName().compareToIgnoreCase(defaultRT.getReportTableName()) != 0) {
1034-
saveTable.setIsLabDataDefault(false);
1035-
tables.remove(saveTable);
1036-
tables.remove(defaultRT);
1037-
tables.add(defaultRT);
1038-
}
1039-
}
1040-
} else if (defaultRT != null) {
1041-
tables.remove(defaultRT);
1042-
tables.add(defaultRT);
1036+
if (defaultLabDataRT != null) {
1037+
defaultLabDataRT.setIsLabDataDefault(true);
1038+
tables.remove(defaultLabDataRT);
1039+
tables.add(defaultLabDataRT);
10431040
}
10441041

10451042
// clean tables
@@ -1056,8 +1053,8 @@ private SquidReportTableInterface createCopyOfUpdatedSquidReportTable() {
10561053
LinkedList<SquidReportCategoryInterface> cats = new LinkedList<>();
10571054
categoryListView.getItems().forEach(cat -> cats.add(cat.clone()));
10581055
table.setReportCategories(cats);
1059-
table.setIsDefault(false);
1060-
//table.setIsLabDataDefault(false);
1056+
table.setIsBuiltInSquidDefault(false);
1057+
table.setIsLabDataDefault(false);
10611058

10621059
return table;
10631060
}
@@ -1115,6 +1112,7 @@ private void copyOnAction(ActionEvent event) {
11151112
SquidReportTableInterface copy = createCopyOfUpdatedSquidReportTable();
11161113
copy.setReportTableName(name);
11171114
copy.setIsLabDataDefault(false);
1115+
copy.setIsBuiltInSquidDefault(false);
11181116
getTables().add(copy);
11191117
populateSquidReportTableChoiceBox();
11201118
reportTableCB.getSelectionModel().select(copy);
@@ -1301,7 +1299,8 @@ private void saveOnAction(ActionEvent event) {
13011299
if (squidProject != null) {
13021300
try {
13031301
ProjectFileUtilities.serializeSquidProject(squidProject, squidPersistentState.getMRUProjectFile().getCanonicalPath());
1304-
} catch (IOException iOException) {
1302+
} catch (IOException | SquidException ex) {
1303+
SquidMessageDialog.showWarningDialog(ex.getMessage(), null);
13051304
}
13061305
}
13071306
}

squidApp/src/main/java/org/cirdles/squid/gui/utilities/fileUtilities/FileHandler.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
import java.util.ArrayList;
3838
import java.util.List;
3939
import java.util.Locale;
40+
import java.util.logging.Level;
41+
import java.util.logging.Logger;
42+
import org.cirdles.squid.dialogs.SquidMessageDialog;
4043

4144
import static org.cirdles.squid.gui.SquidUIController.squidPersistentState;
4245
import org.cirdles.squid.tasks.TaskInterface;
@@ -85,7 +88,11 @@ public static File saveProjectFile(SquidProject squidProject, Window ownerWindow
8588
retVal = projectFileNew;
8689
// capture squid project file name from file for project itself
8790
squidProject.setProjectName(projectFileNew.getName().substring(0, projectFileNew.getName().lastIndexOf(".")));
88-
ProjectFileUtilities.serializeSquidProject(squidProject, projectFileNew.getCanonicalPath());
91+
try {
92+
ProjectFileUtilities.serializeSquidProject(squidProject, projectFileNew.getCanonicalPath());
93+
} catch (IOException | SquidException ex) {
94+
SquidMessageDialog.showWarningDialog(ex.getMessage(), null);
95+
}
8996
}
9097

9198
return retVal;

0 commit comments

Comments
 (0)