diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc index 1f006c7a7c1..e3e77ab89de 100644 --- a/docs/UserGuide.adoc +++ b/docs/UserGuide.adoc @@ -105,6 +105,17 @@ Notes: === UI Display +==== Viewing Schedules +When the Scheduler starts, interview schedules will be displayed for you. The data will be displayed in a table format, +with each table representing the schedule for each day. In the first column, the date of that interview schedule will be +displayed, the rest of the columns are the departments and the name of their respective person in charge. Subsequent rows +will be be displayed by showing the time slot first, with the person allocated to that time slot. If there are no interviewee +occupying that time slot, it will be displayed as "0". + +A sample output of the Schedule UI is shown below: + +image::Ui/Schedule.png[width="500", align="left"] + ==== Viewing details of interviewees You can to view the list of interviewees and the following information: 1. Name @@ -125,18 +136,6 @@ image::Ui/Interviewee.png[width="500", align="left"] In this screen, you can edit, add or delete interviewees accordingly by using the other features explained in this User Guide. -==== Display weekly schedule -Display the interviews that has been scheduled by the application. Allows you to have an weekly overview of -interviews during that week by typing the following command + -Format: `display date DATE (eg. 24/06/2019)` - -Doing so will allow the scheduler to show the timetable for that week. - -image::Ui/Timetable.png[width="500", align="left"] - -The timetable will also show the availability of the interviewer and block out the time slots when the interviewer -is unavailable. - ==== Differentiating the importance of timetable slots through colours `[Coming in v2.0]` As you can see from the timetable above, there are 2 different colours of time slots. This is implemented so you are able to differentiate which interviews are important by using the colour code as shown in the timetable. @@ -251,9 +250,6 @@ Format: `record rank` |Display list of interviewers/interviewees |`display interviewees` -|Display weekly schedule -|`display date DATE` - |Get interview schedule for interviewer/interviewee |`get NAME` + diff --git a/docs/images/Ui/Schedule.png b/docs/images/Ui/Schedule.png new file mode 100644 index 00000000000..ed2d15086d3 Binary files /dev/null and b/docs/images/Ui/Schedule.png differ diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/seedu/address/ui/MainWindow.java index b1605b584d5..38076e4ecf2 100644 --- a/src/main/java/seedu/address/ui/MainWindow.java +++ b/src/main/java/seedu/address/ui/MainWindow.java @@ -34,7 +34,7 @@ public class MainWindow extends UiPart { private PersonListPanel personListPanel; private ResultDisplay resultDisplay; private HelpWindow helpWindow; - private ScheduleView scheduleView; + private ScheduleViewPanel scheduleViewPanel; @FXML private StackPane commandBoxPlaceholder; @@ -109,8 +109,8 @@ private void setAccelerator(MenuItem menuItem, KeyCombination keyCombination) { * Fills up all the placeholders of this window. */ void fillInnerParts() { - scheduleView = new ScheduleView(logic.getTitlesLists(), logic.getObservableLists()); - schedulePanelPlaceholder.getChildren().add(scheduleView.getRoot()); + scheduleViewPanel = new ScheduleViewPanel(logic.getTitlesLists(), logic.getObservableLists()); + schedulePanelPlaceholder.getChildren().add(scheduleViewPanel.getRoot()); resultDisplay = new ResultDisplay(); resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot()); @@ -166,6 +166,10 @@ public PersonListPanel getPersonListPanel() { return personListPanel; } + public ScheduleViewPanel getScheduleViewPanel() { + return scheduleViewPanel; + } + /** * Executes the command and returns the result. * diff --git a/src/main/java/seedu/address/ui/RefreshListener.java b/src/main/java/seedu/address/ui/RefreshListener.java new file mode 100644 index 00000000000..811ea0c56d6 --- /dev/null +++ b/src/main/java/seedu/address/ui/RefreshListener.java @@ -0,0 +1,15 @@ +package seedu.address.ui; + +import seedu.address.logic.Logic; + +/** + * API of refresh listener. + */ +public interface RefreshListener { + + /** + * Refresh the Ui when data is imported from .csv file. + */ + void dataImported(MainWindow window, Logic logic); + +} diff --git a/src/main/java/seedu/address/ui/RefreshListenerManager.java b/src/main/java/seedu/address/ui/RefreshListenerManager.java new file mode 100644 index 00000000000..d4b3a9b514c --- /dev/null +++ b/src/main/java/seedu/address/ui/RefreshListenerManager.java @@ -0,0 +1,17 @@ +package seedu.address.ui; + +import seedu.address.logic.Logic; + +/** + * Refresh the Ui whenever new data is being imported to the Scheduler. + */ +public class RefreshListenerManager implements RefreshListener { + + private ScheduleViewPanel scheduleViewPanel; + + @Override + public void dataImported(MainWindow window, Logic logic) { + this.scheduleViewPanel = window.getScheduleViewPanel(); + this.scheduleViewPanel.fillPanel(logic.getTitlesLists(), logic.getObservableLists()); + } +} diff --git a/src/main/java/seedu/address/ui/ScheduleView.java b/src/main/java/seedu/address/ui/ScheduleView.java index 75732721af8..d1ba9db282f 100644 --- a/src/main/java/seedu/address/ui/ScheduleView.java +++ b/src/main/java/seedu/address/ui/ScheduleView.java @@ -16,16 +16,16 @@ public class ScheduleView extends UiPart { private static final String FXML = "ScheduleView.fxml"; - private List> titles; - private List>> scheduleList; // Excluding titles + private List titles; + private ObservableList> schedule; // Excluding titles @FXML private TableView tableView; - ScheduleView(List> titles, List>> scheduleList) { + ScheduleView(List titles, ObservableList> schedule) { super(FXML); this.titles = titles; - this.scheduleList = scheduleList; + this.schedule = schedule; initialise(); } @@ -33,26 +33,18 @@ public class ScheduleView extends UiPart { * Allow the creation of table. */ private void initialise() { - // Currently the code here will only retrieve the first list of titles. - for (int i = 0; i < titles.get(0).size(); i++) { + for (int i = 0; i < this.titles.size(); i++) { final int finalIdx = i; TableColumn, String> column = new TableColumn, String>( - titles.get(0).get(i) + this.titles.get(i) ); column.setCellValueFactory(param -> new ReadOnlyObjectWrapper<>(param.getValue().get(finalIdx)) ); this.tableView.getColumns().add(column); - this.tableView.setColumnResizePolicy(this.tableView.CONSTRAINED_RESIZE_POLICY); - } - - // the data of the schedule now excludes the titles, so titles is not in the first row of data returned anymore - for (int i = 0; i < this.scheduleList.get(0).size(); i++) { - this.tableView.getItems().add( - this.scheduleList.get(0).get(i) - ); + this.tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); } + this.tableView.setItems(this.schedule); } } - diff --git a/src/main/java/seedu/address/ui/ScheduleViewPanel.java b/src/main/java/seedu/address/ui/ScheduleViewPanel.java new file mode 100644 index 00000000000..c8c7a853fd4 --- /dev/null +++ b/src/main/java/seedu/address/ui/ScheduleViewPanel.java @@ -0,0 +1,69 @@ +package seedu.address.ui; + +import java.util.ArrayList; +import java.util.List; + +import javafx.collections.ObservableList; +import javafx.fxml.FXML; +import javafx.scene.layout.Region; +import javafx.scene.layout.StackPane; + +/** + * Panel to hold multiple schedule tables together. + */ +public class ScheduleViewPanel extends UiPart { + + private static final String FXML = "ScheduleViewPanel.fxml"; + + private List>> scheduleList; + + private List scheduleViewList; + + private List> titles; + + @FXML + private StackPane container; + + ScheduleViewPanel( + List> titles, List>> scheduleList) { + super(FXML); + this.scheduleList = scheduleList; + this.scheduleViewList = new ArrayList<>(); + this.titles = titles; + fillPanel(); + } + /** + * Fill the panel with the tables that is retrieved from scheduleView class. + */ + private void fillPanel() { + for (int i = 0; i < this.scheduleList.size(); i++) { + scheduleViewList.add(new ScheduleView(this.titles.get(i), this.scheduleList.get(i))); + } + for (ScheduleView schedule : scheduleViewList) { + container.getChildren().add(schedule.getRoot()); + } + } + + /** + * Fill the panel when user import data. + * @param titles Lists of titles for the schedules + * @param scheduleList Lists of observable data for TableView. + */ + protected void fillPanel( + List> titles, + List>> scheduleList) { + for (int i = 0; i < scheduleList.size(); i++) { + scheduleViewList.add(new ScheduleView(titles.get(i), scheduleList.get(i))); + } + for (ScheduleView schedule : scheduleViewList) { + container.getChildren().add(schedule.getRoot()); + } + } + + protected void refresh() { + this.scheduleViewList.removeAll(this.scheduleViewList); + } +} + + + diff --git a/src/main/resources/view/ScheduleView.fxml b/src/main/resources/view/ScheduleView.fxml index fa69180a6a8..8a13de090bf 100644 --- a/src/main/resources/view/ScheduleView.fxml +++ b/src/main/resources/view/ScheduleView.fxml @@ -2,7 +2,6 @@ - diff --git a/src/main/resources/view/ScheduleViewPanel.fxml b/src/main/resources/view/ScheduleViewPanel.fxml new file mode 100644 index 00000000000..dc0ea9906fa --- /dev/null +++ b/src/main/resources/view/ScheduleViewPanel.fxml @@ -0,0 +1,9 @@ + + + + + + + +