// Path: src/main/java/com/oskopek/studyguide/controller/EnterStringController.java
// public class EnterStringController extends AbstractController {
// 
//     private Dialog<ButtonType> dialog;
// 
//     @FXML
//     private TextField textField;
// 
//     /**
//      * Handles submitting the dialog in case the presses enter into the found course table.
//      *
//      * @param event the generated event
//      */
//     @FXML
//     private void handleOnKeyPressed(KeyEvent event) {
//         if (event.getCode() == KeyCode.ENTER) {
//             applyDialog();
//         }
//     }
// 
//     /**
//      * Closes the dialog as if the "Apply" button was clicked.
//      */
//     private void applyDialog() {
//         dialog.resultProperty().setValue(ButtonType.APPLY);
//         dialog.close();
//     }
// 
//     /**
//      * Get the input text field.
//      *
//      * @return the text field, may be null
//      */
//     public TextField getTextField() {
//         return textField;
//     }
// 
//     /**
//      * Get the dialog (used for reporting double clicks in the table).
//      *
//      * @return the dialog
//      */
//     public Dialog<ButtonType> getDialog() {
//         return dialog;
//     }
// 
//     /**
//      * Set the dialog (used for reporting double clicks in the table).
//      *
//      * @param dialog the dialog wrapper for {@link EnterStringDialogPaneCreator}
//      */
//     public void setDialog(Dialog<ButtonType> dialog) {
//         this.dialog = dialog;
//     }
// 
//     /**
//      * Get the string the user submitted.
//      *
//      * @return the submitted string
//      */
//     public String getSubmittedString() {
//         return textField.getText();
//     }
// }


import com.oskopek.studyguide.controller.EnterStringController;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.DialogPane;
import javafx.stage.Modality;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import java.io.IOException;
import java.io.InputStream;
package com.oskopek.studyguide.view;



/**
 * Dialog for entering a String. Creates a DialogPane encapsulated in it's controller.
 */
@Singleton
public class EnterStringDialogPaneCreator {

    @Inject
    @Named("fxmlloader")
    private Instance<FXMLLoader> fxmlLoader;

    /**
     * Create the dialog for entering a String.
     *
     * @param prompt the string message to prompt the user with
     * @return the controller of the dialog window, enabling to display the dialog and read the selected result
     */
    public EnterStringController create(String prompt) {
        FXMLLoader fxmlLoader = this.fxmlLoader.get();
        DialogPane dialogPane = null;
        try (InputStream is = getClass().getResourceAsStream("EnterStringDialogPane.fxml")) {
// Path: src/main/java/com/oskopek/studyguide/controller/EnterStringController.java
// public class EnterStringController extends AbstractController {
// 
//     private Dialog<ButtonType> dialog;
// 
//     @FXML
//     private TextField textField;
// 
//     /**
//      * Handles submitting the dialog in case the presses enter into the found course table.
//      *
//      * @param event the generated event
//      */
//     @FXML
//     private void handleOnKeyPressed(KeyEvent event) {
//         if (event.getCode() == KeyCode.ENTER) {
//             applyDialog();
//         }
//     }
// 
//     /**
//      * Closes the dialog as if the "Apply" button was clicked.
//      */
//     private void applyDialog() {
//         dialog.resultProperty().setValue(ButtonType.APPLY);
//         dialog.close();
//     }
// 
//     /**
//      * Get the input text field.
//      *
//      * @return the text field, may be null
//      */
//     public TextField getTextField() {
//         return textField;
//     }
// 
//     /**
//      * Get the dialog (used for reporting double clicks in the table).
//      *
//      * @return the dialog
//      */
//     public Dialog<ButtonType> getDialog() {
//         return dialog;
//     }
// 
//     /**
//      * Set the dialog (used for reporting double clicks in the table).
//      *
//      * @param dialog the dialog wrapper for {@link EnterStringDialogPaneCreator}
//      */
//     public void setDialog(Dialog<ButtonType> dialog) {
//         this.dialog = dialog;
//     }
// 
//     /**
//      * Get the string the user submitted.
//      *
//      * @return the submitted string
//      */
//     public String getSubmittedString() {
//         return textField.getText();
//     }
// }


// Path: src/main/java/com/oskopek/studyguide/view/EnterStringDialogPaneCreator.java
import com.oskopek.studyguide.controller.EnterStringController;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.DialogPane;
import javafx.stage.Modality;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import java.io.IOException;
import java.io.InputStream;

package com.oskopek.studyguide.view;



/**
 * Dialog for entering a String. Creates a DialogPane encapsulated in it's controller.
 */
@Singleton
public class EnterStringDialogPaneCreator {

    @Inject
    @Named("fxmlloader")
    private Instance<FXMLLoader> fxmlLoader;

    /**
     * Create the dialog for entering a String.
     *
     * @param prompt the string message to prompt the user with
     * @return the controller of the dialog window, enabling to display the dialog and read the selected result
     */
    public EnterStringController create(String prompt) {
        FXMLLoader fxmlLoader = this.fxmlLoader.get();
        DialogPane dialogPane = null;
        try (InputStream is = getClass().getResourceAsStream("EnterStringDialogPane.fxml")) {
            dialogPane = fxmlLoader.load(is);