Add message period to settings
This commit is contained in:
parent
f645cdccc7
commit
102c16e318
@ -31,6 +31,7 @@ public class MainSettingsController {
|
||||
private StringProperty externalProgramCommand = new SimpleStringProperty();
|
||||
private IntegerProperty messageLength = new SimpleIntegerProperty();
|
||||
private ObjectProperty<StationSettings.MessageMethod> messageMethod = new SimpleObjectProperty<>();
|
||||
private ObjectProperty<StationSettings.MessagePeriod> messagePeriod = new SimpleObjectProperty<>();
|
||||
private StringProperty password = new SimpleStringProperty();
|
||||
private StationSettings settings;
|
||||
private StringProperty stationAddress = new SimpleStringProperty();
|
||||
@ -43,6 +44,9 @@ public class MainSettingsController {
|
||||
@FXML
|
||||
private TextField stationAddressField;
|
||||
|
||||
@FXML
|
||||
private RadioButton dailyRadioButton;
|
||||
|
||||
@FXML
|
||||
private Spinner<Integer> digitsPerGroupSpinner;
|
||||
|
||||
@ -55,6 +59,12 @@ public class MainSettingsController {
|
||||
@FXML
|
||||
private ToggleGroup messageMethodGroup;
|
||||
|
||||
@FXML
|
||||
private ToggleGroup messagePeriodGroup;
|
||||
|
||||
@FXML
|
||||
private RadioButton monthlyRadioButton;
|
||||
|
||||
@FXML
|
||||
private RadioButton ftpRadioButton;
|
||||
|
||||
@ -76,6 +86,9 @@ public class MainSettingsController {
|
||||
@FXML
|
||||
private ListView<String> prefixListView;
|
||||
|
||||
@FXML
|
||||
private RadioButton weeklyRadioButton;
|
||||
|
||||
public MainSettingsController() { }
|
||||
|
||||
@FXML
|
||||
@ -116,6 +129,26 @@ public class MainSettingsController {
|
||||
}
|
||||
});
|
||||
|
||||
messagePeriodGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue == dailyRadioButton) {
|
||||
messagePeriod.set(StationSettings.MessagePeriod.DAILY);
|
||||
} else if (newValue == monthlyRadioButton) {
|
||||
messagePeriod.set(StationSettings.MessagePeriod.MONTHLY);
|
||||
} else if (newValue == weeklyRadioButton) {
|
||||
messagePeriod.set(StationSettings.MessagePeriod.WEEKLY);
|
||||
}
|
||||
});
|
||||
|
||||
messagePeriod.addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue == StationSettings.MessagePeriod.DAILY) {
|
||||
messagePeriodGroup.selectToggle(dailyRadioButton);
|
||||
} else if (newValue == StationSettings.MessagePeriod.MONTHLY) {
|
||||
messagePeriodGroup.selectToggle(monthlyRadioButton);
|
||||
} else if (newValue == StationSettings.MessagePeriod.WEEKLY) {
|
||||
messagePeriodGroup.selectToggle(weeklyRadioButton);
|
||||
}
|
||||
});
|
||||
|
||||
// Set user data. Default result is no update.
|
||||
stationNameField.sceneProperty().addListener((observable, oldScene, newScene) -> {
|
||||
if (newScene != null) {
|
||||
@ -160,6 +193,7 @@ public class MainSettingsController {
|
||||
settings.setExternalProgramCommand(externalProgramCommand.get());
|
||||
settings.setMessageLength(messageLength.get());
|
||||
settings.setMessageMethod(messageMethod.get());
|
||||
settings.setMessagePeriod(messagePeriod.get());
|
||||
settings.setName(stationName.get());
|
||||
settings.setPassword(password.get());
|
||||
settings.getPrefixes().clear();
|
||||
@ -190,6 +224,7 @@ public class MainSettingsController {
|
||||
externalProgramCommand.set(settings.getExternalProgramCommand());
|
||||
messageLength.set(settings.getMessageLength());
|
||||
messageMethod.set(settings.getMessageMethod());
|
||||
messagePeriod.set(settings.getMessagePeriod());
|
||||
username.set(settings.getUsername());
|
||||
password.set(settings.getPassword());
|
||||
prefixListView.getItems().addAll(settings.getPrefixes());
|
||||
|
@ -133,17 +133,26 @@
|
||||
<AnchorPane prefHeight="152.0" prefWidth="578.0">
|
||||
<children>
|
||||
<CheckBox layoutX="395.0" mnemonicParsing="false" text="Manage schedule externally" AnchorPane.rightAnchor="14.5" />
|
||||
<RadioButton layoutX="14.0" layoutY="8.0" mnemonicParsing="false" text="Daily">
|
||||
<RadioButton fx:id="dailyRadioButton" layoutX="14.0" layoutY="8.0" mnemonicParsing="false" text="Daily">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="scheduleFrequency" />
|
||||
<ToggleGroup fx:id="messagePeriodGroup" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="weeklyRadioButton" layoutX="14.0" layoutY="38.0" mnemonicParsing="false" text="Weekly">
|
||||
<toggleGroup>
|
||||
<fx:reference source="messagePeriodGroup" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="monthlyRadioButton" layoutX="14.0" layoutY="68.0" mnemonicParsing="false" text="Monthly">
|
||||
<toggleGroup>
|
||||
<fx:reference source="messagePeriodGroup" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton layoutX="14.0" layoutY="38.0" mnemonicParsing="false" text="Weekly" toggleGroup="$scheduleFrequency" />
|
||||
<RadioButton layoutX="14.0" layoutY="68.0" mnemonicParsing="false" text="Monthly" toggleGroup="$scheduleFrequency" />
|
||||
<DatePicker layoutX="115.0" layoutY="34.0" />
|
||||
<Label layoutX="115.0" layoutY="8.0" text="Starting from:" />
|
||||
<TextField layoutX="115.0" layoutY="64.0" text="23:24:49" />
|
||||
<Label layoutX="48.0" layoutY="102.0" text="TODO: Jitter" />
|
||||
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
|
@ -8,6 +8,7 @@ public class StationSettings {
|
||||
private String externalProgramCommand;
|
||||
private int messageLength;
|
||||
private MessageMethod messageMethod;
|
||||
private MessagePeriod messagePeriod;
|
||||
private String name;
|
||||
private String password;
|
||||
private ArrayList<String> prefixes;
|
||||
@ -20,6 +21,12 @@ public class StationSettings {
|
||||
EXTERNAL_PROGRAM
|
||||
}
|
||||
|
||||
public enum MessagePeriod {
|
||||
DAILY,
|
||||
WEEKLY,
|
||||
MONTHLY
|
||||
}
|
||||
|
||||
public StationSettings() {
|
||||
prefixes = new ArrayList<String>();
|
||||
}
|
||||
@ -68,6 +75,14 @@ public class StationSettings {
|
||||
messageMethod = newMessageMethod;
|
||||
}
|
||||
|
||||
public MessagePeriod getMessagePeriod() {
|
||||
return messagePeriod;
|
||||
}
|
||||
|
||||
public void setMessagePeriod(MessagePeriod newMessagePeriod) {
|
||||
messagePeriod = newMessagePeriod;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user