YouTube Demonstration: https://youtu.be/mNjMNyZUi5Q?si=1c0YodUp1bDt7D5s
GitHub: https://github.com/Benjination/DesignPatterns
This Java application allows users to create, edit, and manage booth floor plans using a graphical interface.
- Create new floor plans
- Add, move, and delete booth shapes
- Save and load floor plans
- Clear entire floor plans
- Return to landing page
This application implements several design patterns to enhance its structure and functionality:
Controller Pattern
The FloorPlanController class acts as an intermediary between the UI and the model (FloorPlan). It handles operations like adding shapes, clearing the floor plan, and managing shape selection[1].
Expert Pattern
The Shape interface and CustomRectangle class demonstrate the Expert pattern. These components encapsulate the behavior and properties specific to shapes, such as drawing, intersection detection, and position setting[1].
Iterator Pattern
Both the Shape interface and FloorPlan class implement the Iterable interface, allowing for easy iteration over shapes in the floor plan[1].
Composite Pattern
The FloorPlan class implements the Composite pattern by treating individual shapes and groups of shapes uniformly through the Shape interface. This allows for operations to be performed on both single shapes and collections of shapes[1].
Flyweight Pattern
The RectangleFactory class implements the Flyweight pattern to efficiently manage and reuse rectangle objects with similar properties, reducing memory usage[1].
BoothFloorPlan: Main GUI class for the floor plan editorFloorPlanController: Manages the logic between the UI and the floor plan modelCustomRectangle: Represents individual booth shapesFloorPlan: Manages the collection of shapes in the floor planRectangleFactory: Creates and manages rectangle objects efficiently
- Run the application
- Use the buttons in the left panel to add shapes
- Click and drag shapes to move them
- Use the Delete button to remove selected shapes
- Save your floor plan using the Save button or File menu
- Load existing floor plans from the landing page
- The application uses Swing for the GUI
- Shapes are serializable for easy saving and loading
- The main drawing area updates in real-time as shapes are added or moved