Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2021S1#90 from Ma-Yueran/branch-impro…
Browse files Browse the repository at this point in the history
…ve-task-list-view

Branch improve task list view
  • Loading branch information
Ma-Yueran authored Oct 11, 2020
2 parents 40761f4 + 73b62c6 commit bb3d81d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
10 changes: 9 additions & 1 deletion src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
public class MainWindow extends UiPart<Stage> {

private static final String FXML = "MainWindow.fxml";
private static MainWindow instance = null;

private final Logger logger = LogsCenter.getLogger(getClass());

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

/**
Expand Down Expand Up @@ -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
Expand Down
19 changes: 8 additions & 11 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.stage.Stage?>
Expand All @@ -30,24 +30,21 @@
</Menu>
</menus>
</MenuBar>
<HBox prefHeight="100.0" prefWidth="200.0" spacing="10.0" VBox.vgrow="ALWAYS">
<children>
<VBox prefHeight="314.0" prefWidth="188.0" HBox.hgrow="NEVER">
<SplitPane dividerPositions="0.3224299065420561" prefHeight="160.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
<items>
<VBox prefHeight="200.0" prefWidth="100.0">
<children>
<StackPane fx:id="tagListPlaceholder" prefHeight="306.0" prefWidth="139.0" VBox.vgrow="ALWAYS" />
<StackPane fx:id="tagListPlaceholder" prefHeight="294.0" prefWidth="143.0" VBox.vgrow="ALWAYS" />
</children>
</VBox>
<VBox prefHeight="200.0" prefWidth="100.0" spacing="10.0" HBox.hgrow="ALWAYS">
<VBox prefHeight="200.0" prefWidth="100.0">
<children>
<StackPane fx:id="resultDisplayPlaceHolder" prefHeight="299.0" prefWidth="359.0" VBox.vgrow="ALWAYS" />
<StackPane fx:id="lastInputPlaceHolder" prefHeight="15.0" prefWidth="301.0" VBox.vgrow="NEVER" />
</children>
</VBox>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</HBox>
</items>
</SplitPane>
<StackPane fx:id="commandBoxPlaceHolder" prefHeight="41.0" prefWidth="501.0">
<padding>
<Insets left="10.0" right="10.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/TagCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<HBox id="cardPane" fx:id="cardPane" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
<HBox id="cardPane" fx:id="cardPane" onMouseClicked="#showTagInfo" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
<GridPane HBox.hgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10" prefWidth="150" />
Expand Down

0 comments on commit bb3d81d

Please sign in to comment.