diff --git a/BrickLog-Client/src/main/java/com/example/bricklog/view/SettingsWindow.java b/BrickLog-Client/src/main/java/com/example/bricklog/view/SettingsWindow.java index e5b9295..3d180f8 100644 --- a/BrickLog-Client/src/main/java/com/example/bricklog/view/SettingsWindow.java +++ b/BrickLog-Client/src/main/java/com/example/bricklog/view/SettingsWindow.java @@ -2,6 +2,7 @@ package com.example.bricklog.view; import javafx.geometry.Insets; import javafx.geometry.Pos; +import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.Label; @@ -9,17 +10,22 @@ import javafx.scene.control.TextField; import javafx.scene.layout.BorderPane; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; -import static javafx.scene.paint.Color.WHITE; +import javafx.scene.paint.Color; import javafx.scene.text.Font; +import java.util.Objects; + public class SettingsWindow extends BorderPane { private final StackPane contentPane; private final VBox generalSettings; private final VBox serverSettings; private final Label connectionStatus; + private final Scene currentScene; // Reference to the main scene for applying styles dynamically + + public SettingsWindow(Scene scene) { + this.currentScene = scene; // Pass the main scene - public SettingsWindow() { // Menu on the left side for navigation VBox menu = new VBox(); menu.setSpacing(10); @@ -48,6 +54,7 @@ public class SettingsWindow extends BorderPane { generalSettings.setAlignment(Pos.TOP_LEFT); Label themeLabel = new Label("Theme:"); CheckBox darkTheme = new CheckBox("Dark Theme"); + darkTheme.setOnAction(event -> toggleTheme(darkTheme.isSelected())); Label layoutLabel = new Label("Layout:"); CheckBox compactLayout = new CheckBox("Compact Layout"); @@ -62,7 +69,7 @@ public class SettingsWindow extends BorderPane { // Connection Status Label connectionStatus = new Label("Server Status: Not Connected"); connectionStatus.setFont(new Font("Arial", 14)); - connectionStatus.setTextFill(WHITE); + connectionStatus.setTextFill(Color.WHITE); connectionStatus.setStyle("-fx-background-color: lightpink; -fx-padding: 5;"); connectionStatus.setAlignment(Pos.CENTER); connectionStatus.setMaxWidth(Double.MAX_VALUE); @@ -77,7 +84,6 @@ public class SettingsWindow extends BorderPane { serverSettings.getChildren().addAll(connectionStatus, ipLabel, ipField, connectButton); - // Add panels to contentPane and show the default panel contentPane.getChildren().addAll(generalSettings, serverSettings); showGeneralSettings(); // Default to showing the general settings @@ -97,56 +103,41 @@ public class SettingsWindow extends BorderPane { generalSettings.setVisible(false); } - // Method to connect to the server - private void connectToServer(String ipAddress) { - if (!isValidIPAddress(ipAddress)) { - connectionStatus.setText("Invalid IP Address"); - connectionStatus.setStyle("-fx-background-color: orange; -fx-padding: 5;"); - return; - } - - boolean isConnected = simulateServerConnection(ipAddress); - - if (isConnected) { - connectionStatus.setText("Connected"); - connectionStatus.setStyle("-fx-background-color: lightgreen; -fx-padding: 5;"); - } else { - connectionStatus.setText("Not Connected"); - connectionStatus.setStyle("-fx-background-color: lightpink; -fx-padding: 5;"); - } + // Method to toggle themes + private void toggleTheme(boolean isDarkTheme) { + String theme = isDarkTheme ? "/css/dark-theme.css" : "/css/light-theme.css"; + currentScene.getStylesheets().clear(); // Clear existing stylesheets + currentScene.getStylesheets().add(Objects.requireNonNull(getClass().getResource(theme)).toExternalForm()); + } + + // Method to connect to the server + private void connectToServer(String ipAddress) { + if (!isValidIPAddress(ipAddress)) { + connectionStatus.setText("Invalid IP Address"); + connectionStatus.setStyle("-fx-background-color: orange; -fx-padding: 5;"); + return; } - - // Utility method to validate IP addresses - private boolean isValidIPAddress(String ipAddress) { - return ipAddress.matches( + + boolean isConnected = simulateServerConnection(ipAddress); + + if (isConnected) { + connectionStatus.setText("Connected"); + connectionStatus.setStyle("-fx-background-color: lightgreen; -fx-padding: 5;"); + } else { + connectionStatus.setText("Not Connected"); + connectionStatus.setStyle("-fx-background-color: lightpink; -fx-padding: 5;"); + } + } + + // Utility method to validate IP addresses + private boolean isValidIPAddress(String ipAddress) { + return ipAddress.matches( "^((25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$" - ); - } + ); + } - // DEMO PURPOSES ONLY [Commented out when in production] - // Simulated connection logic for demonstration purposes - private boolean simulateServerConnection(String ipAddress) { - if (ipAddress == null || ipAddress.isEmpty()) { - return false; // IP address is invalid - } - - - // Simulate connection by checking for a specific IP pattern (e.g., localhost) - return ipAddress.equals("127.0.0.1") || ipAddress.startsWith("192.168."); - } - - /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - //PRODUCTION _ UNCOMmENT When Needed for true Server Connectivity - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - private boolean simulateServerConnection(String ipAddress) { - int port = 12345; // Replace with your server's port - try (Socket socket = new Socket()) { - socket.connect(new InetSocketAddress(ipAddress, port), 3000); // 3-second timeout - return true; // Connection successful - } catch (IOException e) { - return false; // Connection failed - } - } - ====================================================================================================== */ - + // Simulated connection logic for demonstration purposes + private boolean simulateServerConnection(String ipAddress) { + return ipAddress.equals("127.0.0.1") || ipAddress.startsWith("192.168."); + } } diff --git a/BrickLog-Client/target/bricklog-client-0.1-SNAPSHOT.jar b/BrickLog-Client/target/bricklog-client-0.1-SNAPSHOT.jar index 75a2272..1f33a1a 100644 Binary files a/BrickLog-Client/target/bricklog-client-0.1-SNAPSHOT.jar and b/BrickLog-Client/target/bricklog-client-0.1-SNAPSHOT.jar differ diff --git a/BrickLog-Client/target/classes/com/example/bricklog/BrickLogClientApplication.class b/BrickLog-Client/target/classes/com/example/bricklog/BrickLogClientApplication.class index 5fd1d02..3c9ae1d 100644 Binary files a/BrickLog-Client/target/classes/com/example/bricklog/BrickLogClientApplication.class and b/BrickLog-Client/target/classes/com/example/bricklog/BrickLogClientApplication.class differ diff --git a/BrickLog-Client/target/classes/com/example/bricklog/model/Build.class b/BrickLog-Client/target/classes/com/example/bricklog/model/Build.class index 82b95c6..4268943 100644 Binary files a/BrickLog-Client/target/classes/com/example/bricklog/model/Build.class and b/BrickLog-Client/target/classes/com/example/bricklog/model/Build.class differ diff --git a/BrickLog-Client/target/classes/com/example/bricklog/view/GalleryLayout.class b/BrickLog-Client/target/classes/com/example/bricklog/view/GalleryLayout.class index 28bbf84..491b240 100644 Binary files a/BrickLog-Client/target/classes/com/example/bricklog/view/GalleryLayout.class and b/BrickLog-Client/target/classes/com/example/bricklog/view/GalleryLayout.class differ diff --git a/BrickLog-Client/target/classes/com/example/bricklog/view/KitsetPage.class b/BrickLog-Client/target/classes/com/example/bricklog/view/KitsetPage.class index 06ded9c..aa086c0 100644 Binary files a/BrickLog-Client/target/classes/com/example/bricklog/view/KitsetPage.class and b/BrickLog-Client/target/classes/com/example/bricklog/view/KitsetPage.class differ diff --git a/BrickLog-Client/target/classes/com/example/bricklog/view/MainLayout.class b/BrickLog-Client/target/classes/com/example/bricklog/view/MainLayout.class index 512daef..f95c920 100644 Binary files a/BrickLog-Client/target/classes/com/example/bricklog/view/MainLayout.class and b/BrickLog-Client/target/classes/com/example/bricklog/view/MainLayout.class differ diff --git a/BrickLog-Client/target/classes/com/example/bricklog/view/MocPage.class b/BrickLog-Client/target/classes/com/example/bricklog/view/MocPage.class index e354b8f..fdc38ab 100644 Binary files a/BrickLog-Client/target/classes/com/example/bricklog/view/MocPage.class and b/BrickLog-Client/target/classes/com/example/bricklog/view/MocPage.class differ diff --git a/BrickLog-Client/target/classes/com/example/bricklog/view/SettingsWindow.class b/BrickLog-Client/target/classes/com/example/bricklog/view/SettingsWindow.class index db565f1..bbfa659 100644 Binary files a/BrickLog-Client/target/classes/com/example/bricklog/view/SettingsWindow.class and b/BrickLog-Client/target/classes/com/example/bricklog/view/SettingsWindow.class differ diff --git a/BrickLog-Client/target/classes/css/config/application.properties b/BrickLog-Client/target/classes/css/config/application.properties deleted file mode 100644 index e69de29..0000000 diff --git a/BrickLog-Client/target/classes/css/dark-theme.css b/BrickLog-Client/target/classes/css/dark-theme.css deleted file mode 100644 index fb92c3d..0000000 --- a/BrickLog-Client/target/classes/css/dark-theme.css +++ /dev/null @@ -1,19 +0,0 @@ -.root { - -fx-background-color: #161616; - background-color: #161616; /* Compatibility fix */ -} - -.label.title { - -fx-text-fill: #B22222; - -fx-effect: dropshadow(gaussian, white, 2, 0, 0, 0); -} - -.table-view { - -fx-font-size: 14px; - font-size: 14px;/* Compatibility fix */ - -fx-text-fill: #E0FFFF; -} - -.caption { - -fx-text-fill: #C0C0C0; -} diff --git a/BrickLog-Client/target/classes/css/gallery.css b/BrickLog-Client/target/classes/css/gallery.css deleted file mode 100644 index 9252c64..0000000 --- a/BrickLog-Client/target/classes/css/gallery.css +++ /dev/null @@ -1,22 +0,0 @@ -.toggle-button { - -fx-background-color: #444; - -fx-text-fill: white; - -fx-padding: 5 10; - -fx-border-radius: 5; - -fx-background-radius: 5; -} - -.toggle-button:selected { - -fx-background-color: #666; -} - -.grid-pane { - -fx-background-color: #f0f0f0; - -fx-padding: 10; - -fx-hgap: 15; - -fx-vgap: 15; -} - -.list-view { - -fx-background-color: #f9f9f9; -} diff --git a/BrickLog-Client/target/classes/css/light-theme.css b/BrickLog-Client/target/classes/css/light-theme.css deleted file mode 100644 index e69de29..0000000 diff --git a/BrickLog-Client/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/BrickLog-Client/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index dd037de..9f7e576 100644 --- a/BrickLog-Client/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/BrickLog-Client/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1,4 +1,7 @@ +com\example\bricklog\model\Build.class com\example\bricklog\BrickLogClientApplication.class com\example\bricklog\view\MainLayout.class +com\example\bricklog\view\MocPage.class com\example\bricklog\view\SettingsWindow.class +com\example\bricklog\view\KitsetPage.class com\example\bricklog\view\GalleryLayout.class diff --git a/BrickLog-Client/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/BrickLog-Client/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index a0da825..3d5ddf1 100644 --- a/BrickLog-Client/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/BrickLog-Client/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -2,4 +2,7 @@ C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\ C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\controller\SettingsController.java C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\view\MainLayout.java C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\view\SettingsWindow.java +C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\view\KitsetPage.java C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\view\GalleryLayout.java +C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\view\MocPage.java +C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\model\Build.java