Skip to content

Commit

Permalink
Merge pull request #167 from Team-40-IDATT2003/166-fix-compilation-error
Browse files Browse the repository at this point in the history
Fix: Fixed compilation error
  • Loading branch information
etsorens authored May 27, 2026
2 parents 7da8b3e + 885249f commit 71d742c
Showing 1 changed file with 0 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -726,65 +726,4 @@ public void showTransactionReport(final String title,
dialogPane.setContent(container);
dialog.showAndWait();
}

/**
* Displays a clean transaction report pop-up detailing the financial breakdown.
*
* @param title The title of the dialog box
* (e.g., "Purchase Confirmed").
* @param symbol The stock ticker symbol.
* @param qty The amount of shares processed.
* @param gross The gross value of the transaction.
* @param commission The commission fee charged.
* @param tax The capital gains tax charged.
* @param total The net total amount.
* @param errorMessage Optional error message if transaction did not
* succesfully commit.
*/
public void showTransactionReport(final String title,
final String symbol,
final float qty,
final float gross,
final float commission,
final float tax,
final float total,
final String errorMessage) {
Dialog<Void> dialog = new Dialog<>();
dialog.setTitle(title);

DialogPane dialogPane = dialog.getDialogPane();
dialogPane.getButtonTypes().add(ButtonType.CLOSE);

//NOTE: Requires hard coding styling due to DialogPane behavior.
VBox container = new VBox(10);
container.setStyle("-fx-padding: 20; -fx-min-width: 320;");

if (errorMessage != null && !errorMessage.isEmpty()) {
Label errorLabel = new Label(errorMessage);
errorLabel.setStyle("-fx-text-fill: red; -fx-font-weight: bold; -fx-font-size: 14px;");
container.getChildren().add(errorLabel);
} else {
Label headerLabel = new Label(symbol + " Transaction Summary");
headerLabel.setStyle("-fx-font-weight: bold; -fx-font-size: 14px;");
container.getChildren().addAll(headerLabel, new Separator());

String[][] rows = {
{"Quantity:", String.format("%.3f", qty)},
{"Gross:", String.format("%.2f NOK", gross)},
{"Tax:", String.format("%.2f NOK", tax)},
{"Commission fee:", String.format("%.2f NOK", commission)},
{"Total:", String.format("%.2f NOK", total)}
};

for (String[] rowData : rows) {
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
HBox row = new HBox(new Label(rowData[0]), spacer, new Label(rowData[1]));
container.getChildren().add(row);
}
}

dialogPane.setContent(container);
dialog.showAndWait();
}
}

0 comments on commit 71d742c

Please sign in to comment.