diff --git a/src/main/java/build.ps1 b/src/main/java/build.ps1 index 2b51256..4ec0f56 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\*.java -d out -cp name/nathanmcrae/*.fxml out/name/nathanmcrae -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 +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 +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 diff --git a/src/main/java/name/nathanmcrae/NumbersStationListenerSettings.fxml b/src/main/java/name/nathanmcrae/numbersstation/ListenerSettingsView.fxml similarity index 100% rename from src/main/java/name/nathanmcrae/NumbersStationListenerSettings.fxml rename to src/main/java/name/nathanmcrae/numbersstation/ListenerSettingsView.fxml diff --git a/src/main/java/name/nathanmcrae/NumbersStationListener.fxml b/src/main/java/name/nathanmcrae/numbersstation/ListenerView.fxml similarity index 100% rename from src/main/java/name/nathanmcrae/NumbersStationListener.fxml rename to src/main/java/name/nathanmcrae/numbersstation/ListenerView.fxml diff --git a/src/main/java/name/nathanmcrae/NumbersStation.java b/src/main/java/name/nathanmcrae/numbersstation/Main.java similarity index 73% rename from src/main/java/name/nathanmcrae/NumbersStation.java rename to src/main/java/name/nathanmcrae/numbersstation/Main.java index 06312d6..a25b329 100644 --- a/src/main/java/name/nathanmcrae/NumbersStation.java +++ b/src/main/java/name/nathanmcrae/numbersstation/Main.java @@ -1,4 +1,4 @@ -package name.nathanmcrae; +package name.nathanmcrae.numbersstation; import javafx.application.Application; import javafx.fxml.FXMLLoader; @@ -6,10 +6,10 @@ import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; -public class NumbersStation extends Application { +public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception { - Parent root = FXMLLoader.load(getClass().getResource("NumbersStation.fxml")); + Parent root = FXMLLoader.load(getClass().getResource("MainView.fxml")); primaryStage.setTitle("Numbers Station"); primaryStage.setScene(new Scene(root)); primaryStage.show(); diff --git a/src/main/java/name/nathanmcrae/NumbersStationController.java b/src/main/java/name/nathanmcrae/numbersstation/MainController.java similarity index 93% rename from src/main/java/name/nathanmcrae/NumbersStationController.java rename to src/main/java/name/nathanmcrae/numbersstation/MainController.java index e95ee7a..f4089c1 100644 --- a/src/main/java/name/nathanmcrae/NumbersStationController.java +++ b/src/main/java/name/nathanmcrae/numbersstation/MainController.java @@ -1,4 +1,4 @@ -package name.nathanmcrae; +package name.nathanmcrae.numbersstation; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import java.io.File; @@ -23,10 +23,10 @@ import javafx.scene.Scene; import javafx.stage.Modality; import javafx.stage.Stage; -public class NumbersStationController implements Initializable { +public class MainController implements Initializable { private Stage settingsStage; private Stage selectStationStage; - private NumbersStationSettings settings; + private MainSettings settings; private StationSettings selectedStation; private StringProperty selectedStationName = new SimpleStringProperty(); @@ -47,10 +47,10 @@ public class NumbersStationController implements Initializable { if (settingsStage == null || !settingsStage.isShowing()) { try { - FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("NumbersStationSettings.fxml")); + FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MainSettingsView.fxml")); Parent root = fxmlLoader.load(); - NumbersStationSettingsController controller = fxmlLoader.getController(); + MainSettingsController controller = fxmlLoader.getController(); controller.setStationSettings(selectedStation); settingsStage = new Stage(); @@ -73,11 +73,11 @@ public class NumbersStationController implements Initializable { private void handleSelectStationButtonPress() { if (selectStationStage == null || !selectStationStage.isShowing()) { try { - FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("NumbersStationSelection.fxml")); + FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("StationSelectionView.fxml")); Parent root = fxmlLoader.load(); // Pass settings to the controller - NumbersStationSelectionController controller = fxmlLoader.getController(); + StationSelectionController controller = fxmlLoader.getController(); controller.setSettings(settings); selectStationStage = new Stage(); @@ -121,11 +121,11 @@ public class NumbersStationController implements Initializable { } if (!Files.exists(filePath)) { - settings = new NumbersStationSettings(); + settings = new MainSettings(); xmlMapper.writeValue(new File(filePath.toString()), settings); } else { - settings = xmlMapper.readValue(new File(filePath.toString()), NumbersStationSettings.class); + settings = xmlMapper.readValue(new File(filePath.toString()), MainSettings.class); } } catch (IOException e) { // Print the contents of filePath diff --git a/src/main/java/name/nathanmcrae/NumbersStationSettings.java b/src/main/java/name/nathanmcrae/numbersstation/MainSettings.java similarity index 94% rename from src/main/java/name/nathanmcrae/NumbersStationSettings.java rename to src/main/java/name/nathanmcrae/numbersstation/MainSettings.java index 1b7ac70..399f5f2 100644 --- a/src/main/java/name/nathanmcrae/NumbersStationSettings.java +++ b/src/main/java/name/nathanmcrae/numbersstation/MainSettings.java @@ -1,4 +1,4 @@ -package name.nathanmcrae; +package name.nathanmcrae.numbersstation; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import java.io.File; @@ -8,7 +8,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; -public class NumbersStationSettings { +public class MainSettings { private int digitsPerGroup; private String username; private int refreshInterval; @@ -16,7 +16,7 @@ public class NumbersStationSettings { private ArrayList stations; - public NumbersStationSettings() { + public MainSettings() { stations = new ArrayList<>(); stations.add(new StationSettings("Station 1")); } diff --git a/src/main/java/name/nathanmcrae/NumbersStationSettingsController.java b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java similarity index 87% rename from src/main/java/name/nathanmcrae/NumbersStationSettingsController.java rename to src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java index e84dbd1..ee53f69 100644 --- a/src/main/java/name/nathanmcrae/NumbersStationSettingsController.java +++ b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsController.java @@ -1,4 +1,4 @@ -package name.nathanmcrae; +package name.nathanmcrae.numbersstation; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonProcessingException; @@ -13,7 +13,7 @@ import javafx.scene.control.TextField; import javafx.scene.Node; import javafx.stage.Stage; -public class NumbersStationSettingsController { +public class MainSettingsController { private StationSettings settings; private StringProperty stationAddress = new SimpleStringProperty(); private StringProperty stationName = new SimpleStringProperty(); @@ -24,7 +24,7 @@ public class NumbersStationSettingsController { @FXML private TextField stationAddressField; - public NumbersStationSettingsController() throws IOException { + public MainSettingsController() throws IOException { // System.out.println("Created settings controller"); // File file = new File("setting-test.xml"); // XmlMapper xmlMapper = new XmlMapper(); @@ -40,13 +40,8 @@ public class NumbersStationSettingsController { } @FXML - private void handleSaveButtonPress(Event e) { - settings.setAddress(stationAddress.get()); - - Node node = (Node) e.getSource(); - Stage stage = (Stage) node.getScene().getWindow(); - stage.setUserData(true); - stage.close(); + private void handleAddPrefixButtonPress() { + // TODO } @FXML @@ -57,6 +52,21 @@ public class NumbersStationSettingsController { stage.close(); } + @FXML + private void handleRemovePrefixButtonPress() { + // TODO + } + + @FXML + private void handleSaveButtonPress(Event e) { + settings.setAddress(stationAddress.get()); + + Node node = (Node) e.getSource(); + Stage stage = (Stage) node.getScene().getWindow(); + stage.setUserData(true); + stage.close(); + } + public StringProperty stationAddressProperty() { return stationAddress; } diff --git a/src/main/java/name/nathanmcrae/NumbersStationSettings.fxml b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml similarity index 94% rename from src/main/java/name/nathanmcrae/NumbersStationSettings.fxml rename to src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml index 8b6f8e9..41b75d3 100644 --- a/src/main/java/name/nathanmcrae/NumbersStationSettings.fxml +++ b/src/main/java/name/nathanmcrae/numbersstation/MainSettingsView.fxml @@ -18,11 +18,11 @@ - + - + - + @@ -108,8 +108,8 @@ -