diff --git a/src/main/java/build.ps1 b/src/main/java/build.ps1 index 4ec0f56..932b143 100644 --- a/src/main/java/build.ps1 +++ b/src/main/java/build.ps1 @@ -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 diff --git a/src/main/java/name/nathanmcrae/numbersstation/MainController.java b/src/main/java/name/nathanmcrae/numbersstation/MainController.java index 4affa72..da46b7c 100644 --- a/src/main/java/name/nathanmcrae/numbersstation/MainController.java +++ b/src/main/java/name/nathanmcrae/numbersstation/MainController.java @@ -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"); diff --git a/src/main/java/name/nathanmcrae/numbersstation/MainSettings.java b/src/main/java/name/nathanmcrae/numbersstation/MainSettings.java index 399f5f2..24b4415 100644 --- a/src/main/java/name/nathanmcrae/numbersstation/MainSettings.java +++ b/src/main/java/name/nathanmcrae/numbersstation/MainSettings.java @@ -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"); diff --git a/src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java index fd9a59f..d5699f1 100644 --- a/src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java +++ b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java @@ -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 scheduleStartDate = new SimpleObjectProperty<>(); private StringProperty username = new SimpleStringProperty(); @FXML @@ -86,6 +89,9 @@ public class MainSettingsController { @FXML private ListView 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()); } } diff --git a/src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml index 48b3e86..b8b9845 100644 --- a/src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml +++ b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml @@ -148,7 +148,7 @@ - +