/** * This is the method to pass the package from parser to the logic for execution. * * @param input User's input string */ private void execute(String input) { CommandPackage cmdPack = cmdParser.getCommandPackage(input); logger.log(Level.INFO, "CommandParser parses the command."); if (cmdPack == null) { System.out.println("input: " + input); feedback.setText(invalidMsg); } else { assert (cmdPack != null); try { System.out.println(input); String result = logic.executeCommand(cmdPack); feedback.setText(result); txtCommandInput.clear(); taskTableView.setItems(mainApp.getTaskData()); logger.log(Level.INFO, "Update the table view."); } catch (InvalidCommandException e) { feedback.setText(e.getMessage()); } } }
/** The constructor. The constructor is called before the initialize() method. */ public TaskViewController() { logic = LogicClass.getInstance(); cmdParser = CommandParser.getInstance(); }