Skip to content

Commit

Permalink
Implementation of MonthMenuV, UpdateViewC, UpdateViewIB. Removal of u…
Browse files Browse the repository at this point in the history
…nused import in UpdateViewUCI.
  • Loading branch information
YinLingithub committed Jul 24, 2023
1 parent a357798 commit 5dd17a5
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/use_cases/monthly_menu/UpdateViewIB.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package use_cases.monthly_menu;

public interface UpdateViewIB {

MonthMenuOD createOutput(UpdateViewID input);
}
4 changes: 1 addition & 3 deletions src/main/java/use_cases/monthly_menu/UpdateViewUCI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import entities.*;
import views.monthly_menu.MonthMenuP;

import java.util.ArrayList;

/**
* The UpdateViewUCI
*/
Expand All @@ -15,7 +13,7 @@ public UpdateViewUCI(){
this.outputBoundary = new MonthMenuP();
}

public MonthMenuOD creatOutput(UpdateViewID input){
public MonthMenuOD createOutput(UpdateViewID input){
SessionStorage session = input.getSession();
int monthID = input.getMonthID();

Expand Down
28 changes: 28 additions & 0 deletions src/main/java/views/monthly_menu/MonthMenuV.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
package views.monthly_menu;

import entities.SessionStorage;

import javax.swing.*;
import java.awt.*;

public class MonthMenuV implements MonthMenuVB{
UpdateViewC controller;

public MonthMenuV(UpdateViewC controller, SessionStorage session, int monthID){
this.controller = controller;

JLabel title = new JLabel("Monthly Menu");
title.setAlignmentX(Component.CENTER_ALIGNMENT);

JButton addExpense = new JButton("Add an expense");
JButton editExpense = new JButton("Edit an expense");
JButton addCategory = new JButton("Add an category");
JButton editCategory = new JButton("Edit an category");
JButton generateSummary = new JButton("Generate summary");

String[] expenseTableTitle = new String[]{"Expense", "Value"};
String[] categoryTableTitle = new String[]{"Category", "Budget"};
Object[][] expenseList = controller.getOutput(session, monthID).getExpenseList();
JTable expenseTable = new JTable(expenseList, expenseTableTitle);
Object[][] categoryList = controller.getOutput(session, monthID).getCategoryList();
JTable categoryTable = new JTable(categoryList, categoryTableTitle);
//TODO: put together the components
//TODO: add reactions to the buttons
}
}
15 changes: 15 additions & 0 deletions src/main/java/views/monthly_menu/UpdateViewC.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
package views.monthly_menu;

import entities.SessionStorage;
import use_cases.monthly_menu.MonthMenuOD;
import use_cases.monthly_menu.UpdateViewIB;
import use_cases.monthly_menu.UpdateViewID;

public class UpdateViewC {
final UpdateViewIB inputBoundary;

public UpdateViewC(UpdateViewIB inputBoundary){
this.inputBoundary = inputBoundary;
}

MonthMenuOD getOutput(SessionStorage session, int monthID){
UpdateViewID inputData = new UpdateViewID(session, monthID);
return inputBoundary.createOutput(inputData);
}
}

0 comments on commit 5dd17a5

Please sign in to comment.