set various files including 'Settings Window' and light & dark themes in CSS, rename BrickLogClient : BrickLogClientApplication
This commit is contained in:
15
.vscode/launch.json
vendored
15
.vscode/launch.json
vendored
@@ -1,16 +1,13 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"type": "jdk",
|
||||
"type": "java",
|
||||
"request": "launch",
|
||||
"name": "Launch Java App",
|
||||
"mainClass": "com.example.bricklog.Main", // Replace with your main class path
|
||||
"vmArgs": "--module-path C:/javafx-sdk-21.0.5/lib --add-modules javafx.controls,javafx.fxml"
|
||||
"name": "Launch BrickLog Client",
|
||||
"mainClass": "com.example.bricklog.BrickLogClient",
|
||||
"projectName": "bricklog-client",
|
||||
"vmArgs": "--module-path C:/javafx-sdk-21.0.5 --add-modules javafx.controls,javafx.fxml"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"java.compile.nullAnalysis.mode": "automatic"
|
||||
}
|
59
BrickLog-Client/pom.xml
Normal file
59
BrickLog-Client/pom.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>bricklog-client</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
<javafx.version>23.0.1</javafx.version> <!-- Use the version compatible with your setup -->
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- JavaFX dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
<!-- Other dependencies can be added here as needed -->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>0.0.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>com.example.bricklog.BrickLogClientApplication</mainClass> <!-- Change to your main class -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@@ -0,0 +1,54 @@
|
||||
package com.example.bricklog;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class BrickLogClientApplication extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
primaryStage.setTitle("Brick Log");
|
||||
|
||||
// Create layout
|
||||
VBox layout = new VBox(10); // Vertical box with spacing of 10 pixels
|
||||
|
||||
// Search Box
|
||||
TextField searchBox = new TextField();
|
||||
searchBox.setPromptText("Search for builds...");
|
||||
|
||||
// Add Button
|
||||
Button addButton = new Button("+");
|
||||
addButton.setStyle("-fx-background-color: lightblue; -fx-font-size: 18px; -fx-padding: 10px; -fx-font-weight: bold;");
|
||||
addButton.setPrefSize(50, 50);
|
||||
|
||||
// Animation Effect on Click
|
||||
addButton.setOnMouseClicked(e -> {
|
||||
addButton.setScaleX(1.2);
|
||||
addButton.setScaleY(1.2);
|
||||
// You may want to add logic for adding a new build here
|
||||
// For example, opening a new window to add a build
|
||||
});
|
||||
|
||||
// Reset size after animation
|
||||
addButton.setOnMouseReleased(e -> {
|
||||
addButton.setScaleX(1.0);
|
||||
addButton.setScaleY(1.0);
|
||||
});
|
||||
|
||||
// Add components to layout
|
||||
layout.getChildren().addAll(searchBox, addButton);
|
||||
|
||||
// Create a scene and set it to the stage
|
||||
Scene scene = new Scene(layout, 400, 300); // Set the width and height as per your need
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
@@ -0,0 +1,101 @@
|
||||
package com.example.bricklog.view;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.Slider;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class SettingsWindow extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
primaryStage.setTitle("Settings");
|
||||
|
||||
// Create a TabPane for organizing settings
|
||||
TabPane tabPane = new TabPane();
|
||||
|
||||
// Tab 1: Display Settings
|
||||
Tab displayTab = new Tab("Display Settings");
|
||||
displayTab.setContent(createDisplaySettingsContent());
|
||||
displayTab.setClosable(false);
|
||||
|
||||
// Tab 2: Server Settings
|
||||
Tab serverTab = new Tab("Server Settings");
|
||||
serverTab.setContent(createServerSettingsContent());
|
||||
serverTab.setClosable(false);
|
||||
|
||||
tabPane.getTabs().addAll(displayTab, serverTab);
|
||||
|
||||
// Set up the scene
|
||||
VBox vbox = new VBox(tabPane);
|
||||
Scene scene = new Scene(vbox, 400, 300);
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
private GridPane createDisplaySettingsContent() {
|
||||
GridPane grid = new GridPane();
|
||||
grid.setPadding(new Insets(10));
|
||||
grid.setVgap(10);
|
||||
grid.setHgap(10);
|
||||
|
||||
// Font Size Adjuster
|
||||
Label fontSizeLabel = new Label("Font Size:");
|
||||
Slider fontSizeSlider = new Slider(10, 30, 14);
|
||||
fontSizeSlider.setShowTickLabels(true);
|
||||
fontSizeSlider.setShowTickMarks(true);
|
||||
|
||||
// Dark/Light Mode Toggle
|
||||
Label themeLabel = new Label("Theme:");
|
||||
ToggleGroup themeGroup = new ToggleGroup();
|
||||
RadioButton lightMode = new RadioButton("Light");
|
||||
RadioButton darkMode = new RadioButton("Dark");
|
||||
lightMode.setToggleGroup(themeGroup);
|
||||
darkMode.setToggleGroup(themeGroup);
|
||||
lightMode.setSelected(true);
|
||||
|
||||
grid.add(fontSizeLabel, 0, 0);
|
||||
grid.add(fontSizeSlider, 1, 0);
|
||||
grid.add(themeLabel, 0, 1);
|
||||
grid.add(lightMode, 1, 1);
|
||||
grid.add(darkMode, 2, 1);
|
||||
|
||||
return grid;
|
||||
}
|
||||
|
||||
private GridPane createServerSettingsContent() {
|
||||
GridPane grid = new GridPane();
|
||||
grid.setPadding(new Insets(10));
|
||||
grid.setVgap(10);
|
||||
grid.setHgap(10);
|
||||
|
||||
// Server IP
|
||||
Label ipLabel = new Label("Server IP:");
|
||||
TextField ipField = new TextField();
|
||||
|
||||
// Authentication Token
|
||||
Label authLabel = new Label("Auth Token:");
|
||||
PasswordField authField = new PasswordField();
|
||||
|
||||
grid.add(ipLabel, 0, 0);
|
||||
grid.add(ipField, 1, 0);
|
||||
grid.add(authLabel, 0, 1);
|
||||
grid.add(authField, 1, 1);
|
||||
|
||||
return grid;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
0
BrickLog-Client/src/main/java/css/dark-theme.css
Normal file
0
BrickLog-Client/src/main/java/css/dark-theme.css
Normal file
0
BrickLog-Client/src/main/java/css/light-theme.css
Normal file
0
BrickLog-Client/src/main/java/css/light-theme.css
Normal file
BIN
BrickLog-Client/target/bricklog-client-0.1-SNAPSHOT.jar
Normal file
BIN
BrickLog-Client/target/bricklog-client-0.1-SNAPSHOT.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
0
BrickLog-Client/target/classes/css/dark-theme.css
Normal file
0
BrickLog-Client/target/classes/css/dark-theme.css
Normal file
0
BrickLog-Client/target/classes/css/light-theme.css
Normal file
0
BrickLog-Client/target/classes/css/light-theme.css
Normal file
3
BrickLog-Client/target/maven-archiver/pom.properties
Normal file
3
BrickLog-Client/target/maven-archiver/pom.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
artifactId=bricklog-client
|
||||
groupId=com.example
|
||||
version=0.1-SNAPSHOT
|
@@ -0,0 +1,2 @@
|
||||
com\example\bricklog\BrickLogClientApplication.class
|
||||
com\example\bricklog\view\SettingsWindow.class
|
@@ -0,0 +1,3 @@
|
||||
C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\BrickLogClientApplication.java
|
||||
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\SettingsWindow.java
|
@@ -0,0 +1 @@
|
||||
C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\test\java\com\example\bricklog\BrickLogClient.java
|
@@ -1,9 +1,14 @@
|
||||
package com.example.bricklog;
|
||||
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
|
||||
import com.example.bricklog.model.LegoBuild;
|
||||
import com.example.bricklog.repository.LegoBuildRepository;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableJpaRepositories(basePackages = "com.example.bricklog.repository") // Adjust if needed
|
||||
public class BrickLogApplication {
|
||||
@@ -12,4 +17,14 @@ public class BrickLogApplication {
|
||||
SpringApplication.run(BrickLogApplication.class, args);
|
||||
System.out.println("BrickLog Server is running...");
|
||||
}
|
||||
|
||||
// Example CommandLineRunner to load initial data into the database
|
||||
@Bean
|
||||
public CommandLineRunner initDatabase(LegoBuildRepository repository) {
|
||||
return args -> {
|
||||
repository.save(new LegoBuild("Castle", "John Doe", true, "A magnificent medieval castle"));
|
||||
repository.save(new LegoBuild("Spaceship", "Jane Smith", false, "A futuristic spacecraft model"));
|
||||
System.out.println("Database initialized with sample data.");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,63 @@
|
||||
package com.example.bricklog.controller;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.example.bricklog.model.LegoBuild;
|
||||
import com.example.bricklog.repository.LegoBuildRepository;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/builds")
|
||||
public class LegoBuildController {
|
||||
|
||||
private static final String IMAGE_DIRECTORY = "uploads/images/";
|
||||
|
||||
@Autowired
|
||||
private LegoBuildRepository legoBuildRepository;
|
||||
|
||||
@PostMapping("/add")
|
||||
public ResponseEntity<?> addLegoBuild(
|
||||
@RequestParam("name") String name,
|
||||
@RequestParam("builder") String builder,
|
||||
@RequestParam("isKitset") boolean isKitset,
|
||||
@RequestParam("description") String description,
|
||||
@RequestParam("image") MultipartFile image) {
|
||||
|
||||
// Save the image file
|
||||
String filePath = saveImageFile(image);
|
||||
|
||||
// Save the LegoBuild with image path
|
||||
LegoBuild legoBuild = new LegoBuild(name, builder, isKitset, description);
|
||||
legoBuild.setImagePath(filePath);
|
||||
legoBuildRepository.save(legoBuild);
|
||||
|
||||
return new ResponseEntity<>("Build added successfully with image.", HttpStatus.OK);
|
||||
}
|
||||
|
||||
private String saveImageFile(MultipartFile image) {
|
||||
try {
|
||||
Path directoryPath = Paths.get(IMAGE_DIRECTORY);
|
||||
if (!Files.exists(directoryPath)) {
|
||||
Files.createDirectories(directoryPath); // Create directory if it doesn’t exist
|
||||
}
|
||||
String filePath = IMAGE_DIRECTORY + image.getOriginalFilename();
|
||||
File file = new File(filePath);
|
||||
image.transferTo(file); // Save the image
|
||||
return filePath;
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to store image file", e);
|
||||
}
|
||||
}
|
||||
}
|
@@ -16,6 +16,7 @@ public class LegoBuild {
|
||||
private String builder;
|
||||
private boolean isKitset; // true for Kitset, false for MoC
|
||||
private String description;
|
||||
private String imagePath;
|
||||
|
||||
public LegoBuild() {}
|
||||
|
||||
@@ -67,4 +68,12 @@ public class LegoBuild {
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getImagePath() {
|
||||
return imagePath;
|
||||
}
|
||||
|
||||
public void setImagePath(String imagePath) {
|
||||
this.imagePath = imagePath;
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
# MariaDB Configuration
|
||||
spring.datasource.url=jdbc:mariadb://localhost:3306/bricklog_db
|
||||
spring.datasource.username=your_db_username
|
||||
spring.datasource.password=your_db_password
|
||||
|
||||
# JPA settings
|
||||
spring.jpa.hibernate.ddl-auto=update # Creates tables automatically; set to 'none' in production if not needed
|
||||
spring.jpa.show-sql=true # Shows SQL queries in the console, useful for debugging
|
||||
spring.jpa.database-platform=org.hibernate.dialect.MariaDBDialect
|
Reference in New Issue
Block a user