Minor improvements in AccountviewController.java
This commit is contained in:
@@ -14,7 +14,6 @@ import javafx.stage.Stage;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -138,7 +137,6 @@ public class AccountviewController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onShowAll() {
|
private void onShowAll() {
|
||||||
System.out.println(this.privateBank.getTransactions(currentAccount));
|
|
||||||
showTransactions(this.privateBank.getTransactions(currentAccount));
|
showTransactions(this.privateBank.getTransactions(currentAccount));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,10 +146,6 @@ public class AccountviewController {
|
|||||||
* @param transactions
|
* @param transactions
|
||||||
*/
|
*/
|
||||||
private void showTransactions(List<Transaction> transactions) {
|
private void showTransactions(List<Transaction> transactions) {
|
||||||
List<String> displayList = new ArrayList<>();
|
|
||||||
for (Transaction t : transactions)
|
|
||||||
displayList.add(t.toString());
|
|
||||||
|
|
||||||
transactionListView.getItems().setAll(transactions);
|
transactionListView.getItems().setAll(transactions);
|
||||||
updateAccountInfo(); // Balance neu anzeigen, falls sich was geändert hat
|
updateAccountInfo(); // Balance neu anzeigen, falls sich was geändert hat
|
||||||
}
|
}
|
||||||
@@ -167,7 +161,7 @@ public class AccountviewController {
|
|||||||
|
|
||||||
alert.getButtonTypes().setAll(yesButton, noButton);
|
alert.getButtonTypes().setAll(yesButton, noButton);
|
||||||
|
|
||||||
var result = alert.showAndWait();
|
Optional<ButtonType> result = alert.showAndWait();
|
||||||
return result.isPresent() && result.get() == yesButton;
|
return result.isPresent() && result.get() == yesButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,10 +171,10 @@ public class AccountviewController {
|
|||||||
String desc = descriptionField.getText().trim();
|
String desc = descriptionField.getText().trim();
|
||||||
|
|
||||||
// Basis-Checks
|
// Basis-Checks
|
||||||
if (desc.isEmpty()) return false;
|
if (desc.isEmpty())
|
||||||
double amount;
|
return false;
|
||||||
try {
|
try {
|
||||||
amount = Double.parseDouble(amountStr);
|
double amount = Double.parseDouble(amountStr);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user