Skip to content

Fix: Fixed compilation error #167

Merged
merged 1 commit into from
May 27, 2026
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
}