From c08276abbf1dd507aa385dcb71338593e02ccfc8 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Sat, 30 Dec 2023 18:16:19 -0500 Subject: [PATCH] Cleanup. --- .../perfin/control/AccountViewController.java | 1 - .../control/ProfilesViewController.java | 1 - .../control/TransactionViewController.java | 3 +-- .../control/TransactionsViewController.java | 25 ++----------------- .../view/component/AttachmentPreview.java | 2 +- 5 files changed, 4 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/andrewlalis/perfin/control/AccountViewController.java b/src/main/java/com/andrewlalis/perfin/control/AccountViewController.java index 3b8415f..7b636e0 100644 --- a/src/main/java/com/andrewlalis/perfin/control/AccountViewController.java +++ b/src/main/java/com/andrewlalis/perfin/control/AccountViewController.java @@ -4,7 +4,6 @@ import com.andrewlalis.javafx_scene_router.RouteSelectionListener; import com.andrewlalis.perfin.data.DateUtil; import com.andrewlalis.perfin.model.Account; import com.andrewlalis.perfin.model.Profile; -import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; diff --git a/src/main/java/com/andrewlalis/perfin/control/ProfilesViewController.java b/src/main/java/com/andrewlalis/perfin/control/ProfilesViewController.java index 3fe2620..be038e7 100644 --- a/src/main/java/com/andrewlalis/perfin/control/ProfilesViewController.java +++ b/src/main/java/com/andrewlalis/perfin/control/ProfilesViewController.java @@ -8,7 +8,6 @@ import javafx.beans.property.BooleanProperty; import javafx.fxml.FXML; import javafx.scene.Node; import javafx.scene.control.Button; -import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.HBox; diff --git a/src/main/java/com/andrewlalis/perfin/control/TransactionViewController.java b/src/main/java/com/andrewlalis/perfin/control/TransactionViewController.java index 658c3b6..bde5bfd 100644 --- a/src/main/java/com/andrewlalis/perfin/control/TransactionViewController.java +++ b/src/main/java/com/andrewlalis/perfin/control/TransactionViewController.java @@ -1,6 +1,5 @@ package com.andrewlalis.perfin.control; -import com.andrewlalis.perfin.view.component.AttachmentPreview; import com.andrewlalis.perfin.data.CurrencyUtil; import com.andrewlalis.perfin.data.DateUtil; import com.andrewlalis.perfin.model.CreditAndDebitAccounts; @@ -8,6 +7,7 @@ import com.andrewlalis.perfin.model.Profile; import com.andrewlalis.perfin.model.Transaction; import com.andrewlalis.perfin.model.TransactionAttachment; import com.andrewlalis.perfin.view.BindingUtil; +import com.andrewlalis.perfin.view.component.AttachmentPreview; import javafx.application.Platform; import javafx.beans.property.SimpleListProperty; import javafx.collections.FXCollections; @@ -16,7 +16,6 @@ import javafx.fxml.FXML; import javafx.scene.control.Hyperlink; import javafx.scene.control.Label; import javafx.scene.control.ScrollPane; -import javafx.scene.control.skin.ScrollPaneSkin; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.text.TextFlow; diff --git a/src/main/java/com/andrewlalis/perfin/control/TransactionsViewController.java b/src/main/java/com/andrewlalis/perfin/control/TransactionsViewController.java index d5c864c..0ce0b0e 100644 --- a/src/main/java/com/andrewlalis/perfin/control/TransactionsViewController.java +++ b/src/main/java/com/andrewlalis/perfin/control/TransactionsViewController.java @@ -3,13 +3,13 @@ package com.andrewlalis.perfin.control; import com.andrewlalis.javafx_scene_router.RouteSelectionListener; import com.andrewlalis.perfin.Pair; import com.andrewlalis.perfin.SceneUtil; -import com.andrewlalis.perfin.view.component.DataSourcePaginationControls; -import com.andrewlalis.perfin.view.component.TransactionTile; import com.andrewlalis.perfin.data.pagination.Page; import com.andrewlalis.perfin.data.pagination.PageRequest; import com.andrewlalis.perfin.data.pagination.Sort; import com.andrewlalis.perfin.model.Profile; import com.andrewlalis.perfin.model.Transaction; +import com.andrewlalis.perfin.view.component.DataSourcePaginationControls; +import com.andrewlalis.perfin.view.component.TransactionTile; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ObservableValue; @@ -95,25 +95,4 @@ public class TransactionsViewController implements RouteSelectionListener { tile.selected.bind(selectedTransaction.map(t -> t != null && t.getId() == transaction.getId())); return tile; } - -// private void refreshTransactions() { -// Thread.ofVirtual().start(() -> { -// Profile.getCurrent().getDataSource().useTransactionRepository(repo -> { -// var page = repo.findAll(PageRequest.unpaged(Sort.desc("timestamp"))); -// var components = page.items().stream().map(transaction -> { -// var tile = new TransactionTile(transaction, this::refreshTransactions); -// tile.setOnMouseClicked(event -> { -// if (selectedTransaction.get() == null || selectedTransaction.get().getId() != transaction.getId()) { -// selectedTransaction.set(transaction); -// } else { -// selectedTransaction.set(null); -// } -// }); -// tile.selected.bind(selectedTransaction.map(t -> t != null && t.getId() == transaction.getId())); -// return tile; -// }).toList(); -// Platform.runLater(() -> transactionsVBox.getChildren().setAll(components)); -// }); -// }); -// } } diff --git a/src/main/java/com/andrewlalis/perfin/view/component/AttachmentPreview.java b/src/main/java/com/andrewlalis/perfin/view/component/AttachmentPreview.java index 7b29a96..5624923 100644 --- a/src/main/java/com/andrewlalis/perfin/view/component/AttachmentPreview.java +++ b/src/main/java/com/andrewlalis/perfin/view/component/AttachmentPreview.java @@ -41,7 +41,7 @@ public class AttachmentPreview extends BorderPane { Image img = new Image(in, IMAGE_SIZE, IMAGE_SIZE, true, true); contentContainer.setCenter(new ImageView(img)); } catch (IOException e) { - e.printStackTrace(); + e.printStackTrace(System.err); } }