Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
artoonie committed Jun 6, 2024
1 parent 82c25a1 commit db9a51a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ private void openTabulateWindow() {
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Tabulate");
window.initOwner(GuiContext.getInstance().getMainWindow());
window.resizableProperty().setValue(Boolean.FALSE);

String resourcePath = "/network/brightspots/rcv/GuiTabulationPopup.fxml";
try {
Expand Down
21 changes: 8 additions & 13 deletions src/main/java/network/brightspots/rcv/GuiTabulateController.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public class GuiTabulateController {
/** The style applied when a required field is unfilled and requires user input. */
private String unfilledFieldStyle;

/** If the last task failed. */
private boolean lastTaskFailed = false;
/** If the last task succeeded. */
private boolean lastTaskSucceeded = false;

/** Last-loaded CVR metadata, with the CVRs themselves discarded from memory. */
private LoadedCvrData lastLoadedCvrData;
Expand All @@ -78,7 +78,6 @@ public class GuiTabulateController {
@FXML private Button tempSaveButton;
@FXML private Label numberOfCandidates;
@FXML private Label numberOfCvrFiles;
@FXML private Label numberOfBallots;
@FXML private TextField userNameField;
@FXML private ProgressBar progressBar;
@FXML private Button loadCvrButton;
Expand All @@ -91,8 +90,6 @@ public void initialize(GuiConfigController controller, int numCandidates, int nu
guiConfigController = controller;
numberOfCandidates.setText("Number of Candidates: " + numCandidates);
numberOfCvrFiles.setText("Number of CVR Files: " + numCvrs);
numberOfBallots.setText("Number of Ballots: <Awaiting count>");
numberOfBallots.setOpacity(0.5);
filledFieldStyle = "";
unfilledFieldStyle = "-fx-border-color: red;";

Expand Down Expand Up @@ -124,8 +121,7 @@ public void buttonLoadCvrsClicked(ActionEvent actionEvent) {
String configPath = getConfigPathOrCreateTempFile();

enableButtonsUpTo(null);
numberOfBallots.setText("Number of Ballots: <Counting...>");
numberOfBallots.setOpacity(0.5);
tabulateButton.setText("Tabulate");
Service<LoadedCvrData> service = guiConfigController.parseAndCountCastVoteRecords(configPath);

watchParseCvrServiceProgress(service);
Expand Down Expand Up @@ -155,7 +151,7 @@ public void buttonTabulateClicked(ActionEvent actionEvent) {
* @param actionEvent ignored
*/
public void buttonOpenResultsClicked(ActionEvent actionEvent) {
if (lastTaskFailed) {
if (lastTaskSucceeded) {
openOutputDirectoryInFileExplorer();
} else {
// Close the window
Expand All @@ -175,11 +171,11 @@ private void watchTabulatorServiceProgress(Service<Boolean> service) {

EventHandler<WorkerStateEvent> onSucceededEvent =
workerStateEvent -> {
lastTaskFailed = service.getValue();
if (lastTaskFailed) {
lastTaskSucceeded = service.getValue();
if (lastTaskSucceeded) {
openResultsButton.setText("Open Results Folder");
} else {
openResultsButton.setText("View Error Logs");
openResultsButton.setText("Close and View Logs");
}
enableButtonsUpTo(openResultsButton);
stage.setOnCloseRequest(null);
Expand All @@ -194,8 +190,7 @@ private void watchParseCvrServiceProgress(Service<LoadedCvrData> service) {
workerStateEvent -> {
enableButtonsUpTo(tabulateButton);
LoadedCvrData data = service.getValue();
numberOfBallots.setText("Number of Ballots: " + String.format("%,d", data.numCvrs()));
numberOfBallots.setOpacity(1);
tabulateButton.setText("Tabulate " + String.format("%,d", data.numCvrs()) + " ballots");
data.discard();
lastLoadedCvrData = data;
};
Expand Down
1 change: 1 addition & 0 deletions src/main/java/network/brightspots/rcv/Tiebreak.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ public GuiTiebreakerPromptResponse call() {
final Stage window = new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("RCV Tiebreaker");
window.setResizable(false);
String resourcePath = "/network/brightspots/rcv/GuiTiebreakerLayout.fxml";
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource(resourcePath));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@
<Insets left="15.0" />
</VBox.margin>
</Label>
<Label fx:id="numberOfBallots" prefHeight="24.0" prefWidth="349.0" text="Number of Ballots: Y" wrapText="true">
<font>
<Font size="16.0" />
</font>
<VBox.margin>
<Insets left="15.0" />
</VBox.margin>
</Label>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Auditing Information" wrappingWidth="225.1533203125">
<font>
<Font name="System Bold" size="19.0" />
Expand Down

0 comments on commit db9a51a

Please sign in to comment.