A comprehensive JavaFX application for managing classroom information with authentication, CRUD operations, and modern UI design.
- User Login/Register: Secure authentication with password hashing (SHA-256)
- Session Management: User session handling with logout functionality
- Role-based Access: Support for ADMIN and USER roles
- Password Security: Secure password storage and verification
- View Classrooms: Display all classrooms in a responsive table
- Add Classrooms: Create new classroom entries with validation
- Edit Classrooms: Modify existing classroom information
- Delete Classrooms: Remove classrooms with confirmation dialogs
- Search & Filter: Advanced search and filtering capabilities
- Modern Design: Clean, responsive UI with BootstrapFX styling
- Real-time Updates: Live data updates using Observer pattern
- Confirmation Dialogs: User-friendly confirmation for critical actions
- Status Feedback: Toast messages and alerts for user feedback
This project follows Clean Architecture principles with clear separation of concerns:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Presentation Layer β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Views β β Controllers β β Models β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Business Layer β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Use Cases β β Factory β β DTOs β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Persistence Layer β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Gateways β β DAOs β β Database β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Observer Pattern: For UI updates and real-time data synchronization
- Factory Pattern: For creating different types of rooms
- MVC Pattern: For UI organization and data flow
- Repository Pattern: For data access abstraction
- Java: Core programming language
- JavaFX: UI framework for desktop applications
- BootstrapFX: Modern UI styling
- MySQL: Database management system
- JDBC: Database connectivity
- Maven: Build and dependency management
- Lombok: Boilerplate code reduction
- Java 17 or higher
- MySQL 8.0 or higher
- Maven 3.6 or higher
git clone <repository-url>
cd phonghoc-- Create database
CREATE DATABASE rooms;
USE rooms;
-- Run the room table script
source room.sql;
-- Run the users table script
source users.sql;Edit src/main/java/vn/giadinh/phonghoc/persistence/dao/InitializeDAO.java:
String username = "your_username";
String password = "your_password";
String url = "jdbc:mysql://localhost:3306/rooms?useSSL=false&serverTimezone=UTC";# Clean and compile
mvn clean compile
# Run the application
mvn javafx:runThe system comes with pre-configured users:
| Username | Password | Role | |
|---|---|---|---|
| admin | 123456 | ADMIN | [email protected] |
| user1 | 123456 | USER | [email protected] |
| user2 | 123456 | USER | [email protected] |
CREATE TABLE rooms (
id VARCHAR(50) PRIMARY KEY,
building_block VARCHAR(100) NOT NULL,
area DOUBLE NOT NULL,
num_light_bulbs INT NOT NULL,
start_date_of_operation DATE NOT NULL,
sufficient_light BOOLEAN NOT NULL,
is_standard BOOLEAN NOT NULL,
room_type VARCHAR(50) NOT NULL,
has_projector BOOLEAN DEFAULT FALSE,
num_computers INT DEFAULT 0,
capacity INT DEFAULT 0,
has_sink BOOLEAN DEFAULT FALSE
);CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
full_name VARCHAR(100) NOT NULL,
role VARCHAR(20) DEFAULT 'USER',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_active BOOLEAN DEFAULT TRUE
);- Login: Username/password authentication with SHA-256 hashing
- Register: New user registration with comprehensive validation
- Logout: Secure session termination
- Password Security: Encrypted password storage
- Create: Add new classrooms with validation
- Read: View classroom list with search and filtering
- Update: Edit classroom information
- Delete: Remove classrooms with confirmation
- Keyword Search: Search by room ID, building, or room type
- Building Filter: Filter by building block
- Status Filter: Filter by standard compliance
- Light Filter: Filter by lighting conditions
phonghoc/
βββ src/main/java/vn/giadinh/phonghoc/
β βββ business/ # Business Logic Layer
β β βββ factory/ # Factory patterns
β β βββ usecase/ # Use cases
β βββ dto/ # Data Transfer Objects
β βββ entity/ # Domain entities
β βββ persistence/ # Data Access Layer
β β βββ dao/ # Data Access Objects
β β βββ gateway/ # Repository interfaces
β βββ presentation/ # UI Layer
β β βββ controller/ # Controllers
β β βββ model/ # View models
β β βββ observer/ # Observer pattern
β β βββ view/ # View controllers
β βββ shared/ # Shared utilities
β β βββ common/ # Common utilities
β β βββ enums/ # Enumerations
β β βββ utils/ # Utility classes
β βββ Main.java # Application entry point
βββ src/main/resources/
β βββ vn/giadinh/phonghoc/ # FXML files
βββ pom.xml # Maven configuration
βββ room.sql # Database schema
βββ users.sql # User data
βββ README.md # This file
- Gradient Backgrounds: Beautiful gradient backgrounds
- Card Layout: Information organized in cards
- Responsive Design: Adapts to different screen sizes
- Color-coded Actions: Different colors for different actions
- Confirmation Dialogs: Prevent accidental actions
- Real-time Feedback: Immediate status updates
- Loading States: Visual feedback during operations
- Error Handling: Clear error messages
- Password Hashing: SHA-256 encryption
- Input Validation: Comprehensive input sanitization
- SQL Injection Prevention: Prepared statements
- Session Management: Secure session handling
- Parameterized Queries: Prevent SQL injection
- Input Sanitization: Clean user inputs
- Error Masking: Hide sensitive information in errors
- Authentication Flow: Test login/logout/register
- CRUD Operations: Test all classroom operations
- Search & Filter: Test search functionality
- Error Handling: Test error scenarios
- Input Validation: Test form validations
- Database Operations: Test data persistence
- UI Updates: Test real-time updates
mvn clean javafx:runmvn clean package
java -jar target/phonghoc-1.0.0.jarPOST /auth/login- User loginPOST /auth/register- User registrationPOST /auth/logout- User logout
GET /rooms- Get all classroomsPOST /rooms- Create new classroomPUT /rooms/{id}- Update classroomDELETE /rooms/{id}- Delete classroomGET /rooms/search- Search classrooms
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Check the troubleshooting guide in
AUTH_TROUBLESHOOTING.md - Review the changelog in
CHANGELOG.md
- β Authentication system (Login/Register/Logout)
- β CRUD operations for classrooms
- β Search and filter functionality
- β Modern UI with BootstrapFX
- β Observer pattern implementation
- β Comprehensive error handling
- β Basic classroom viewing
- β Add classroom functionality
- β Clean Architecture implementation
- JavaFX Team: For the excellent UI framework
- BootstrapFX: For modern UI styling
- MySQL: For reliable database management
- Clean Architecture: For architectural guidance
Built with β€οΈ using Java, JavaFX, and MySQL