Add schedule start date setting
This commit is contained in:
parent
008d1e2d6b
commit
5e362673d4
@ -1,6 +1,6 @@
|
||||
$Env:JAVA_HOME = "C:\Users\nathanm\Downloads\openjdk-23.0.1_windows-x64_bin\jdk-23.0.1"
|
||||
$Env:PATH = "C:\Users\nathanm\Downloads\openjdk-23.0.1_windows-x64_bin\jdk-23.0.1\bin;$($Env:PATH)"
|
||||
$Env:PATH_TO_FX="C:\Users\nathanm\Downloads\openjfx-23.0.1_windows-x64_bin-sdk\javafx-sdk-23.0.1\lib"
|
||||
javac --module-path "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib" --add-modules javafx.controls,javafx.fxml,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml .\name\nathanmcrae\numbersstation\*.java -d out
|
||||
javac --module-path "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib" --add-modules javafx.controls,javafx.fxml,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml,com.fasterxml.jackson.datatype.jsr310 .\name\nathanmcrae\numbersstation\*.java -d out
|
||||
cp name/nathanmcrae/numbersstation/*.fxml out/name/nathanmcrae/numbersstation
|
||||
java --module-path "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib" --add-modules javafx.controls,javafx.fxml,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml -cp out name.nathanmcrae.numbersstation.Main
|
||||
java --module-path "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib" --add-modules javafx.controls,javafx.fxml,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml,com.fasterxml.jackson.datatype.jsr310 -cp out name.nathanmcrae.numbersstation.Main
|
||||
|
@ -1,6 +1,9 @@
|
||||
package name.nathanmcrae.numbersstation;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@ -113,6 +116,7 @@ public class MainController implements Initializable {
|
||||
|
||||
private void loadSettings() throws IOException {
|
||||
XmlMapper xmlMapper = new XmlMapper();
|
||||
xmlMapper.registerModule(new JavaTimeModule());
|
||||
String userHome = System.getProperty("user.home");
|
||||
// TODO: XDG
|
||||
Path directoryPath = Paths.get(userHome, ".numbers-station");
|
||||
|
@ -1,6 +1,10 @@
|
||||
package name.nathanmcrae.numbersstation;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@ -51,6 +55,8 @@ public class MainSettings {
|
||||
|
||||
public void save() {
|
||||
XmlMapper xmlMapper = new XmlMapper();
|
||||
xmlMapper.registerModule(new JavaTimeModule());
|
||||
xmlMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
|
||||
try {
|
||||
String userHome = System.getProperty("user.home");
|
||||
Path directoryPath = Paths.get(userHome, ".numbers-station");
|
||||
|
@ -6,6 +6,7 @@ import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
import java.time.LocalDate;
|
||||
import javafx.beans.property.IntegerProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
@ -16,6 +17,7 @@ import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.Event;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.Spinner;
|
||||
@ -36,6 +38,7 @@ public class MainSettingsController {
|
||||
private StationSettings settings;
|
||||
private StringProperty stationAddress = new SimpleStringProperty();
|
||||
private StringProperty stationName = new SimpleStringProperty();
|
||||
private ObjectProperty<LocalDate> scheduleStartDate = new SimpleObjectProperty<>();
|
||||
private StringProperty username = new SimpleStringProperty();
|
||||
|
||||
@FXML
|
||||
@ -86,6 +89,9 @@ public class MainSettingsController {
|
||||
@FXML
|
||||
private ListView<String> prefixListView;
|
||||
|
||||
@FXML
|
||||
private DatePicker scheduleStartDatePicker;
|
||||
|
||||
@FXML
|
||||
private RadioButton weeklyRadioButton;
|
||||
|
||||
@ -97,6 +103,7 @@ public class MainSettingsController {
|
||||
stationNameField.textProperty().bindBidirectional(stationName);
|
||||
stationAddressField.textProperty().bindBidirectional(stationAddress);
|
||||
passwordField.textProperty().bindBidirectional(password);
|
||||
scheduleStartDatePicker.valueProperty().bindBidirectional(scheduleStartDate);
|
||||
usernameField.textProperty().bindBidirectional(username);
|
||||
|
||||
digitsPerGroupSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 100, 1));
|
||||
@ -198,6 +205,7 @@ public class MainSettingsController {
|
||||
settings.setPassword(password.get());
|
||||
settings.getPrefixes().clear();
|
||||
settings.getPrefixes().addAll(prefixListView.getItems());
|
||||
settings.setScheduleStartDate(scheduleStartDatePicker.getValue());
|
||||
settings.setUsername(username.get());
|
||||
|
||||
Node node = (Node) e.getSource();
|
||||
@ -227,6 +235,8 @@ public class MainSettingsController {
|
||||
messagePeriod.set(settings.getMessagePeriod());
|
||||
username.set(settings.getUsername());
|
||||
password.set(settings.getPassword());
|
||||
System.out.println(settings.getPrefixes());
|
||||
prefixListView.getItems().addAll(settings.getPrefixes());
|
||||
scheduleStartDate.set(settings.getScheduleStartDate());
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,7 @@
|
||||
<fx:reference source="messagePeriodGroup" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<DatePicker layoutX="115.0" layoutY="34.0" />
|
||||
<DatePicker fx:id="scheduleStartDatePicker" 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" />
|
||||
|
@ -1,5 +1,6 @@
|
||||
package name.nathanmcrae.numbersstation;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class StationSettings {
|
||||
@ -12,6 +13,7 @@ public class StationSettings {
|
||||
private String name;
|
||||
private String password;
|
||||
private ArrayList<String> prefixes;
|
||||
private LocalDate scheduleStartDate;
|
||||
private String username;
|
||||
|
||||
public enum MessageMethod {
|
||||
@ -100,9 +102,20 @@ public class StationSettings {
|
||||
}
|
||||
|
||||
public ArrayList<String> getPrefixes() {
|
||||
if (prefixes == null) {
|
||||
prefixes = new ArrayList<String>();
|
||||
}
|
||||
return prefixes;
|
||||
}
|
||||
|
||||
public LocalDate getScheduleStartDate() {
|
||||
return scheduleStartDate;
|
||||
}
|
||||
|
||||
public void setScheduleStartDate(LocalDate newScheduleStartDate) {
|
||||
scheduleStartDate = newScheduleStartDate;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user