Make positioning of category and vendor in transaction tile consistent.

This commit is contained in:
Andrew Lalis 2024-02-08 11:33:46 -05:00
parent 5c1036b72f
commit cc83e3eb0f
1 changed files with 5 additions and 3 deletions

View File

@ -104,14 +104,16 @@ public class TransactionTile extends BorderPane {
} }
private Node getExtra(Transaction transaction) { private Node getExtra(Transaction transaction) {
VBox content = new VBox(); VBox categoryContainer = new VBox();
VBox vendorContainer = new VBox();
VBox content = new VBox(categoryContainer, vendorContainer);
if (transaction.getCategoryId() != null) { if (transaction.getCategoryId() != null) {
Profile.getCurrent().dataSource().mapRepoAsync( Profile.getCurrent().dataSource().mapRepoAsync(
TransactionCategoryRepository.class, TransactionCategoryRepository.class,
repo -> repo.findById(transaction.getCategoryId()).orElse(null) repo -> repo.findById(transaction.getCategoryId()).orElse(null)
).thenAccept(category -> { ).thenAccept(category -> {
if (category == null) return; if (category == null) return;
Platform.runLater(() -> content.getChildren().add(new CategoryLabel(category))); Platform.runLater(() -> categoryContainer.getChildren().add(new CategoryLabel(category)));
}); });
} }
if (transaction.getVendorId() != null) { if (transaction.getVendorId() != null) {
@ -120,7 +122,7 @@ public class TransactionTile extends BorderPane {
repo -> repo.findById(transaction.getVendorId()).orElse(null) repo -> repo.findById(transaction.getVendorId()).orElse(null)
).thenAccept(vendor -> { ).thenAccept(vendor -> {
if (vendor == null) return; if (vendor == null) return;
Platform.runLater(() -> content.getChildren().addLast(new Text("@ " + vendor.getName()))); Platform.runLater(() -> vendorContainer.getChildren().add(new Text("@ " + vendor.getName())));
}); });
} }
return content; return content;