forked from AY2324S2-CS2103T-W13-4/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request AY2324S2-CS2103T-W13-4#39 from breezetall/adding-l…
…ist-command Adding list command
- Loading branch information
Showing
18 changed files
with
330 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/seedu/address/logic/commands/ListTaskCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_TASKS; | ||
|
||
import seedu.address.model.Model; | ||
|
||
/** | ||
* Lists all tasks in the tasklist to the user. | ||
*/ | ||
public class ListTaskCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "listtask"; | ||
|
||
public static final String MESSAGE_SUCCESS = "Listed all tasks"; | ||
|
||
|
||
@Override | ||
public CommandResult execute(Model model) { | ||
requireNonNull(model); | ||
model.updateFilteredTaskList(PREDICATE_SHOW_ALL_TASKS); | ||
return new CommandResult(MESSAGE_SUCCESS); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package seedu.address.ui; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.layout.HBox; | ||
import javafx.scene.layout.Region; | ||
import seedu.address.model.task.Task; | ||
|
||
/** | ||
* An UI component that displays information of a {@code Person}. | ||
*/ | ||
public class TaskCard extends UiPart<Region> { | ||
|
||
private static final String FXML = "TaskListCard.fxml"; | ||
|
||
/** | ||
* Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. | ||
* As a consequence, UI elements' variable names cannot be set to such keywords | ||
* or an exception will be thrown by JavaFX during runtime. | ||
* | ||
* @see <a href="https://github.com/se-edu/addressbook-level4/issues/336">The issue on AddressBook level 4</a> | ||
*/ | ||
|
||
public final Task task; | ||
|
||
@FXML | ||
private HBox cardPane; | ||
@FXML | ||
private Label name; | ||
@FXML | ||
private Label id; | ||
@FXML | ||
private Label mark; | ||
@FXML | ||
private Label description; | ||
|
||
/* | ||
@FXML | ||
private Label email; | ||
@FXML | ||
private FlowPane tags; | ||
*/ | ||
|
||
/** | ||
* Creates a {@code TaskCode} with the given {@code Task} and index to display. | ||
*/ | ||
public TaskCard(Task task, int displayedIndex) { | ||
super(FXML); | ||
this.task = task; | ||
id.setText(displayedIndex + ". "); | ||
//name.setText(task.getName().fullName); | ||
//mark.setText(task.getMark().value); | ||
description.setText(task.getDescription()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package seedu.address.ui; | ||
|
||
import java.util.logging.Logger; | ||
|
||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
import javafx.scene.control.ListCell; | ||
import javafx.scene.control.ListView; | ||
import javafx.scene.layout.Region; | ||
import seedu.address.commons.core.LogsCenter; | ||
import seedu.address.model.task.Task; | ||
|
||
/** | ||
* Panel containing the list of persons. | ||
*/ | ||
public class TaskListPanel extends UiPart<Region> { | ||
private static final String FXML = "TaskListPanel.fxml"; | ||
private final Logger logger = LogsCenter.getLogger(TaskListPanel.class); | ||
|
||
@FXML | ||
private ListView<Task> taskListView; | ||
|
||
/** | ||
* Creates a {@code PersonListPanel} with the given {@code ObservableList}. | ||
*/ | ||
public TaskListPanel(ObservableList<Task> taskList) { | ||
super(FXML); | ||
taskListView.setItems(taskList); | ||
taskListView.setCellFactory(listView -> new TaskListViewCell()); | ||
} | ||
|
||
/** | ||
* Custom {@code ListCell} that displays the graphics of a {@code Person} using a {@code PersonCard}. | ||
*/ | ||
class TaskListViewCell extends ListCell<Task> { | ||
@Override | ||
protected void updateItem(Task task, boolean empty) { | ||
super.updateItem(task, empty); | ||
|
||
if (empty || task == null) { | ||
setGraphic(null); | ||
setText(null); | ||
} else { | ||
setGraphic(new TaskCard(task, getIndex() + 1).getRoot()); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.