MainSettings(View|Controller) -> StationSettings(View|Controller)

We want to reserve those to be associated with the actual main settings (i.e. the overall settings rather than specific to one station)
This commit is contained in:
Nathan McRae 2025-01-29 21:09:17 -08:00
parent b9d95acd04
commit 792baa9d3a
4 changed files with 10 additions and 10 deletions

View File

@ -20,14 +20,14 @@
private Button cancelButton; private Button cancelButton;
private int digitsPerGroup; private int digitsPerGroup;
private MainSettingsController mainSettingsController; private StationSettingsController stationSettingsController;
public void setDigitsPerGroup(int newDigitsPerGroup) { public void setDigitsPerGroup(int newDigitsPerGroup) {
digitsPerGroup = newDigitsPerGroup; digitsPerGroup = newDigitsPerGroup;
} }
public void setMainSettingsController(MainSettingsController mainSettingsController) { public void setStationSettingsController(StationSettingsController stationSettingsController) {
this.mainSettingsController = mainSettingsController; this.stationSettingsController = stationSettingsController;
} }
@FXML @FXML
@ -129,7 +129,7 @@
private void handleOkButtonPress() { private void handleOkButtonPress() {
String prefix = prefixField.getText(); String prefix = prefixField.getText();
if (prefix != null && !prefix.isEmpty()) { if (prefix != null && !prefix.isEmpty()) {
mainSettingsController.addPrefix(prefix.replaceAll(" ", "")); stationSettingsController.addPrefix(prefix.replaceAll(" ", ""));
closeWindow(); closeWindow();
} }
} }

View File

@ -54,10 +54,10 @@ public class MainController implements Initializable {
if (settingsStage == null || !settingsStage.isShowing()) { if (settingsStage == null || !settingsStage.isShowing()) {
try { try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MainSettingsView.fxml")); FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("StationSettingsView.fxml"));
Parent root = fxmlLoader.load(); Parent root = fxmlLoader.load();
MainSettingsController controller = fxmlLoader.getController(); StationSettingsController controller = fxmlLoader.getController();
if (selectedStation == null) { if (selectedStation == null) {
Alert alert = new Alert(Alert.AlertType.WARNING); Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Invalid Station Selected"); alert.setTitle("Invalid Station Selected");

View File

@ -42,7 +42,7 @@ import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
import javafx.util.Callback; import javafx.util.Callback;
public class MainSettingsController { public class StationSettingsController {
private IntegerProperty digitsPerGroup = new SimpleIntegerProperty(); private IntegerProperty digitsPerGroup = new SimpleIntegerProperty();
private StringProperty externalProgramCommand = new SimpleStringProperty(); private StringProperty externalProgramCommand = new SimpleStringProperty();
private BooleanProperty manageScheduleExternally = new SimpleBooleanProperty(); private BooleanProperty manageScheduleExternally = new SimpleBooleanProperty();
@ -120,7 +120,7 @@ public class MainSettingsController {
@FXML @FXML
private RadioButton weeklyRadioButton; private RadioButton weeklyRadioButton;
public MainSettingsController() { } public StationSettingsController() { }
@FXML @FXML
private void initialize() { private void initialize() {
@ -331,7 +331,7 @@ public class MainSettingsController {
Parent root = loader.load(); Parent root = loader.load();
AddPrefixController controller = loader.getController(); AddPrefixController controller = loader.getController();
controller.setMainSettingsController(this); controller.setStationSettingsController(this);
controller.setDigitsPerGroup(settings.getDigitsPerGroup()); controller.setDigitsPerGroup(settings.getDigitsPerGroup());
Stage stage = new Stage(); Stage stage = new Stage();

View File

@ -18,7 +18,7 @@
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane prefHeight="700.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.numbersstation.MainSettingsController"> <AnchorPane prefHeight="700.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.numbersstation.StationSettingsController">
<children> <children>
<ScrollPane fitToWidth="true" hbarPolicy="NEVER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="700.0" prefWidth="600.0" AnchorPane.bottomAnchor="40.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <ScrollPane fitToWidth="true" hbarPolicy="NEVER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="700.0" prefWidth="600.0" AnchorPane.bottomAnchor="40.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content> <content>