Skip to content

Commit

Permalink
Merge pull request #175 from tohcejasmine/finance
Browse files Browse the repository at this point in the history
Fix Finance UI buggy and update PPP
  • Loading branch information
joannasara committed Nov 11, 2019
2 parents 2d7dc16 + 038b194 commit eb68c88
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/team/tohcejasmine.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The user interacts with Modulo using a CLI, and it features an outstanding user-
** Project management:
*** Set deadlines for milestones `v1.0` - `v1.4` on GitHub
** Documentation:
*** Wrote introduction to the https://github.com/AY1920S1-CS2103-T16-2/main/blob/master/docs/UserGuide.adoc#introduction[User Guide]
*** Co-wrote introduction to the https://github.com/AY1920S1-CS2103-T16-2/main/blob/master/docs/UserGuide.adoc#introduction[User Guide]
*** Added command usage for _Finance_ feature in the https://github.com/AY1920S1-CS2103-T16-2/main/blob/master/docs/UserGuide.adoc#finances[User Guide]
*** Wrote detailed process and implementation of the Budget command in the https://github.com/AY1920S1-CS2103-T16-2/main/blob/master/docs/DeveloperGuide.adoc#budgets-in-finances[Developer Guide]
*** Added some https://github.com/AY1920S1-CS2103-T16-2/main/blob/master/docs/DeveloperGuide.adoc#user-stories[user stories] and https://github.com/AY1920S1-CS2103-T16-2/main/blob/master/docs/DeveloperGuide.adoc#appendix-c-use-cases[use cases] in the Developer Guide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Budget {
protected final Amount amount;
protected final Date startDate;
protected final Date endDate;
protected final String budgetType; // eiher met, cat or place
protected final String budgetType; // either met, cat or place
protected final String budgetTypeValue;

public Budget(Amount amount, Date startDate, Date endDate,
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/finance/HelpWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class HelpWindow extends UiPart<Stage> {
public static final String HELP_MESSAGE = "Refer to the user guide: " + USERGUIDE_URL;

private static final Logger logger = LogsCenter.getLogger(HelpWindow.class);
private static final String FXML = "../HelpWindow.fxml";
private static final String FXML = "HelpWindow.fxml";

@FXML
private Button copyButton;
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/view/finance/FinanceWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</stylesheets>

<VBox>
<MenuBar fx:id="menuBar" style="-fx-background-color: #61ad58;" VBox.vgrow="NEVER" >
<MenuBar fx:id="menuBar" style="-fx-background-color: #61ad58;" VBox.vgrow="NEVER">
<Menu text="Finance" visible="true" mnemonicParsing="false">
</Menu>
<Menu mnemonicParsing="false" text="File" visible="false">
Expand All @@ -33,7 +33,7 @@
<Menu mnemonicParsing="false" text="Help" visible="false">
<MenuItem fx:id="helpMenuItem" mnemonicParsing="false" onAction="#handleHelp" text="Help" />
</Menu>
<Menu mnemonicParsing="false" visible="true" style="-fx-padding: 3 3 3 700;">
<Menu mnemonicParsing="false" visible="true" style="-fx-padding: 3 3 3 50;">
</Menu>
<Menu fx:id="closeToExceedBudgetMenu" visible="false" mnemonicParsing="false" text="CLOSE TO EXCEEDING BUDGET" style="-fx-background-color: rgba(235,136,23,0.74)">
<MenuItem mnemonicParsing="false" onAction="#handleBudgetBar" text="Show budgets" />
Expand Down
39 changes: 39 additions & 0 deletions src/main/resources/view/finance/HelpWindow.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.Scene?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.layout.HBox?>
<?import javafx.stage.Stage?>

<fx:root resizable="false" title="Help" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<icons>
<Image url="@/images/help_icon.png" />
</icons>
<scene>
<Scene>
<HBox alignment="CENTER">
<children>
<Label fx:id="helpMessage" text="Label">
<HBox.margin>
<Insets right="5.0" />
</HBox.margin>
</Label>
<Button fx:id="copyButton" mnemonicParsing="false" onAction="#copyUrl" text="Copy URL">
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</Button>
</children>
<opaqueInsets>
<Insets bottom="10.0" left="5.0" right="10.0" top="5.0" />
</opaqueInsets>
<padding>
<Insets bottom="10.0" left="5.0" right="10.0" top="5.0" />
</padding>
</HBox>
</Scene>
</scene>
</fx:root>
34 changes: 34 additions & 0 deletions src/test/java/seedu/address/model/finance/budget/BudgetTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package seedu.address.model.finance.budget;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.testutil.Assert.assertThrows;

import org.junit.jupiter.api.Test;

public class BudgetTest {

@Test
public void constructor_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () ->
new Budget(null, null, null, null, null));
}

@Test
public void isValidBudgetType() {
// null budget type
assertThrows(NullPointerException.class, () -> Budget.isValidBudgetType(null));

// invalid budget type
assertFalse(Budget.isValidBudgetType("")); // empty string
assertFalse(Budget.isValidBudgetType(" ")); // spaces only
assertFalse(Budget.isValidBudgetType("^")); // only non-alphanumeric characters
assertFalse(Budget.isValidBudgetType("peter*")); // contains non-alphanumeric characters

// valid budget type
assertTrue(Budget.isValidBudgetType("all"));
assertTrue(Budget.isValidBudgetType("met"));
assertTrue(Budget.isValidBudgetType("place"));
assertTrue(Budget.isValidBudgetType("cat"));
}
}

0 comments on commit eb68c88

Please sign in to comment.