Skip to content

Commit e0c864c

Browse files
authored
Fixes #39 - duplicate names bug related to switch to case-insensitive spot names. (#40)
* fixes #39
1 parent c339c45 commit e0c864c

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

common.gradle

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

88
String mavenGroupId = 'org.cirdles'
9-
String mavenVersion = '0.1.6'
9+
String mavenVersion = '0.1.7'
1010

1111

1212
sourceCompatibility = '1.8'

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

+3
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ private void saveSpotNameAction(ActionEvent event) {
276276
squidProject.generatePrefixTreeFromSpotNames();
277277
shrimpFractionList.refresh();
278278
shrimpRefMatList.refresh();
279+
280+
// refresh textbox in case "DUP" is removed or created
281+
selectedSpotNameText.setText(((PrawnFile.Run) saveSpotNameButton.getUserData()).getPar().get(0).getValue());
279282
}
280283
}
281284
}

squidApp/src/main/resources/org/cirdles/squid/gui/SpotManager.fxml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
<?import javafx.scene.control.Tooltip?>
88
<?import javafx.scene.layout.AnchorPane?>
99

10-
<AnchorPane fx:id="spotManagerPane" prefHeight="616.0" prefWidth="925.0" styleClass="backgroundCalamari" stylesheets="@css/projectManager.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.cirdles.squid.gui.SpotManagerController">
10+
<AnchorPane fx:id="spotManagerPane" prefHeight="616.0" prefWidth="925.0" styleClass="backgroundCalamari" stylesheets="@css/projectManager.css" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.cirdles.squid.gui.SpotManagerController">
1111
<children>
1212
<ListView fx:id="shrimpFractionList" layoutX="15.0" layoutY="83.0" prefHeight="468.0" prefWidth="435.0">
1313
<tooltip>
1414
<Tooltip text="Right-click spot for removal menu." />
1515
</tooltip>
1616
</ListView>
17-
<TextField fx:id="selectedSpotNameText" layoutX="142.0" layoutY="583.0" prefHeight="27.0" prefWidth="130.0" promptText="no spot selected" />
17+
<TextField fx:id="selectedSpotNameText" layoutX="142.0" layoutY="583.0" prefHeight="27.0" prefWidth="167.0" promptText="no spot selected" />
1818
<Label fx:id="headerLabel" layoutX="21.0" layoutY="60.0" prefHeight="17.0" prefWidth="428.0" text="Header label" />
1919
<Label layoutX="21.0" layoutY="33.0" text="Filter by typing spot prefix:" />
2020
<TextField fx:id="filterSpotNameText" layoutX="237.0" layoutY="34.0" onKeyReleased="#filterSpotNameKeyReleased" prefHeight="27.0" prefWidth="68.0" promptText="type here" />
@@ -23,7 +23,7 @@
2323
<Button fx:id="setFilteredSpotsAsRefMatButton" layoutX="475.0" layoutY="581.0" mnemonicParsing="false" onAction="#setFilteredSpotsToRefMatAction" prefHeight="31.0" prefWidth="435.0" text="Copy Filtered Spots to be Reference Material spots." />
2424
<Label fx:id="headerLabelRefMat" layoutX="481.0" layoutY="60.0" prefHeight="17.0" prefWidth="428.0" text="Header label" />
2525
<Label layoutX="16.0" layoutY="583.0" text="Edit Spot Name:" />
26-
<Button fx:id="saveSpotNameButton" layoutX="288.0" layoutY="581.0" mnemonicParsing="false" onAction="#saveSpotNameAction" text="Save Spot Name" />
26+
<Button fx:id="saveSpotNameButton" contentDisplay="CENTER" graphicTextGap="0.0" layoutX="312.0" layoutY="581.0" mnemonicParsing="false" onAction="#saveSpotNameAction" prefHeight="31.0" prefWidth="130.0" text="Save Name" />
2727
<Label layoutX="460.0" layoutY="3.0" prefHeight="20.0" prefWidth="366.0" text="Reference Material (RM) Spots for this Project:" />
2828
<Label layoutX="17.0" layoutY="562.0" style="-fx-font-size: 11;" text="Hint: To remove a spot or split session, right mouse-click on spot for menu." />
2929
<Label layoutX="5.0" layoutY="3.0" text="All Spots:" />

squidCore/src/main/java/org/cirdles/squid/projects/SquidProject.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.ArrayList;
2222
import java.util.HashMap;
2323
import java.util.List;
24+
import java.util.Locale;
2425
import java.util.Map;
2526
import java.util.concurrent.CopyOnWriteArrayList;
2627
import javax.xml.bind.JAXBException;
@@ -246,20 +247,22 @@ public void processPrawnSessionForDuplicateSpotNames() {
246247
List<Run> runs = prawnFile.getRun();
247248
Map<String, Integer> spotNameCountMap = new HashMap<>();
248249
for (int i = 0; i < runs.size(); i++) {
249-
String spotName = runs.get(i).getPar().get(0).getValue();
250+
String spotName = runs.get(i).getPar().get(0).getValue().trim();
251+
String spotNameKey = spotName.toUpperCase(Locale.US);
250252
// remove existing duplicate label in case editing occurred
251253
int indexDUP = spotName.indexOf("-DUP");
252254
if (indexDUP > 0) {
253255
runs.get(i).getPar().get(0).setValue(spotName.substring(0, spotName.indexOf("-DUP")));
254256
spotName = runs.get(i).getPar().get(0).getValue();
257+
spotNameKey = spotName.toUpperCase(Locale.US);
255258
}
256-
if (spotNameCountMap.containsKey(spotName)) {
257-
int count = spotNameCountMap.get(spotName);
259+
if (spotNameCountMap.containsKey(spotNameKey)) {
260+
int count = spotNameCountMap.get(spotNameKey);
258261
count++;
259-
spotNameCountMap.put(spotName, count);
262+
spotNameCountMap.put(spotNameKey, count);
260263
runs.get(i).getPar().get(0).setValue(spotName + "-DUP-" + count);
261264
} else {
262-
spotNameCountMap.put(spotName, 0);
265+
spotNameCountMap.put(spotNameKey, 0);
263266
}
264267
}
265268
}

0 commit comments

Comments
 (0)