Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwan Chen Sheng committed Oct 21, 2019
1 parent 17cbab9 commit af0685a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
21 changes: 14 additions & 7 deletions src/main/java/seedu/address/ui/ScheduleView.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,28 @@ public class ScheduleView extends UiPart<Region> {

private static final String FXML = "ScheduleView.fxml";

private ObservableList<ObservableList<String>> schedule;
private List<List<String>> titles;
private List<ObservableList<ObservableList<String>>> scheduleList; // Excluding titles

@FXML
private TableView tableView;

ScheduleView(ObservableList<ObservableList<String>> schedule) {
ScheduleView(List<List<String>> titles, List<ObservableList<ObservableList<String>>> 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<ObservableList<String>, String> column =
new TableColumn<ObservableList<String>, String>(
this.schedule.get(0).get(i)
titles.get(0).get(i)
);
column.setCellValueFactory(param ->
new ReadOnlyObjectWrapper<>(param.getValue().get(finalIdx))
Expand All @@ -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)
);
}
}
}

0 comments on commit af0685a

Please sign in to comment.