package seedu.address.logic;

import java.util.logging.Logger;

import javafx.collections.ObservableList;
import seedu.address.commons.core.ComponentManager;
import seedu.address.commons.core.LogsCenter;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.dateparser.DateTimeManager;
import seedu.address.logic.dateparser.DateTimeParser;
import seedu.address.logic.parser.Parser;
import seedu.address.model.Model;
import seedu.address.model.task.ReadOnlyTask;
import seedu.address.storage.Storage;

/**
 * The main LogicManager of the app.
 */
public class LogicManager extends ComponentManager implements Logic {
    private final Logger logger = LogsCenter.getLogger(LogicManager.class);

    private final Model model;
    private final Parser parser;
    private final DateTimeParser dtParser;

    public LogicManager(Model model, Storage storage) {
        this.model = model;
        this.parser = new Parser();
        dtParser = new DateTimeManager();
    }

    //@@author A0162877N
    @Override
    public CommandResult execute(String commandText) throws CommandException {
        logger.info("----------------[USER COMMAND][" + commandText + "]");
        Command command = parser.parseCommand(commandText);
        command.setData(model);
        command.setDateParser(dtParser);
        return command.execute();
    }

    @Override
    public ObservableList<ReadOnlyTask> getFilteredTaskList() {
        return model.getFilteredTaskList();
    }

    @Override
    public ObservableList<ReadOnlyTask> getFilteredIncompleteTaskList() {
        return model.getFilteredIncompleteTaskList();
    }
}

@@ -57,16 +57,62 @@
 ogger;%0A%0A
+import com.google.common.eventbus.Subscribe;%0A%0A
 import j
@@ -239,24 +239,94 @@
 LogsCenter;%0A
+import seedu.address.commons.events.ui.CheckBoxSelectionChangedEvent;%0A
 import seedu
@@ -1857,11 +1857,648 @@
 );%0A    %7D
+%0A%0A    @Subscribe%0A    private void handleCheckBoxSelectionChangedEvent(CheckBoxSelectionChangedEvent event) %7B%0A        logger.info(LogsCenter.getEventHandlingLogMessage(event));%0A        String status = %22completed%22;%0A        if (!event.getTaskStatus()) %7B%0A            status = %22incomplete%22;%0A        %7D%0A        String commandText = %22mark %22 + event.getTaskIndex() + %22 %22 + status;%0A        Command command = parser.parseCommand(commandText);%0A        command.setData(model);%0A        command.setDateParser(dtParser);%0A        try %7B%0A            command.execute();%0A        %7D catch (CommandException e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D
 %0A%7D%0A

Add subscriber to handle check box selection change event raised