Skip to content

Commit

Permalink
Merge pull request #78 from sp4ce-cowboy/branch-UI/sidepane
Browse files Browse the repository at this point in the history
Update GUI
  • Loading branch information
sp4ce-cowboy authored Oct 18, 2023
2 parents 78d3181 + 09b4bd9 commit 76666ed
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 39 deletions.
16 changes: 10 additions & 6 deletions src/main/java/unicash/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.logging.Logger;

import javafx.application.Application;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import unicash.commons.core.Config;
import unicash.commons.core.LogsCenter;
Expand Down Expand Up @@ -48,7 +49,7 @@ public class MainApp extends Application {

@Override
public void init() throws Exception {
logger.info("=============================[ Initializing AddressBook ]===========================");
logger.info("=============================[ Initializing UniCa$h ]===========================");

Check warning on line 52 in src/main/java/unicash/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/MainApp.java#L52

Added line #L52 was not covered by tests
super.init();

AppParameters appParameters = AppParameters.parse(getParameters());
Expand Down Expand Up @@ -81,16 +82,15 @@ private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) {
uniCashOptional = storage.readUniCash();

Check warning on line 82 in src/main/java/unicash/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/MainApp.java#L82

Added line #L82 was not covered by tests
if (uniCashOptional.isEmpty()) {
logger.info("Creating a new data file " + storage.getUniCashFilePath()

Check warning on line 84 in src/main/java/unicash/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/MainApp.java#L84

Added line #L84 was not covered by tests
+ " populated with a sample AddressBook.");
+ " populated with a sample UniCash.");
}
initialData = uniCashOptional.orElseGet(SampleDataUtil::getSampleUniCash);

Check warning on line 87 in src/main/java/unicash/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/MainApp.java#L87

Added line #L87 was not covered by tests
} catch (DataLoadingException e) {
logger.warning("Data file at " + storage.getUniCashFilePath() + " could not be loaded."

Check warning on line 89 in src/main/java/unicash/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/MainApp.java#L89

Added line #L89 was not covered by tests
+ " Will be starting with an empty AddressBook.");
+ " Will be starting with an empty UniCash.");
initialData = new UniCash();

Check warning on line 91 in src/main/java/unicash/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/MainApp.java#L91

Added line #L91 was not covered by tests
}

// TODO: Remove ModelManager first parameter
return new ModelManager(initialData, userPrefs);
}

Expand Down Expand Up @@ -171,13 +171,17 @@ protected UserPrefs initPrefs(UserPrefsStorage storage) {

@Override
public void start(Stage primaryStage) {
logger.info("Starting AddressBook " + MainApp.VERSION);
logger.info("Starting UniCash " + MainApp.VERSION);
Font.loadFont(getClass().getResourceAsStream("/fonts/Inter-Regular.ttf"), 12);
Font.loadFont(getClass().getResourceAsStream("/fonts/Inter-Medium.ttf"), 12);
Font.loadFont(getClass().getResourceAsStream("/fonts/Inter-Bold.ttf"), 12);
Font.loadFont(getClass().getResourceAsStream("/fonts/Inter-SemiBold.ttf"), 12);

Check warning on line 178 in src/main/java/unicash/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/MainApp.java#L174-L178

Added lines #L174 - L178 were not covered by tests
ui.start(primaryStage);
}

@Override
public void stop() {
logger.info("============================ [ Stopping Address Book ] =============================");
logger.info("============================ [ Stopping UniCa$h ] =============================");

Check warning on line 184 in src/main/java/unicash/MainApp.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/MainApp.java#L184

Added line #L184 was not covered by tests
try {
storage.saveUserPrefs(model.getUserPrefs());
} catch (IOException e) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/unicash/model/category/Category.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public int hashCode() {
* Format state as text for viewing.
*/
public String toString() {
return '[' + category + ']';
return category;
}

}
4 changes: 2 additions & 2 deletions src/main/java/unicash/ui/HelpWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import unicash.commons.core.LogsCenter;

/**
* Controller for a help page
* Controller for the pop-up help window
*/
public class HelpWindow extends UiPart<Stage> {

Expand Down Expand Up @@ -65,7 +65,7 @@ public HelpWindow() {
* </ul>
*/
public void show() {
logger.fine("Showing help page about the application.");
logger.fine("Showing UniCash help page.");

Check warning on line 68 in src/main/java/unicash/ui/HelpWindow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/ui/HelpWindow.java#L68

Added line #L68 was not covered by tests
getRoot().show();
getRoot().centerOnScreen();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/unicash/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class MainWindow extends UiPart<Stage> {
private MenuItem helpMenuItem;

@FXML
private StackPane personListPanelPlaceholder;
private StackPane transactionListPanelPlaceholder;

@FXML
private StackPane resultDisplayPlaceholder;
Expand Down Expand Up @@ -111,7 +111,7 @@ private void setAccelerator(MenuItem menuItem, KeyCombination keyCombination) {
*/
void fillInnerParts() {
transactionListPanel = new TransactionListPanel(logic.getFilteredTransactionList());
personListPanelPlaceholder.getChildren().add(transactionListPanel.getRoot());
transactionListPanelPlaceholder.getChildren().add(transactionListPanel.getRoot());

Check warning on line 114 in src/main/java/unicash/ui/MainWindow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/ui/MainWindow.java#L113-L114

Added lines #L113 - L114 were not covered by tests

resultDisplay = new ResultDisplay();
resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot());
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/unicash/ui/StatusBarFooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ public class StatusBarFooter extends UiPart<Region> {
private Label saveLocationStatus;

/**
* Creates a {@code StatusBarFooter} with the given {@code Path}.
* Creates a {@code StatusBarFooter} with the given {@code Path}
* indicating the current Data Source.
*/
public StatusBarFooter(Path saveLocation) {
super(FXML);
saveLocationStatus.setText(Paths.get(".").resolve(saveLocation).toString());
saveLocationStatus.setText("Data Source -> " + Paths.get(".").resolve(saveLocation));

Check warning on line 26 in src/main/java/unicash/ui/StatusBarFooter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/ui/StatusBarFooter.java#L26

Added line #L26 was not covered by tests
}

}
2 changes: 1 addition & 1 deletion src/main/java/unicash/ui/TransactionListPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Panel containing the list of persons.
*/
public class TransactionListPanel extends UiPart<Region> {
private static final String FXML = "PersonListPanel.fxml";
private static final String FXML = "TransactionListPanel.fxml";
private final Logger logger = LogsCenter.getLogger(TransactionListPanel.class);

Check warning on line 18 in src/main/java/unicash/ui/TransactionListPanel.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/unicash/ui/TransactionListPanel.java#L18

Added line #L18 was not covered by tests

@FXML
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/unicash/ui/UiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class UiManager implements Ui {
public static final String ALERT_DIALOG_PANE_FIELD_ID = "alertDialogPane";

private static final Logger logger = LogsCenter.getLogger(UiManager.class);
private static final String ICON_APPLICATION = "/images/address_book_32.png";
private static final String ICON_APPLICATION = "/images/wallet_icon.png";

private Logic logic;
private MainWindow mainWindow;
Expand Down
Binary file added src/main/resources/fonts/Inter-Bold.ttf
Binary file not shown.
Binary file added src/main/resources/fonts/Inter-Medium.ttf
Binary file not shown.
Binary file added src/main/resources/fonts/Inter-Regular.ttf
Binary file not shown.
Binary file added src/main/resources/fonts/Inter-SemiBold.ttf
Binary file not shown.
Binary file removed src/main/resources/images/address_book_32.png
Binary file not shown.
Binary file added src/main/resources/images/wallet_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 17 additions & 12 deletions src/main/resources/view/DarkTheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@

.label {
-fx-font-size: 11pt;
-fx-font-family: "Segoe UI Semibold";
-fx-font-family: "Inter";
-fx-text-fill: #555555;
-fx-opacity: 0.9;
}

.label-bright {
-fx-font-size: 11pt;
-fx-font-family: "Segoe UI Semibold";
-fx-font-family: "Inter";
-fx-text-fill: white;
-fx-opacity: 1;
}

.label-header {
-fx-font-size: 32pt;
-fx-font-family: "Segoe UI Light";
-fx-font-family: "Inter";
-fx-text-fill: white;
-fx-opacity: 1;
}

.text-field {
-fx-font-size: 12pt;
-fx-font-family: "Segoe UI Semibold";
-fx-font-family: "Inter";
}

.tab-pane {
Expand Down Expand Up @@ -66,7 +66,7 @@

.table-view .column-header .label {
-fx-font-size: 20pt;
-fx-font-family: "Segoe UI Light";
-fx-font-family: "Inter";
-fx-text-fill: black;
-fx-alignment: center-left;
-fx-opacity: 1;
Expand Down Expand Up @@ -121,13 +121,13 @@
}

.cell_big_label {
-fx-font-family: "Segoe UI Black";
-fx-font-family: "Inter";
-fx-font-size: 16px;
-fx-text-fill: #010504;
}

.cell_small_label {
-fx-font-family: "Segoe UI";
-fx-font-family: "Inter";
-fx-font-size: 13px;
-fx-text-fill: #010504;
}
Expand All @@ -149,7 +149,7 @@

.result-display {
-fx-background-color: transparent;
-fx-font-family: "Segoe UI Light";
-fx-font-family: "Inter";
-fx-font-size: 13pt;
-fx-text-fill: black;
}
Expand All @@ -159,7 +159,7 @@
}

.status-bar .label {
-fx-font-family: "Segoe UI Light";
-fx-font-family: "Inter";
-fx-text-fill: black;
-fx-padding: 4px;
-fx-pref-height: 30px;
Expand Down Expand Up @@ -199,7 +199,7 @@

.menu-bar .label {
-fx-font-size: 14pt;
-fx-font-family: "Segoe UI Light";
-fx-font-family: "Inter";
-fx-text-fill: black;
-fx-opacity: 0.9;
}
Expand All @@ -219,7 +219,7 @@
-fx-border-width: 2;
-fx-background-radius: 0;
-fx-background-color: #F3F3F3;
-fx-font-family: "Segoe UI", Helvetica, Arial, sans-serif;
-fx-font-family: "Inter", Helvetica, Arial, sans-serif;
-fx-font-size: 11pt;
-fx-text-fill: #d8d8d8;
-fx-background-insets: 0 0 0 0, 0, 1, 2;
Expand Down Expand Up @@ -323,7 +323,7 @@
-fx-background-insets: 0;
-fx-border-insets: 3;
-fx-border-width: 1;
-fx-font-family: "Segoe UI Bold";
-fx-font-family: "Inter";
-fx-font-size: 13pt;
-fx-text-fill: #575757;
}
Expand Down Expand Up @@ -354,7 +354,12 @@
}

#categories {
-fx-font-family: "Inter";
-fx-label-padding: 2 3 2 3;
-fx-background-color: #FFD43E;
-fx-background-radius: 4;
}

.bold-label {
-fx-font-weight: bold;
}
12 changes: 7 additions & 5 deletions src/main/resources/view/HelpWindow.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#copyButton, #helpMessage {
-fx-text-fill: white;
-fx-text-fill: black;
-fx-font-size: 16px;
-fx-font-family: "Inter";
}

#copyButton {
-fx-background-color: dimgray;
-fx-background-color: darkgray;
}

#copyButton:hover {
-fx-background-color: gray;
-fx-background-color: dimgray;
}

#copyButton:armed {
-fx-background-color: darkgray;
-fx-background-color: white;
}

#helpMessageContainer {
-fx-background-color: derive(#1d1d1d, 20%);
-fx-background-color: white;
}
2 changes: 1 addition & 1 deletion src/main/resources/view/HelpWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.stage.Stage?>

<fx:root resizable="false" title="Help" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<fx:root resizable="false" title="Need help with UniCa$h?" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<icons>
<Image url="@/images/help_icon.png" />
</icons>
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<?import javafx.scene.layout.VBox?>

<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
title="Address App" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
title="UniCa$h" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
<icons>
<Image url="@/images/address_book_32.png" />
<Image url="@/images/wallet_icon.png" />
</icons>
<scene>
<Scene>
Expand Down Expand Up @@ -50,7 +50,7 @@
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="personListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
<StackPane fx:id="transactionListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>

<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/StatusBarFooter.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10" />
</columnConstraints>
<Label fx:id="saveLocationStatus" />
<Label fx:id="saveLocationStatus" styleClass="bold-label" />
</GridPane>
2 changes: 1 addition & 1 deletion src/test/java/unicash/commons/util/AppUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AppUtilTest {

@Test
public void getImage_exitingImage() {
assertNotNull(AppUtil.getImage("/images/address_book_32.png"));
assertNotNull(AppUtil.getImage("/images/wallet_icon.png"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void execute_multipleMonthsAndCategories_returnsValidTotalExpenditure() t
public void toString_noInput_returnsCommandStringFormatted() {
var command = new GetTotalExpenditureCommand(8, new Category("Food"));
var toStringResult = command.toString();
String expected = GetTotalExpenditureCommand.class.getCanonicalName() + "{month=8, categoryFilter=[Food]}";
String expected = GetTotalExpenditureCommand.class.getCanonicalName() + "{month=8, categoryFilter=Food}";
assertEquals(expected, toStringResult);
}

Expand Down

0 comments on commit 76666ed

Please sign in to comment.