Add 'manage schedule externally' setting

This commit is contained in:
Nathan McRae 2025-01-15 21:56:38 -08:00
parent 5e362673d4
commit b4ade494d0
3 changed files with 22 additions and 1 deletions

View File

@ -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<StationSettings.MessageMethod> messageMethod = new SimpleObjectProperty<>();
private ObjectProperty<StationSettings.MessagePeriod> messagePeriod = new SimpleObjectProperty<>();
@ -56,6 +62,9 @@ public class MainSettingsController {
@FXML
private TextField externalProgramCommandField;
@FXML
private CheckBox manageScheduleExternallyCheckBox;
@FXML
private Spinner<Integer> 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());

View File

@ -132,7 +132,7 @@
</Label>
<AnchorPane prefHeight="152.0" prefWidth="578.0">
<children>
<CheckBox layoutX="395.0" mnemonicParsing="false" text="Manage schedule externally" AnchorPane.rightAnchor="14.5" />
<CheckBox fx:id="manageScheduleExternallyCheckBox" layoutX="395.0" mnemonicParsing="false" text="Manage schedule externally" AnchorPane.rightAnchor="14.5" />
<RadioButton fx:id="dailyRadioButton" layoutX="14.0" layoutY="8.0" mnemonicParsing="false" text="Daily">
<toggleGroup>
<ToggleGroup fx:id="messagePeriodGroup" />

View File

@ -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;
}