diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/seedu/address/ui/MainWindow.java index e3314e53640..ff9232d832b 100644 --- a/src/main/java/seedu/address/ui/MainWindow.java +++ b/src/main/java/seedu/address/ui/MainWindow.java @@ -109,8 +109,8 @@ private void setAccelerator(MenuItem menuItem, KeyCombination keyCombination) { * Fills up all the placeholders of this window. */ void fillInnerParts() { - scheduleViewPanel = new ScheduleViewPanel(logic.getObservableLists()); - schedulePanelPlaceholder.getChildren().add(scheduleViewPanel.getRoot()); + scheduleView = new ScheduleView(logic.getTitlesLists(), logic.getObservableLists()); + schedulePanelPlaceholder.getChildren().add(scheduleView.getRoot()); resultDisplay = new ResultDisplay(); resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot()); diff --git a/src/main/java/seedu/address/ui/ScheduleView.java b/src/main/java/seedu/address/ui/ScheduleView.java index d59a163f359..3337f14289f 100644 --- a/src/main/java/seedu/address/ui/ScheduleView.java +++ b/src/main/java/seedu/address/ui/ScheduleView.java @@ -16,26 +16,28 @@ public class ScheduleView extends UiPart { private static final String FXML = "ScheduleView.fxml"; - private ObservableList> schedule; + private List> titles; + private List>> scheduleList; // Excluding titles @FXML private TableView tableView; - ScheduleView(ObservableList> schedule) { + ScheduleView(List> titles, List>> scheduleList) { super(FXML); - this.schedule = schedule; - initialise(); + this.titles = titles; + this.scheduleList = scheduleList; } /** * Allow the creation of table. */ private void initialise() { - for (int i = 0; i < this.schedule.get(0).size(); i++) { + // Currently the code here will only retrieve the first list of titles. + for (int i = 0; i < titles.get(0).size(); i++) { final int finalIdx = i; TableColumn, String> column = new TableColumn, String>( - this.schedule.get(0).get(i) + titles.get(0).get(i) ); column.setCellValueFactory(param -> new ReadOnlyObjectWrapper<>(param.getValue().get(finalIdx)) @@ -44,6 +46,11 @@ private void initialise() { this.tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); } - this.tableView.setItems(this.schedule); + // 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) + ); + } } }