// Path: src/main/java/jigspuzzle/JigSPuzzle.java
// public class JigSPuzzle {
// 
//     private static JigSPuzzle instance;
// 
//     public static JigSPuzzle getInstance() {
//         if (instance == null) {
//             instance = new JigSPuzzle();
//         }
//         return instance;
//     }
// 
//     /**
//      * @param args the command line arguments
//      */
//     public static void main(String[] args) {
//         getInstance().startGame();
//     }
// 
//     /**
//      * The main window, in which the user can play
//      */
//     IPuzzleWindow puzzleWindow;
// 
//     /**
//      * The sound player, that can play sounds in the UI.
//      */
//     ISoundPlayer soundPlayer;
// 
//     private JigSPuzzle() {
//         puzzleWindow = new PuzzleWindow();
//         soundPlayer = new SoundPlayer();
//     }
// 
//     /**
//      * Exits the complete program
//      */
//     public void exitProgram() {
//         try {
//             System.exit(0);
//         } catch (Exception ex) {
//             // in the assertJ - tests it is not possible to exit...
//             // instead, we 'reset' this class and the controller.
//             resetInstances();
//         }
//     }
// 
//     /**
//      * Returns the window on that the user can puzzle.
//      *
//      * @return
//      */
//     public IPuzzleWindow getPuzzleWindow() {
//         return puzzleWindow;
//     }
// 
//     /**
//      * Returns the player, that is used for playing sounds on the UI.
//      *
//      * @return
//      */
//     public ISoundPlayer getSoundPlayer() {
//         return soundPlayer;
//     }
// 
//     /**
//      * A methods that resets all instances to null. With this is is simulated,
//      * that the programm has exited. However, opened windows are still there.
//      * Terefore: Use only for tests.
//      *
//      * @deprecated Use only in tests.
//      */
//     public void resetInstances() {
//         instance = null;
//         PuzzleController.getInstance().resetInstance();
//         SettingsController.getInstance().resetInstance();
//         VersionController.getInstance().resetInstance();
//     }
// 
//     /**
//      * Sets the window on that the user can puzzle.
//      *
//      * @param puzzleWindow
//      * @deprecated Use only, in special cases, e.g. tests.
//      */
//     public void setPuzzleWindow(IPuzzleWindow puzzleWindow) {
//         this.puzzleWindow = puzzleWindow;
//     }
// 
//     /**
//      * Starts the game and shows the user the UI.
//      */
//     private void startGame() {
//         puzzleWindow.showPuzzleWindow();
//     }
// }


import cucumber.api.PendingException;
import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java.en.*;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPopupMenu;
import jigspuzzle.JigSPuzzle;
import org.assertj.core.api.Assertions;
import org.assertj.swing.core.BasicRobot;
import org.assertj.swing.core.GenericTypeMatcher;
import org.assertj.swing.core.Robot;
import org.assertj.swing.data.Index;
import org.assertj.swing.fixture.DialogFixture;
import org.assertj.swing.fixture.FrameFixture;
import org.assertj.swing.security.NoExitSecurityManagerInstaller;
import static org.assertj.swing.finder.WindowFinder.findDialog;
import static org.assertj.swing.finder.WindowFinder.findFrame;
import org.assertj.swing.fixture.AbstractWindowFixture;
import static org.assertj.swing.launcher.ApplicationLauncher.application;
        }
    }
    // -- Menu Bar end

    // Button: Restart puzzle
    @Then("^the button for restarting the puzzle should (not )?be enabled$")
    public void see_appearence_settings_window(String negate) {
        if (negate != null) {
            puzzleWindow.menuItem("puzzle-restart").requireDisabled();
        } else {
            puzzleWindow.menuItem("puzzle-restart").requireEnabled();
        }
    }
    // -- Button: Restart puzzle end

    // Settings window: appearance
    @Given("^(?:that )?I am on the appearance-settings window$")
    public void on_settings_window_appearance() {
        on_puzzle_window();
        open_appearence_settings_window();
    }

    @When("^I open the appearance-settings window$")
    public void open_appearence_settings_window() {
        puzzleWindow.menuItem("appearance-settings").click();
        settingsWindow = findDialog("settings").using(robot);
    }

    @Then("^I should see the appearance-settings window$")
    public void see_appearence_settings_window() {
// Path: src/main/java/jigspuzzle/JigSPuzzle.java
// public class JigSPuzzle {
// 
//     private static JigSPuzzle instance;
// 
//     public static JigSPuzzle getInstance() {
//         if (instance == null) {
//             instance = new JigSPuzzle();
//         }
//         return instance;
//     }
// 
//     /**
//      * @param args the command line arguments
//      */
//     public static void main(String[] args) {
//         getInstance().startGame();
//     }
// 
//     /**
//      * The main window, in which the user can play
//      */
//     IPuzzleWindow puzzleWindow;
// 
//     /**
//      * The sound player, that can play sounds in the UI.
//      */
//     ISoundPlayer soundPlayer;
// 
//     private JigSPuzzle() {
//         puzzleWindow = new PuzzleWindow();
//         soundPlayer = new SoundPlayer();
//     }
// 
//     /**
//      * Exits the complete program
//      */
//     public void exitProgram() {
//         try {
//             System.exit(0);
//         } catch (Exception ex) {
//             // in the assertJ - tests it is not possible to exit...
//             // instead, we 'reset' this class and the controller.
//             resetInstances();
//         }
//     }
// 
//     /**
//      * Returns the window on that the user can puzzle.
//      *
//      * @return
//      */
//     public IPuzzleWindow getPuzzleWindow() {
//         return puzzleWindow;
//     }
// 
//     /**
//      * Returns the player, that is used for playing sounds on the UI.
//      *
//      * @return
//      */
//     public ISoundPlayer getSoundPlayer() {
//         return soundPlayer;
//     }
// 
//     /**
//      * A methods that resets all instances to null. With this is is simulated,
//      * that the programm has exited. However, opened windows are still there.
//      * Terefore: Use only for tests.
//      *
//      * @deprecated Use only in tests.
//      */
//     public void resetInstances() {
//         instance = null;
//         PuzzleController.getInstance().resetInstance();
//         SettingsController.getInstance().resetInstance();
//         VersionController.getInstance().resetInstance();
//     }
// 
//     /**
//      * Sets the window on that the user can puzzle.
//      *
//      * @param puzzleWindow
//      * @deprecated Use only, in special cases, e.g. tests.
//      */
//     public void setPuzzleWindow(IPuzzleWindow puzzleWindow) {
//         this.puzzleWindow = puzzleWindow;
//     }
// 
//     /**
//      * Starts the game and shows the user the UI.
//      */
//     private void startGame() {
//         puzzleWindow.showPuzzleWindow();
//     }
// }


// Path: src/test/java/jigspuzzle/cucumber/steps/WindowsSteps.java
import cucumber.api.PendingException;
import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java.en.*;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPopupMenu;
import jigspuzzle.JigSPuzzle;
import org.assertj.core.api.Assertions;
import org.assertj.swing.core.BasicRobot;
import org.assertj.swing.core.GenericTypeMatcher;
import org.assertj.swing.core.Robot;
import org.assertj.swing.data.Index;
import org.assertj.swing.fixture.DialogFixture;
import org.assertj.swing.fixture.FrameFixture;
import org.assertj.swing.security.NoExitSecurityManagerInstaller;
import static org.assertj.swing.finder.WindowFinder.findDialog;
import static org.assertj.swing.finder.WindowFinder.findFrame;
import org.assertj.swing.fixture.AbstractWindowFixture;
import static org.assertj.swing.launcher.ApplicationLauncher.application;

        }
    }
    // -- Menu Bar end

    // Button: Restart puzzle
    @Then("^the button for restarting the puzzle should (not )?be enabled$")
    public void see_appearence_settings_window(String negate) {
        if (negate != null) {
            puzzleWindow.menuItem("puzzle-restart").requireDisabled();
        } else {
            puzzleWindow.menuItem("puzzle-restart").requireEnabled();
        }
    }
    // -- Button: Restart puzzle end

    // Settings window: appearance
    @Given("^(?:that )?I am on the appearance-settings window$")
    public void on_settings_window_appearance() {
        on_puzzle_window();
        open_appearence_settings_window();
    }

    @When("^I open the appearance-settings window$")
    public void open_appearence_settings_window() {
        puzzleWindow.menuItem("appearance-settings").click();
        settingsWindow = findDialog("settings").using(robot);
    }

    @Then("^I should see the appearance-settings window$")
    public void see_appearence_settings_window() {
        settingsWindow.tabbedPane("main-tabbed-pane").requireSelectedTab(Index.atIndex(0));