diff --git a/src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java index d5699f1..b73388e 100644 --- a/src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java +++ b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java @@ -7,8 +7,10 @@ import java.io.File; import java.io.IOException; import java.util.Optional; import java.time.LocalDate; +import javafx.beans.property.BooleanProperty; import javafx.beans.property.IntegerProperty; import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; @@ -17,6 +19,7 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.Event; import javafx.fxml.FXML; +import javafx.scene.control.CheckBox; import javafx.scene.control.DatePicker; import javafx.scene.control.ListView; import javafx.scene.control.RadioButton; @@ -25,12 +28,15 @@ import javafx.scene.control.SpinnerValueFactory; import javafx.scene.control.TextField; import javafx.scene.control.TextInputDialog; import javafx.scene.control.ToggleGroup; +import javafx.scene.input.KeyEvent; +import javafx.scene.input.KeyCode; import javafx.scene.Node; import javafx.stage.Stage; public class MainSettingsController { private IntegerProperty digitsPerGroup = new SimpleIntegerProperty(); private StringProperty externalProgramCommand = new SimpleStringProperty(); + private BooleanProperty manageScheduleExternally = new SimpleBooleanProperty(); private IntegerProperty messageLength = new SimpleIntegerProperty(); private ObjectProperty messageMethod = new SimpleObjectProperty<>(); private ObjectProperty messagePeriod = new SimpleObjectProperty<>(); @@ -56,6 +62,9 @@ public class MainSettingsController { @FXML private TextField externalProgramCommandField; + @FXML + private CheckBox manageScheduleExternallyCheckBox; + @FXML private Spinner messageLengthSpinner; @@ -100,6 +109,7 @@ public class MainSettingsController { @FXML private void initialize() { externalProgramCommandField.textProperty().bindBidirectional(externalProgramCommand); + manageScheduleExternallyCheckBox.selectedProperty().bindBidirectional(manageScheduleExternally); stationNameField.textProperty().bindBidirectional(stationName); stationAddressField.textProperty().bindBidirectional(stationAddress); passwordField.textProperty().bindBidirectional(password); @@ -198,6 +208,7 @@ public class MainSettingsController { settings.setAddress(stationAddress.get()); settings.setDigitsPerGroup(digitsPerGroup.get()); settings.setExternalProgramCommand(externalProgramCommand.get()); + settings.setManageScheduleExternally(manageScheduleExternally.get()); settings.setMessageLength(messageLength.get()); settings.setMessageMethod(messageMethod.get()); settings.setMessagePeriod(messagePeriod.get()); @@ -230,6 +241,7 @@ public class MainSettingsController { stationName.set(settings.getName()); digitsPerGroup.set(settings.getDigitsPerGroup()); externalProgramCommand.set(settings.getExternalProgramCommand()); + manageScheduleExternally.set(settings.getManageScheduleExternally()); messageLength.set(settings.getMessageLength()); messageMethod.set(settings.getMessageMethod()); messagePeriod.set(settings.getMessagePeriod()); diff --git a/src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml index b8b9845..908ec8d 100644 --- a/src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml +++ b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml @@ -132,7 +132,7 @@ - + diff --git a/src/main/java/name/nathanmcrae/numbersstation/StationSettings.java b/src/main/java/name/nathanmcrae/numbersstation/StationSettings.java index 7ed404d..417b86b 100644 --- a/src/main/java/name/nathanmcrae/numbersstation/StationSettings.java +++ b/src/main/java/name/nathanmcrae/numbersstation/StationSettings.java @@ -7,6 +7,7 @@ public class StationSettings { private String address; private int digitsPerGroup; private String externalProgramCommand; + private boolean manageScheduleExternally; private int messageLength; private MessageMethod messageMethod; private MessagePeriod messagePeriod; @@ -61,6 +62,14 @@ public class StationSettings { externalProgramCommand = newExternalProgramCommand; } + public boolean getManageScheduleExternally() { + return manageScheduleExternally; + } + + public void setManageScheduleExternally(boolean newManageScheduleExternally) { + manageScheduleExternally = newManageScheduleExternally; + } + public int getMessageLength() { return messageLength; }