// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
// 
//     private final DimensionProperty diameter = new DimensionProperty();
// 
//     public BallMill() {
//     }
// 
//     public BallMill(DimensionProperty diameter) {
//         this.diameter.set(diameter);
//     }
// 
//     public DimensionProperty diameterProperty() {
//         return diameter;
//     }
// 
// }
// 
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
// 
//     private final DimensionProperty diameter = new DimensionProperty();
// 
//     public EndMill() {
//     }
// 
//     public EndMill(DimensionProperty diameter) {
//         this.diameter.set(diameter);
//     }
// 
//     public DimensionProperty diameterProperty() {
//         return diameter;
//     }
// }
// 
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/InputMaskChecker.java
// public class InputMaskChecker implements ChangeListener<String> {
// 
//     public static final String NOTEMPTY      = "^.+$";
//     public static final String NUMERIC      = "^[0-9]*$";
//     public static final String TEXTONLY     = "^\\w*$";
//     public static final String PASSWORD     = "^[\\w\\+\\!\\?\\-\\$\\&\\%£]+$";
//     public static final String DATASOURCE   = "^([a-zA-Z]+:){3}@([a-zA-Z0-9]+:)+[a-zA-Z0-9]+$";
//     public static final String TCPPORT      = "^(6553[0-5]|655[0-2]\\d|65[0-4]\\d\\d|6[0-4]\\d{3}|[1-5]\\d{4}|[2-9]\\d{3}|1[1-9]\\d{2}|10[3-9]\\d|102[4-9])$";
// 
//     private static final String STYLE = "-fx-effect: dropshadow(gaussian, red, 4, 0.0, 0, 0);";
// 
//     public final BooleanProperty erroneous = new SimpleBooleanProperty(false);
// 
//     private final String mask;
//     private final int max_lenght;
//     private final TextField control;
// 
// 
//     public InputMaskChecker(String mask, TextField control) {
//         this.mask = mask;
//         this.max_lenght = 0;
//         this.control = control;
//     }
// 
//     public InputMaskChecker(String mask, int max_lenght, TextField control) {
//         this.mask = mask;
//         this.max_lenght = max_lenght;
//         this.control = control;
//     }
// 
// 
//     @Override
//     public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) {
//         erroneous.setValue(!newValue.matches(mask) || ((max_lenght > 0) ? newValue.length() > max_lenght : false) || newValue.length() == 0);
//         control.setStyle( erroneous.get() ? STYLE : "-fx-effect: null;");
//     }
// }


import com.rvantwisk.cnctools.data.ToolParameter;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.rvantwisk.cnctools.misc.InputMaskChecker;
import javafx.beans.binding.BooleanBinding;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
    @FXML
    private RadioButton iSPindleCW;
    @FXML
    private RadioButton iSPindleCCW;
    @FXML
    private ChoiceBox<String> ddNumFlutes;

    @FXML
    private ChoiceBox cbToolType;

    private ToolParameter tool;

    public ToolParametersControl() {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ToolParameters.fxml"));
        fxmlLoader.setRoot(this);
        fxmlLoader.setController(this);
        try {
            fxmlLoader.load();
        } catch (IOException exception) {
            throw new RuntimeException(exception);
        }
    }


    @FXML
    void initialize() {
        assert iDiameter != null : "fx:id=\"iDiameter\" was not injected: check your FXML file 'ToolParameters.fxml'.";
        assert iName != null : "fx:id=\"iName\" was not injected: check your FXML file 'ToolParameters.fxml'.";


// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
// 
//     private final DimensionProperty diameter = new DimensionProperty();
// 
//     public BallMill() {
//     }
// 
//     public BallMill(DimensionProperty diameter) {
//         this.diameter.set(diameter);
//     }
// 
//     public DimensionProperty diameterProperty() {
//         return diameter;
//     }
// 
// }
// 
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
// 
//     private final DimensionProperty diameter = new DimensionProperty();
// 
//     public EndMill() {
//     }
// 
//     public EndMill(DimensionProperty diameter) {
//         this.diameter.set(diameter);
//     }
// 
//     public DimensionProperty diameterProperty() {
//         return diameter;
//     }
// }
// 
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/InputMaskChecker.java
// public class InputMaskChecker implements ChangeListener<String> {
// 
//     public static final String NOTEMPTY      = "^.+$";
//     public static final String NUMERIC      = "^[0-9]*$";
//     public static final String TEXTONLY     = "^\\w*$";
//     public static final String PASSWORD     = "^[\\w\\+\\!\\?\\-\\$\\&\\%£]+$";
//     public static final String DATASOURCE   = "^([a-zA-Z]+:){3}@([a-zA-Z0-9]+:)+[a-zA-Z0-9]+$";
//     public static final String TCPPORT      = "^(6553[0-5]|655[0-2]\\d|65[0-4]\\d\\d|6[0-4]\\d{3}|[1-5]\\d{4}|[2-9]\\d{3}|1[1-9]\\d{2}|10[3-9]\\d|102[4-9])$";
// 
//     private static final String STYLE = "-fx-effect: dropshadow(gaussian, red, 4, 0.0, 0, 0);";
// 
//     public final BooleanProperty erroneous = new SimpleBooleanProperty(false);
// 
//     private final String mask;
//     private final int max_lenght;
//     private final TextField control;
// 
// 
//     public InputMaskChecker(String mask, TextField control) {
//         this.mask = mask;
//         this.max_lenght = 0;
//         this.control = control;
//     }
// 
//     public InputMaskChecker(String mask, int max_lenght, TextField control) {
//         this.mask = mask;
//         this.max_lenght = max_lenght;
//         this.control = control;
//     }
// 
// 
//     @Override
//     public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) {
//         erroneous.setValue(!newValue.matches(mask) || ((max_lenght > 0) ? newValue.length() > max_lenght : false) || newValue.length() == 0);
//         control.setStyle( erroneous.get() ? STYLE : "-fx-effect: null;");
//     }
// }


// Path: cnctools/src/main/java/com/rvantwisk/cnctools/controls/ToolParametersControl.java
import com.rvantwisk.cnctools.data.ToolParameter;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.rvantwisk.cnctools.misc.InputMaskChecker;
import javafx.beans.binding.BooleanBinding;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

    @FXML
    private RadioButton iSPindleCW;
    @FXML
    private RadioButton iSPindleCCW;
    @FXML
    private ChoiceBox<String> ddNumFlutes;

    @FXML
    private ChoiceBox cbToolType;

    private ToolParameter tool;

    public ToolParametersControl() {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ToolParameters.fxml"));
        fxmlLoader.setRoot(this);
        fxmlLoader.setController(this);
        try {
            fxmlLoader.load();
        } catch (IOException exception) {
            throw new RuntimeException(exception);
        }
    }


    @FXML
    void initialize() {
        assert iDiameter != null : "fx:id=\"iDiameter\" was not injected: check your FXML file 'ToolParameters.fxml'.";
        assert iName != null : "fx:id=\"iName\" was not injected: check your FXML file 'ToolParameters.fxml'.";


        final InputMaskChecker listener1 = new InputMaskChecker(InputMaskChecker.NOTEMPTY, iName);