@FXML
 private void handleNewTitle() {
   Programs tempProgs = new Programs();
   boolean okClicked = mainApp.showProgramsEditDialog(tempProgs);
   if (okClicked) {
     mainApp.getProgramsData().add(tempProgs);
   }
 }
 @FXML
 private void handleEditTitle() {
   Programs selectedTitle = progsTable.getSelectionModel().getSelectedItem();
   if (selectedTitle != null) {
     boolean okClicked = mainApp.showProgramsEditDialog(selectedTitle);
     if (okClicked) {
       showProgramsDetails(selectedTitle);
     }
   } else {
     // Nothing selected.
     Alert alert = new Alert(AlertType.ERROR);
     alert.initOwner(mainApp.getPrimaryStage());
     alert.setTitle("No Selection");
     alert.setHeaderText("No Title Selected!");
     alert.setContentText("Please select a Title in the table!");
     alert.showAndWait();
   }
 }
  @FXML
  private void handleDeleteTitle() {
    int selectedIndex = progsTable.getSelectionModel().getSelectedIndex();

    if (selectedIndex >= 0) {
      progsTable.getItems().remove(selectedIndex);
    } else {
      // nothing selected
      alert = new Alert(AlertType.WARNING);
      alert.initOwner(mainApp.getPrimaryStage());
      alert.setTitle("No Selection");
      alert.setHeaderText("No Title Selected");
      alert.setContentText("Please select a Title in the table");
      alert.showAndWait();
    }
  }
  /*
   * MainApp reference
   */
  public void setMainApp(MainApp mainApp) {
    this.mainApp = mainApp;

    // Add observable list data to the table
    progsTable.setItems(mainApp.getProgramsData());
  }