From fd9ae31f5ecf69e214ba335834bca67dd1519265 Mon Sep 17 00:00:00 2001 From: Chomusuke Date: Thu, 13 Apr 2023 10:30:04 +0200 Subject: [PATCH] Code reorganization --- src/main/java/com/Chomusuke/Accountable.java | 10 ++++---- .../gui/element/tile/TransactionTile.java | 3 ++- .../com/Chomusuke/gui/pane/AccountPane.java | 15 ++++++------ .../Chomusuke/gui/pane/TransactionPane.java | 23 ++++++++++--------- .../Chomusuke/gui/popup/AddAccountScreen.java | 13 ++++++----- .../gui/popup/AddTransactionScreen.java | 12 +++++----- .../java/com/Chomusuke/logic/Storage.java | 4 ++-- 7 files changed, 42 insertions(+), 38 deletions(-) diff --git a/src/main/java/com/Chomusuke/Accountable.java b/src/main/java/com/Chomusuke/Accountable.java index a8e36fe..6705e27 100755 --- a/src/main/java/com/Chomusuke/Accountable.java +++ b/src/main/java/com/Chomusuke/Accountable.java @@ -19,11 +19,6 @@ import java.util.*; -import com.chomusuke.gui.pane.AccountPane; -import com.chomusuke.gui.pane.TransactionPane; -import com.chomusuke.gui.popup.AddAccountScreen; -import com.chomusuke.gui.popup.AddTransactionScreen; -import com.chomusuke.util.Time; import javafx.application.Application; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; @@ -40,6 +35,11 @@ import javafx.scene.layout.Pane; import javafx.stage.Stage; +import com.chomusuke.gui.pane.AccountPane; +import com.chomusuke.gui.pane.TransactionPane; +import com.chomusuke.gui.popup.AddAccountScreen; +import com.chomusuke.gui.popup.AddTransactionScreen; +import com.chomusuke.util.Time; import com.chomusuke.logic.*; /** diff --git a/src/main/java/com/Chomusuke/gui/element/tile/TransactionTile.java b/src/main/java/com/Chomusuke/gui/element/tile/TransactionTile.java index 9f299ba..61c7ead 100644 --- a/src/main/java/com/Chomusuke/gui/element/tile/TransactionTile.java +++ b/src/main/java/com/Chomusuke/gui/element/tile/TransactionTile.java @@ -17,9 +17,10 @@ package com.chomusuke.gui.element.tile; -import com.chomusuke.logic.Transaction; import javafx.scene.paint.Color; +import com.chomusuke.logic.Transaction; + /** * Provides a JavaFX Node that represents a transaction. */ diff --git a/src/main/java/com/Chomusuke/gui/pane/AccountPane.java b/src/main/java/com/Chomusuke/gui/pane/AccountPane.java index 42e87e0..136cd3c 100644 --- a/src/main/java/com/Chomusuke/gui/pane/AccountPane.java +++ b/src/main/java/com/Chomusuke/gui/pane/AccountPane.java @@ -17,12 +17,8 @@ package com.chomusuke.gui.pane; -import com.chomusuke.Accountable.SceneID; -import com.chomusuke.gui.element.PlusButton; -import com.chomusuke.gui.element.tile.AccountTile; -import com.chomusuke.gui.popup.AddAccountScreen; -import com.chomusuke.logic.Account; -import com.chomusuke.logic.TransactionList; +import java.util.Map; + import javafx.beans.property.ObjectProperty; import javafx.geometry.Insets; import javafx.scene.control.Button; @@ -30,7 +26,12 @@ import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; -import java.util.Map; +import com.chomusuke.Accountable.SceneID; +import com.chomusuke.gui.element.PlusButton; +import com.chomusuke.gui.element.tile.AccountTile; +import com.chomusuke.gui.popup.AddAccountScreen; +import com.chomusuke.logic.Account; +import com.chomusuke.logic.TransactionList; /** * Provides a JavaFX pane containing account information. diff --git a/src/main/java/com/Chomusuke/gui/pane/TransactionPane.java b/src/main/java/com/Chomusuke/gui/pane/TransactionPane.java index 659f4f8..37398e0 100644 --- a/src/main/java/com/Chomusuke/gui/pane/TransactionPane.java +++ b/src/main/java/com/Chomusuke/gui/pane/TransactionPane.java @@ -17,16 +17,8 @@ package com.chomusuke.gui.pane; -import com.chomusuke.Accountable.SceneID; -import com.chomusuke.gui.element.DateSelector; -import com.chomusuke.gui.element.PlusButton; -import com.chomusuke.gui.element.SquareButton; -import com.chomusuke.gui.element.tile.TransactionTile; -import com.chomusuke.gui.popup.AddFileScreen; -import com.chomusuke.gui.popup.AddTransactionScreen; -import com.chomusuke.logic.Account; -import com.chomusuke.logic.Transaction; -import com.chomusuke.logic.TransactionList; +import java.util.*; + import javafx.beans.property.ObjectProperty; import javafx.beans.property.StringProperty; import javafx.collections.ListChangeListener; @@ -41,7 +33,16 @@ import javafx.scene.paint.Color; import javafx.scene.text.Text; -import java.util.*; +import com.chomusuke.Accountable.SceneID; +import com.chomusuke.gui.element.DateSelector; +import com.chomusuke.gui.element.PlusButton; +import com.chomusuke.gui.element.SquareButton; +import com.chomusuke.gui.element.tile.TransactionTile; +import com.chomusuke.gui.popup.AddFileScreen; +import com.chomusuke.gui.popup.AddTransactionScreen; +import com.chomusuke.logic.Account; +import com.chomusuke.logic.Transaction; +import com.chomusuke.logic.TransactionList; public class TransactionPane extends BorderPane{ diff --git a/src/main/java/com/Chomusuke/gui/popup/AddAccountScreen.java b/src/main/java/com/Chomusuke/gui/popup/AddAccountScreen.java index c82a391..dc51189 100644 --- a/src/main/java/com/Chomusuke/gui/popup/AddAccountScreen.java +++ b/src/main/java/com/Chomusuke/gui/popup/AddAccountScreen.java @@ -17,16 +17,17 @@ package com.chomusuke.gui.popup; -import com.chomusuke.logic.Account; -import com.chomusuke.logic.Storage; -import com.chomusuke.logic.Transaction; -import com.chomusuke.logic.TransactionList; +import java.util.Map; +import java.util.Random; + import javafx.scene.control.TextField; import javafx.scene.control.TextFormatter; import javafx.scene.layout.HBox; -import java.util.Map; -import java.util.Random; +import com.chomusuke.logic.Account; +import com.chomusuke.logic.Storage; +import com.chomusuke.logic.Transaction; +import com.chomusuke.logic.TransactionList; /** * This class provides a JavaFX stage used to add an account. diff --git a/src/main/java/com/Chomusuke/gui/popup/AddTransactionScreen.java b/src/main/java/com/Chomusuke/gui/popup/AddTransactionScreen.java index 9e839cf..aedf6be 100644 --- a/src/main/java/com/Chomusuke/gui/popup/AddTransactionScreen.java +++ b/src/main/java/com/Chomusuke/gui/popup/AddTransactionScreen.java @@ -17,7 +17,11 @@ package com.chomusuke.gui.popup; -import com.chomusuke.logic.Account; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + import javafx.collections.FXCollections; import javafx.scene.control.ChoiceBox; import javafx.scene.control.TextField; @@ -26,14 +30,10 @@ import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; +import com.chomusuke.logic.Account; import com.chomusuke.logic.Transaction; import com.chomusuke.logic.TransactionList; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - import static com.chomusuke.logic.Transaction.*; /** diff --git a/src/main/java/com/Chomusuke/logic/Storage.java b/src/main/java/com/Chomusuke/logic/Storage.java index 5ae73dd..e23571c 100644 --- a/src/main/java/com/Chomusuke/logic/Storage.java +++ b/src/main/java/com/Chomusuke/logic/Storage.java @@ -17,14 +17,14 @@ package com.chomusuke.logic; -import com.chomusuke.util.Preconditions; - import java.io.*; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.Path; import java.util.*; +import com.chomusuke.util.Preconditions; + import static com.chomusuke.logic.Transaction.TransactionType; import static com.chomusuke.logic.Transaction.ValueType;