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

View File

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

View File

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

View File

@ -18,7 +18,7 @@
<?import javafx.scene.layout.VBox?>
<?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>
<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>