@FXML private void handleNewDepartment() { ViewDepartment tempDepartment = new ViewDepartment(); boolean okClicked = main.showDepartmentEditDialog(tempDepartment, true); if (okClicked) { main.getDepartments().add(tempDepartment); } }
@FXML private void handleEditDepartment() { ViewDepartment selectedDepartment = departmentTable.getSelectionModel().getSelectedItem(); if (selectedDepartment != null) { boolean okClicked = main.showDepartmentEditDialog(selectedDepartment, false); if (okClicked) {} } else { Alert alert = new Alert(AlertType.WARNING); alert.initOwner(main.getPrimaryStage()); alert.setTitle("Ничего не выбрано"); alert.setHeaderText("Ни один отдел не выбран"); alert.setContentText("Пожалуйста, выберите отдел в таблице"); alert.showAndWait(); } }