package seedu.typed.ui;

import javafx.fxml.FXML;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Region;
import javafx.scene.text.Text;
import seedu.typed.model.Model;

public class TaskCounter extends UiPart<Region> {
    private static final String FXML = "TaskCounter.fxml";

    private Model model;

    @FXML
    private Text completedCount, pendingCount;

    @FXML
    private Text Completed, Pending;

    public TaskCounter(AnchorPane taskCounterPlaceholder, Model model) {
        super(FXML);
        this.model = model;

        taskCounterPlaceholder.getChildren().add(Completed);
        taskCounterPlaceholder.getChildren().add(Pending);
        taskCounterPlaceholder.getChildren().add(completedCount);
        taskCounterPlaceholder.getChildren().add(pendingCount);

        completedCount.setText(model.getNumberCompletedTasks() + "");
        pendingCount.setText(model.getNumberUncompletedTasks() + "");
    }
}

@@ -18,16 +18,62 @@
 ed.ui;%0A%0A
+import com.google.common.eventbus.Subscribe;%0A%0A
 import j
@@ -194,16 +194,78 @@
 t.Text;%0A
+import seedu.typed.commons.events.ui.NewResultAvailableEvent;%0A
 import s
@@ -1049,12 +1049,295 @@
 %22);%0A    
-%7D
+    registerAsAnEventHandler(this);%0A    %7D%0A%0A    @Subscribe%0A    private void handleNewResultAvailableEvent(NewResultAvailableEvent event) %7B%0A        completedCount.setText(model.getNumberCompletedTasks() + %22%22);%0A        pendingCount.setText(model.getNumberUncompletedTasks() + %22%22);%0A    %7D%0A
 %0A%7D%0A

enable updating for TaskCounter