diff --git a/src/main/java/seedu/address/logic/Logic.java b/src/main/java/seedu/address/logic/Logic.java index d10413236484..2657ab5e8073 100644 --- a/src/main/java/seedu/address/logic/Logic.java +++ b/src/main/java/seedu/address/logic/Logic.java @@ -4,6 +4,7 @@ import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.logic.parser.exceptions.ParseException; +import seedu.address.model.WishTransaction; import seedu.address.model.wish.Wish; /** @@ -24,4 +25,9 @@ public interface Logic { /** Returns the list of input entered by the user, encapsulated in a {@code ListElementPointer} object */ ListElementPointer getHistorySnapshot(); + + /** Returns the WishTransaction object in the model. */ + WishTransaction getWishTransaction(); + + } diff --git a/src/main/java/seedu/address/logic/LogicManager.java b/src/main/java/seedu/address/logic/LogicManager.java index d4344a145951..796a1c016620 100644 --- a/src/main/java/seedu/address/logic/LogicManager.java +++ b/src/main/java/seedu/address/logic/LogicManager.java @@ -12,6 +12,7 @@ import seedu.address.logic.parser.WishBookParser; import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.Model; +import seedu.address.model.WishTransaction; import seedu.address.model.wish.Wish; /** @@ -50,4 +51,9 @@ public ObservableList getFilteredWishList() { public ListElementPointer getHistorySnapshot() { return new ListElementPointer(history.getHistory()); } + + @Override + public WishTransaction getWishTransaction() { + return model.getWishTransaction(); + } } diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/seedu/address/ui/MainWindow.java index c87a97849729..0b0072b3339d 100644 --- a/src/main/java/seedu/address/ui/MainWindow.java +++ b/src/main/java/seedu/address/ui/MainWindow.java @@ -19,6 +19,7 @@ import seedu.address.commons.events.ui.ShowHelpRequestEvent; import seedu.address.logic.Logic; import seedu.address.model.UserPrefs; +import seedu.address.model.WishTransaction; /** * The Main Window. Provides the basic application layout containing @@ -119,10 +120,14 @@ private void setAccelerator(MenuItem menuItem, KeyCombination keyCombination) { * Fills up all the placeholders of this window. */ void fillInnerParts() { + WishTransaction transaction = logic.getWishTransaction(); // Access to WishTransaction + wishDetailPanel = new WishDetailPanel(); wishDetailPlaceholder.getChildren().add(wishDetailPanel.getRoot()); wishListPanel = new WishListPanel(logic.getFilteredWishList()); + // New constructor below to be used to access WishTransaction in model + // wishListPanel = new WishListPanel(logic.getFilteredWishList(), logic.getWishTransaction()); wishListPanelPlaceholder.getChildren().add(wishListPanel.getRoot()); ResultDisplay resultDisplay = new ResultDisplay(); diff --git a/src/main/java/seedu/address/ui/WishDetailPanel.java b/src/main/java/seedu/address/ui/WishDetailPanel.java index 0a7e92205ed7..084f65a28889 100644 --- a/src/main/java/seedu/address/ui/WishDetailPanel.java +++ b/src/main/java/seedu/address/ui/WishDetailPanel.java @@ -11,6 +11,7 @@ import javafx.scene.layout.Region; import seedu.address.commons.core.LogsCenter; import seedu.address.commons.events.ui.WishPanelSelectionChangedEvent; +import seedu.address.model.WishTransaction; import seedu.address.model.wish.Wish; /** @@ -51,6 +52,19 @@ public WishDetailPanel() { loadDefaultPage(); registerAsAnEventHandler(this); + + // TODO: [Jiho] Remove this constructor once the one immediately below this is used. + } + + public WishDetailPanel(WishTransaction wishTransaction) { + super(FXML); + + // To prevent triggering events for typing inside the loaded Web page. + getRoot().setOnKeyPressed(Event::consume); + + loadDefaultPage(); + registerAsAnEventHandler(this); + // TODO: [Jiho] Utilize wishTransaction's data in the WishDetailPanel (if wanted). } /** diff --git a/src/main/java/seedu/address/ui/WishListPanel.java b/src/main/java/seedu/address/ui/WishListPanel.java index 5dfbf9b69721..edfc26126a4c 100644 --- a/src/main/java/seedu/address/ui/WishListPanel.java +++ b/src/main/java/seedu/address/ui/WishListPanel.java @@ -13,6 +13,7 @@ import seedu.address.commons.core.LogsCenter; import seedu.address.commons.events.ui.JumpToListRequestEvent; import seedu.address.commons.events.ui.WishPanelSelectionChangedEvent; +import seedu.address.model.WishTransaction; import seedu.address.model.wish.Wish; /** @@ -29,6 +30,16 @@ public WishListPanel(ObservableList wishList) { super(FXML); setConnections(wishList); registerAsAnEventHandler(this); + // TODO: [Jiho] Remove this constructor once the one immediately below this is used. + } + + + public WishListPanel(ObservableList wishList, WishTransaction wishTransaction) { + super(FXML); + setConnections(wishList); + registerAsAnEventHandler(this); + + // TODO: [Jiho] Utilize wishTransaction's data in the WishListPanel (if wanted). } private void setConnections(ObservableList wishList) {