public void applyHardwareAxisSettings(Tab _tab) throws Exception {
GridPane _gp = (GridPane) _tab.getContent();
int size = _gp.getChildren().size();
Axis _axis = this.machine.getAxisByName(String.valueOf(_gp.getId().charAt(0)));
int i;
for (i = 0; i < size; i++) {
if (_gp.getChildren().get(i).getClass().toString().contains("TextField")) {
//This ia a TextField... Lets get the value and apply it if it needs to be applied.
TextField tf = (TextField) _gp.getChildren().get(i);
applyHardwareAxisSettings(_axis, tf);
} else if (_gp.getChildren().get(i) instanceof ChoiceBox) {
//This ia a ChoiceBox... Lets get the value and apply it if it needs to be applied.
@SuppressWarnings("unchecked")
ChoiceBox<Object> cb = (ChoiceBox<Object>) _gp.getChildren().get(i);
if (cb.getId().contains("AxisMode")) {
int axisMode = cb.getSelectionModel().getSelectedIndex();
String configObj = String.format("{\"%s%s\":%s}\n", _axis.getAxis_name().toLowerCase(), MnemonicManager.MNEMONIC_AXIS_AXIS_MODE, axisMode);
this.write(configObj);
continue;
} else if (cb.getId().contains("switchModeMax")) {
int switchMode = cb.getSelectionModel().getSelectedIndex();
String configObj = String.format("{\"%s%s\":%s}\n", _axis.getAxis_name().toLowerCase(), MnemonicManager.MNEMONIC_AXIS_MAX_SWITCH_MODE, switchMode);
this.write(configObj);
} else if (cb.getId().contains("switchModeMin")) {
int switchMode = cb.getSelectionModel().getSelectedIndex();
String configObj = String.format("{\"%s%s\":%s}\n", _axis.getAxis_name().toLowerCase(), MnemonicManager.MNEMONIC_AXIS_MIN_SWITCH_MODE, switchMode);
this.write(configObj);
}
}
}