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