gistfile1.txt // opens a dialog to edit details for the specified person. If the user// clicks OK, the changes are saved into the provided person object and true// is returned.public boolean showPersonEditDialog(Person person) {FXMLLoader l
// opens a dialog to edit details for the specified person. If the user
// clicks OK, the changes are saved into the provided person object and true
// is returned.
public boolean showPersonEditDialog(Person person) {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(MainApp.class.getResource("view/PersonEditDialog.fxml"));
try {
AnchorPane page = (AnchorPane) loader.load();
// Create the dialog Stage.
Stage dialogStage = new Stage();
dialogStage.setTitle("Edit Person");
dialogStage.initModality(Modality.WINDOW_MODAL);
dialogStage.initOwner(primaryStage);
Scene scene = new Scene(page);
dialogStage.setScene(scene);
// set the person into the controller
PersonEditDialogController controller = loader.getController();
controller.setDialogStage(dialogStage);
controller.setPerson(person);
// show the dialog and wait until the user closes it
dialogStage.showAndWait();
return controller.isOkClicked();
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
