// Path: src/main/java/uk/co/compendiumdev/javafortesters/gui/javafx/Config.java
// public class Config {
// 
//     public static int getDefaultWindowWidth(){
//         return 600;
//     }
// 
//     public static int getDefaultWindowHeight(){
//         return 200;
//     }
// 
//     // string of paired characters, first is the 'wanted' char, next is the 'shifted' char
//     // escaped modifier in string representation are at the end
//     private static String defaultShiftModifiers = "~`!1@2$4%5^6&7*8(9)0_-+={[}]:;<,>.?/" + '"' + "'" + "|" + '\\';
// 
//     // £3
//     // had to take £ out of the above as it failed when added to the default config
// 
//     public static String currentShiftModifiers = defaultShiftModifiers;
// 
//     public static String getCurrentShiftModifiers() {
//         return currentShiftModifiers;
//     }
// 
//     public static void setCurrentShiftModifiers(String currentShiftModifiers) {
//         Config.currentShiftModifiers = currentShiftModifiers;
//     }
// 
//     public static String getDefaultShiftModifiers() {
//         return defaultShiftModifiers;
//     }
// }
// 
// Path: src/main/java/uk/co/compendiumdev/javafortesters/gui/javafx/utils/JavaFX.java
// public class JavaFX {
// 
//     public static Button button(String text, String tooltip) {
//         Button abutton = new Button();
//         abutton.setText(text);
//         abutton.setTooltip(new Tooltip(tooltip));
//         return abutton;
//     }
// 
//     public static TextField textField(String text, String tooltip) {
//         TextField aTextField = new TextField ();
//         aTextField.setText(text);
//         aTextField.setTooltip(new Tooltip(tooltip));
//         return aTextField;
//     }
// 
//     public static TextField textField(String text, String tooltip, int maxWidth) {
//         TextField aTextField = textField(text, tooltip);
//         aTextField.setMaxWidth(maxWidth);
//         return aTextField;
//     }
// 
//     public static void alertErrorDialogWithException(Throwable ex, String title) {
//         Alert alert = new Alert(Alert.AlertType.ERROR);
//         alert.setTitle("Exception Dialog");
//         alert.setHeaderText(title);
//         alert.setContentText(ex.getMessage());
// 
//         // Create expandable Exception.
//         StringWriter sw = new StringWriter();
//         PrintWriter pw = new PrintWriter(sw);
//         ex.printStackTrace(pw);
//         String exceptionText = sw.toString();
// 
//         Label label = new Label("The exception stacktrace was:");
// 
//         TextArea textArea = new TextArea(exceptionText);
//         textArea.setEditable(false);
//         textArea.setWrapText(true);
// 
//         textArea.setMaxWidth(Double.MAX_VALUE);
//         textArea.setMaxHeight(Double.MAX_VALUE);
//         GridPane.setVgrow(textArea, Priority.ALWAYS);
//         GridPane.setHgrow(textArea, Priority.ALWAYS);
// 
//         GridPane expContent = new GridPane();
//         expContent.setMaxWidth(Double.MAX_VALUE);
//         expContent.add(label, 0, 0);
//         expContent.add(textArea, 0, 1);
// 
//         // Set expandable Exception into the dialog pane.
//         alert.getDialogPane().setExpandableContent(expContent);
// 
//         alert.showAndWait();
// 
//     }
//     public static void alertErrorDialogWithException(Throwable ex) {
//         alertErrorDialogWithException(ex, "General Exception");
//     }
// 
//     public static void showSimpleErrorAlert(String title, String message) {
//         // http://code.makery.ch/blog/javafx-dialogs-official/
//         Alert alert = new Alert(Alert.AlertType.ERROR);
//         alert.setTitle(title);
//         alert.setHeaderText(null);
//         alert.setContentText(message);
//         alert.showAndWait();
// 
//     }
// 
//     public static void sendTextToClipboard(String textToSend) {
//         Clipboard clipboard = Clipboard.getSystemClipboard();
//         clipboard.clear();
//         ClipboardContent content = new ClipboardContent();
//         content.putString(textToSend);
//         clipboard.setContent(content);
//     }
// }


import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import uk.co.compendiumdev.javafortesters.gui.javafx.Config;
import uk.co.compendiumdev.javafortesters.gui.javafx.utils.JavaFX;
package uk.co.compendiumdev.javafortesters.gui.javafx.stages;


/*
    20170306 knocked up quick typer for my use
    Not ready for prime time
    - does not handle upper case
    - does not handle special chars (except * which is hard coded
    - when fix this then can enable in MainGui
 */

public class ConfigEditStage extends Stage {

    private static ConfigEditStage configEditStage =null;

    public static void singletonActivate(){

        if(configEditStage ==null)
            configEditStage = new ConfigEditStage(false);

        configEditStage.show();
        configEditStage.requestFocus();
    }

    public static EventHandler<ActionEvent> getActivationEvent() {
        return new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                ConfigEditStage.singletonActivate();
            }
        };
    }

    public ConfigEditStage(boolean hidden) {

        BorderPane root = new BorderPane();

        HBox modifiersControl = new HBox();
            final Label modifiersLabel = new Label("Shift Modifiers:");
// Path: src/main/java/uk/co/compendiumdev/javafortesters/gui/javafx/Config.java
// public class Config {
// 
//     public static int getDefaultWindowWidth(){
//         return 600;
//     }
// 
//     public static int getDefaultWindowHeight(){
//         return 200;
//     }
// 
//     // string of paired characters, first is the 'wanted' char, next is the 'shifted' char
//     // escaped modifier in string representation are at the end
//     private static String defaultShiftModifiers = "~`!1@2$4%5^6&7*8(9)0_-+={[}]:;<,>.?/" + '"' + "'" + "|" + '\\';
// 
//     // £3
//     // had to take £ out of the above as it failed when added to the default config
// 
//     public static String currentShiftModifiers = defaultShiftModifiers;
// 
//     public static String getCurrentShiftModifiers() {
//         return currentShiftModifiers;
//     }
// 
//     public static void setCurrentShiftModifiers(String currentShiftModifiers) {
//         Config.currentShiftModifiers = currentShiftModifiers;
//     }
// 
//     public static String getDefaultShiftModifiers() {
//         return defaultShiftModifiers;
//     }
// }
// 
// Path: src/main/java/uk/co/compendiumdev/javafortesters/gui/javafx/utils/JavaFX.java
// public class JavaFX {
// 
//     public static Button button(String text, String tooltip) {
//         Button abutton = new Button();
//         abutton.setText(text);
//         abutton.setTooltip(new Tooltip(tooltip));
//         return abutton;
//     }
// 
//     public static TextField textField(String text, String tooltip) {
//         TextField aTextField = new TextField ();
//         aTextField.setText(text);
//         aTextField.setTooltip(new Tooltip(tooltip));
//         return aTextField;
//     }
// 
//     public static TextField textField(String text, String tooltip, int maxWidth) {
//         TextField aTextField = textField(text, tooltip);
//         aTextField.setMaxWidth(maxWidth);
//         return aTextField;
//     }
// 
//     public static void alertErrorDialogWithException(Throwable ex, String title) {
//         Alert alert = new Alert(Alert.AlertType.ERROR);
//         alert.setTitle("Exception Dialog");
//         alert.setHeaderText(title);
//         alert.setContentText(ex.getMessage());
// 
//         // Create expandable Exception.
//         StringWriter sw = new StringWriter();
//         PrintWriter pw = new PrintWriter(sw);
//         ex.printStackTrace(pw);
//         String exceptionText = sw.toString();
// 
//         Label label = new Label("The exception stacktrace was:");
// 
//         TextArea textArea = new TextArea(exceptionText);
//         textArea.setEditable(false);
//         textArea.setWrapText(true);
// 
//         textArea.setMaxWidth(Double.MAX_VALUE);
//         textArea.setMaxHeight(Double.MAX_VALUE);
//         GridPane.setVgrow(textArea, Priority.ALWAYS);
//         GridPane.setHgrow(textArea, Priority.ALWAYS);
// 
//         GridPane expContent = new GridPane();
//         expContent.setMaxWidth(Double.MAX_VALUE);
//         expContent.add(label, 0, 0);
//         expContent.add(textArea, 0, 1);
// 
//         // Set expandable Exception into the dialog pane.
//         alert.getDialogPane().setExpandableContent(expContent);
// 
//         alert.showAndWait();
// 
//     }
//     public static void alertErrorDialogWithException(Throwable ex) {
//         alertErrorDialogWithException(ex, "General Exception");
//     }
// 
//     public static void showSimpleErrorAlert(String title, String message) {
//         // http://code.makery.ch/blog/javafx-dialogs-official/
//         Alert alert = new Alert(Alert.AlertType.ERROR);
//         alert.setTitle(title);
//         alert.setHeaderText(null);
//         alert.setContentText(message);
//         alert.showAndWait();
// 
//     }
// 
//     public static void sendTextToClipboard(String textToSend) {
//         Clipboard clipboard = Clipboard.getSystemClipboard();
//         clipboard.clear();
//         ClipboardContent content = new ClipboardContent();
//         content.putString(textToSend);
//         clipboard.setContent(content);
//     }
// }


// Path: src/main/java/uk/co/compendiumdev/javafortesters/gui/javafx/stages/ConfigEditStage.java
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import uk.co.compendiumdev.javafortesters.gui.javafx.Config;
import uk.co.compendiumdev.javafortesters.gui.javafx.utils.JavaFX;

package uk.co.compendiumdev.javafortesters.gui.javafx.stages;


/*
    20170306 knocked up quick typer for my use
    Not ready for prime time
    - does not handle upper case
    - does not handle special chars (except * which is hard coded
    - when fix this then can enable in MainGui
 */

public class ConfigEditStage extends Stage {

    private static ConfigEditStage configEditStage =null;

    public static void singletonActivate(){

        if(configEditStage ==null)
            configEditStage = new ConfigEditStage(false);

        configEditStage.show();
        configEditStage.requestFocus();
    }

    public static EventHandler<ActionEvent> getActivationEvent() {
        return new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                ConfigEditStage.singletonActivate();
            }
        };
    }

    public ConfigEditStage(boolean hidden) {

        BorderPane root = new BorderPane();

        HBox modifiersControl = new HBox();
            final Label modifiersLabel = new Label("Shift Modifiers:");
            final TextField modifiers = JavaFX.textField(Config.getCurrentShiftModifiers(), "A list of pairs of chars - \n first char is the char we want to type, \n next char is the key we press with \n shift to get the wanted char \n e.g. !1 means I want ! so press 1 with shift key");