/** Called when the user presses enter. Creates a UserInput object and passes it to MainLogic. */ public void onEnter() { feedback.setMessage(null); String command = commandText.getText(); // string received from user. commandText.setText(""); UserInput userInput = new UserInput(command, USER_INPUT_TODAY_TAB); MainLogic.run(userInput); mainApp.showTodayOverview(); }
/** * Processes the key event pressed. * * @param keyEvent An event which indicates that a keystroke occurred in a component. */ private void processKeyEventPressed(KeyEvent keyEvent) { if (keyEvent.getCode() == KeyCode.CONTROL) { controlPressed = true; } else if (keyEvent.getCode() == KeyCode.Z) { zPressed = true; } else if (keyEvent.getCode() == KeyCode.Y) { yPressed = true; } else if (keyEvent.getCode() == KeyCode.Q) { qPressed = true; } else if (keyEvent.getCode() == KeyCode.F12) { mainApp.showHelpOverview(); } else if (keyEvent.getCode() == KeyCode.F5) { mainApp.showOverdueOverview(); } else if (keyEvent.getCode() == KeyCode.F4) { mainApp.showCompleteOverview(); } else if (keyEvent.getCode() == KeyCode.F3) { mainApp.showUpcomingOverview(); } else if (keyEvent.getCode() == KeyCode.F2) { mainApp.showTodayOverview(); } else if (keyEvent.getCode() == KeyCode.F1) { mainApp.showTaskOverview(); } else if (keyEvent.getCode() == KeyCode.F11) { mainApp.getPrimaryStage().toBack(); } else if (keyEvent.getCode() == KeyCode.ESCAPE) { commandText.setText("home"); onEnter(); } if (controlPressed && zPressed) { commandText.setText("undo"); onEnter(); } if (controlPressed && yPressed) { commandText.setText("redo"); onEnter(); } if (controlPressed && qPressed) { System.exit(0); } }
/** When today tab is clicked, show today's overview. */ @FXML void onClickedToday() { mainApp.showTodayOverview(); }