Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY1819S1#66 from bannified/integration-…
Browse files Browse the repository at this point in the history
…ui-transactions

Integration: UI and WishTransactions
  • Loading branch information
bannified authored Oct 24, 2018
2 parents 75f298f + 26dd5a6 commit d50c323
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/seedu/address/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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();


}
6 changes: 6 additions & 0 deletions src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -50,4 +51,9 @@ public ObservableList<Wish> getFilteredWishList() {
public ListElementPointer getHistorySnapshot() {
return new ListElementPointer(history.getHistory());
}

@Override
public WishTransaction getWishTransaction() {
return model.getWishTransaction();
}
}
5 changes: 5 additions & 0 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/seedu/address/ui/WishDetailPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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).
}

/**
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/seedu/address/ui/WishListPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -29,6 +30,16 @@ public WishListPanel(ObservableList<Wish> wishList) {
super(FXML);
setConnections(wishList);
registerAsAnEventHandler(this);
// TODO: [Jiho] Remove this constructor once the one immediately below this is used.
}


public WishListPanel(ObservableList<Wish> wishList, WishTransaction wishTransaction) {
super(FXML);
setConnections(wishList);
registerAsAnEventHandler(this);

// TODO: [Jiho] Utilize wishTransaction's data in the WishListPanel (if wanted).
}

private void setConnections(ObservableList<Wish> wishList) {
Expand Down

0 comments on commit d50c323

Please sign in to comment.