private void updateUiTaskList() { switch (currentView) { case SHOW_OUTSTANDING: ui.updateTaskList(taskEngine.getOutstandingTasks(), ScreenView.SCREEN_MAIN); break; case SHOW_DONE: ui.updateTaskList(taskEngine.getCompletedTasks(), ScreenView.SCREEN_DONE); break; case SHOW_ALL: ui.updateTaskList(taskEngine.getAllTasks(), ScreenView.SCREEN_MAIN_ALL); break; case SHOW_SUMMARY: ui.updateTaskList(taskEngine.getOutstandingTasks(), ScreenView.SCREEN_SUMMARY); break; case SHOW_SEARCH_RESULTS: ui.passSearchStringToSearchScreen(searchString); ui.updateTaskList( taskEngine.search(searchTerm, searchStartDate, searchEndDate, searchShowDone), ScreenView.SCREEN_SEARCH); break; } }
// Exit routine used by exit command, close button and system tray private boolean exit() { if (hasStartupError) { hideAndTerminate(); } if (!taskEngine.hasPreviousOperation()) { hideAndTerminate(); // No write operations; safe to exit } boolean success = taskEngine.save(); // Try to write state to file if (success) { hideAndTerminate(); // Write success; safe to exit } // Write failure; create confirmation dialog to warn user boolean exitAnyway = ui.createErrorDialogWithConfirmation( ERROR_EXIT_HEADER, ERROR_EXIT_MESSAGE, ERROR_EXIT_BUTTON_LABEL); if (exitAnyway) { hideAndTerminate(); // User chose to exit anyway despite save failure } return false; // User pressed cancel }
private List<Task> getCurrentTaskList() { return taskEngine.getCurrentTaskList(); }
private void initUiTaskList() { ui.initialUpdateTaskList(taskEngine.getOutstandingTasks()); updateView(ViewType.SHOW_SUMMARY); }