package seedu.tasklist.ui;

import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.ListView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Region;
import seedu.tasklist.model.task.ReadOnlyTask;

public class UpcomingTaskPanel extends UiPart<Region> {

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

    @FXML
    private ListView<ReadOnlyTask> todayTaskListView;
    @FXML
    private ListView<ReadOnlyTask> tomorrowTaskListView;

    public UpcomingTaskPanel(AnchorPane upcomingTaskPlaceholder, ObservableList<ReadOnlyTask> todayTask,
            ObservableList<ReadOnlyTask> tomorrowTask) {
        super(FXML);
        setTodayListView(todayTask);
        setTomorrowListView(tomorrowTask);
    }

    public void setTodayListView(ObservableList<ReadOnlyTask> todayList) {
        todayTaskListView.setItems(todayList);
    }

    public void setTomorrowListView(ObservableList<ReadOnlyTask> tomorrowList) {
        tomorrowTaskListView.setItems(tomorrowList);
    }
}

@@ -21,16 +21,50 @@
 st.ui;%0A%0A
+import java.util.logging.Logger;%0A%0A
 import j
@@ -234,16 +234,135 @@
 Region;%0A
+import seedu.tasklist.commons.core.LogsCenter;%0Aimport seedu.tasklist.commons.events.ui.TaskPanelSelectionChangedEvent;%0A
 import s
@@ -457,16 +457,96 @@
 gion%3E %7B%0A
+    private final Logger logger = LogsCenter.getLogger(UpcomingTaskPanel.class);
 %0A    pri
@@ -995,24 +995,74 @@
 orrowTask);%0A
+        setEventHandlerForSelectionChangeEvent();%0A
     %7D%0A%0A    p
@@ -1053,37 +1053,38 @@
 ();%0A    %7D%0A%0A    p
-ublic
+rivate
  void setTodayLi
@@ -1191,21 +1191,22 @@
 %7D%0A%0A    p
-ublic
+rivate
  void se
@@ -1326,11 +1326,1146 @@
 );%0A    %7D
+%0A%0A    private void setEventHandlerForSelectionChangeEvent() %7B%0A        setEventHandlerForTodaySelectionChangeEvent();%0A        setEventHandlerForTomorrowSelectionChangeEvent();%0A    %7D%0A%0A    private void setEventHandlerForTodaySelectionChangeEvent() %7B%0A        todayTaskListView.getSelectionModel().selectedItemProperty()%0A                .addListener((observable, oldValue, newValue) -%3E %7B%0A                    if (newValue != null) %7B%0A                        logger.fine(%22Selection in today list panel changed to : '%22 + newValue + %22'%22);%0A                        raise(new TaskPanelSelectionChangedEvent(newValue));%0A                    %7D%0A                %7D);%0A    %7D%0A%0A    private void setEventHandlerForTomorrowSelectionChangeEvent() %7B%0A        tomorrowTaskListView.getSelectionModel().selectedItemProperty()%0A                .addListener((observable, oldValue, newValue) -%3E %7B%0A                    if (newValue != null) %7B%0A                        logger.fine(%22Selection in tomorrow list panel changed to : '%22 + newValue + %22'%22);%0A                        raise(new TaskPanelSelectionChangedEvent(newValue));%0A                    %7D%0A                %7D);%0A    %7D
 %0A%7D%0A

add selection handler