From 3066cb92b5d6f6aa9762b0d36a79f422f22ee338 Mon Sep 17 00:00:00 2001 From: Ma-Yueran Date: Mon, 12 Oct 2020 00:42:03 +0800 Subject: [PATCH 1/2] Make task list view scalable horizontally --- src/main/resources/view/MainWindow.fxml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index 7036830df79..29e1f0dc35f 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -5,7 +5,7 @@ - + @@ -30,24 +30,21 @@ - - - + + + - + - + - - - - - + + From 73b62c65a1a27e13a235992c07c1c0e5c65e2783 Mon Sep 17 00:00:00 2001 From: Ma-Yueran Date: Mon, 12 Oct 2020 01:22:44 +0800 Subject: [PATCH 2/2] Make tag list view scalable horizontally Show tag info when a tag is clicked --- src/main/java/seedu/address/ui/MainWindow.java | 10 +++++++++- src/main/java/seedu/address/ui/TagCard.java | 17 +++++++++++++++++ src/main/resources/view/TagCard.fxml | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/seedu/address/ui/MainWindow.java index 50ebcca50e5..29ac769b571 100644 --- a/src/main/java/seedu/address/ui/MainWindow.java +++ b/src/main/java/seedu/address/ui/MainWindow.java @@ -24,6 +24,7 @@ public class MainWindow extends UiPart { private static final String FXML = "MainWindow.fxml"; + private static MainWindow instance = null; private final Logger logger = LogsCenter.getLogger(getClass()); @@ -67,6 +68,13 @@ public MainWindow(Stage primaryStage, Logic logic) { setWindowDefaultSize(logic.getGuiSettings()); // setAccelerators(); + + // Set instance + instance = this; + } + + public static MainWindow getInstance() { + return instance; } public Stage getPrimaryStage() { @@ -173,7 +181,7 @@ private void handleExit() { * * @see seedu.address.logic.Logic#execute(String) */ - private CommandResult executeCommand(String commandText) throws CommandException, ParseException { + public CommandResult executeCommand(String commandText) throws CommandException, ParseException { try { CommandResult commandResult = logic.execute(commandText); logger.info("Result: " + commandResult.getFeedbackToUser()); diff --git a/src/main/java/seedu/address/ui/TagCard.java b/src/main/java/seedu/address/ui/TagCard.java index 28692e6d569..17aa9ec36a9 100644 --- a/src/main/java/seedu/address/ui/TagCard.java +++ b/src/main/java/seedu/address/ui/TagCard.java @@ -4,6 +4,8 @@ import javafx.scene.control.Label; import javafx.scene.layout.HBox; import javafx.scene.layout.Region; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.tag.Tag; /** @@ -43,6 +45,21 @@ public TagCard(Tag tag, int displayedIndex) { fileAddress.setText(tag.getFileAddress().value); } + /** + * Displays the information of the tag in the main window. + * + * @see seedu.address.logic.Logic#execute(String) + */ + public void showTagInfo() throws CommandException, ParseException { + MainWindow mainWindow = MainWindow.getInstance(); + if (mainWindow == null) { + return; + } + + String showInfoCommand = "show t/" + tag.getTagName(); + mainWindow.executeCommand(showInfoCommand); + } + @Override public boolean equals(Object other) { // short circuit if same object diff --git a/src/main/resources/view/TagCard.fxml b/src/main/resources/view/TagCard.fxml index da03194ebfd..d3bde119340 100644 --- a/src/main/resources/view/TagCard.fxml +++ b/src/main/resources/view/TagCard.fxml @@ -10,7 +10,7 @@ - +