How matheuswemmer/autoatendimento-fx works
1. Overall shape
- This is a desktop JavaFX application for restaurant self-service, not a web app.
- The architecture is a simple UI + domain model split: FXML views define screens, controllers handle user interaction, and model classes hold the business state.
2. Application entry point
- com.example.App is the startup class and is responsible for launching JavaFX and loading the initial screen.
- module-info.java indicates the app is built as a Java module, which matters for JavaFX packaging and resource access.
3. Presentation layer
- All screens live under src/main/resources/com/views as FXML files:
- Cardapio.fxml
- Carrinho.fxml
- CarrinhoItem.fxml
- Cozinha.fxml
- PedidoCard.fxml
- ProdutoCard.fxml
- cozinha.css is a view-specific stylesheet, so the UI has at least one styled area focused on kitchen workflow.
4. Controller layer
- Controllers in com.example.controller bind the FXML UI to the domain logic:
- CardapioController manages menu browsing and product selection.
- CarrinhoController manages the cart screen and checkout.
- CarrinhoItemController handles individual cart row/item behavior.
- CozinhaController manages kitchen order progression and delivery.
- PedidoCardController handles the rendering/interaction of an order card in the kitchen.
- ProdutoCardController handles the rendering/interaction of a product card in the menu.
- These controllers are the main orchestration layer between UI events and model mutations.
5. Catalog / menu subsystem
- Cardapio is the menu aggregate: it stores the available products.
- Produto is the base type for menu items, with Comida and Bebida as specializations.
- This subsystem is responsible for presenting the available items and their type-specific data.
6. Cart subsystem
- Carrinho tracks the current customer selection before checkout.
- The README specifies that it uses a Map<Produto, Integer> to store item quantities, so the cart is quantity-aware rather than item-list-only.
- This subsystem is the main boundary for “in-progress” customer choices.
7. Order subsystem
- Pedido represents the finalized order, including items, total value, identifier, and status.
- The cart copies its contents into a new order when checkout happens, which preserves the order snapshot even after the cart is cleared.
- Pedido.Status controls the lifecycle: em preparo, pronto, and entregue.
8. Kitchen subsystem
- Cozinha holds both active orders and delivered orders.
- This is the operational backend of the app’s workflow: orders move from cart checkout into kitchen processing, then through status transitions until delivery.
- Delivered orders remain visible, so the kitchen screen is both a work queue and a history area.
9. Runtime data flow
- The main flow is:
- menu display → add/remove items in cart → finalize cart → create order → send order to kitchen → advance status → mark delivered → keep delivered history visible.
- The final step is a new order/reset flow, where the user starts over with an empty cart and returns to the menu.
10. Model relationships
- Produto is the shared abstraction for all sellable items.
- Comida and Bebida extend it, which keeps common attributes centralized and lets the UI/workflow distinguish product kinds when needed.
- Cardapio, Carrinho, Pedido, and Cozinha are the key state-holding classes, each representing a distinct stage of the restaurant workflow.
11. Technology and packaging boundaries
- The project uses Java 21, JavaFX 21, and Maven.
- FXML separates layout from behavior, so the UI boundary is explicit: view files define structure, controllers define interaction, and models define business data.
- There is no evidence of persistence, database, or external API integration; state appears to be in-memory only.
12. What to emphasize in an architecture diagram
- A good diagram should show three layers:
- FXML screens at the top,
- controllers in the middle,
- domain models at the bottom.
- Highlight the two main workflows:
- customer ordering through Cardapio and Carrinho,
- kitchen processing through Pedido and Cozinha.
- Also show the one-way transition from cart to order, since that is the key state boundary in the application.
Main entry points: Produto.java Produto · Pedido.java Pedido · CardapioController.java Menu Controller · CarrinhoController.java Cart Controller
Components 22
Presentation
FXML screens and styling for the JavaFX UI
- Menu View · Menu screen for browsing products and selecting items.
src/main/resources/com/views/Cardapio.fxml - Cart View · Cart screen for reviewing selections and checking out.
src/main/resources/com/views/Carrinho.fxml - Kitchen View · Kitchen screen for active and delivered orders.
src/main/resources/com/views/Cozinha.fxml - Cart Item · Reusable item row for the cart list.
src/main/resources/com/views/CarrinhoItem.fxml - Order Card · Reusable order card used in the kitchen workflow.
src/main/resources/com/views/PedidoCard.fxml - Product Card · Reusable product card used in the menu.
src/main/resources/com/views/ProdutoCard.fxml - Kitchen CSS · View-specific styling for the kitchen screen.
src/main/resources/com/views/cozinha.css
Controllers
JavaFX controllers that bind views to domain state
- Menu Controller · Coordinates menu browsing and product selection.
src/main/java/com/example/controller/CardapioController.java - Cart Controller · Manages cart contents and checkout.
src/main/java/com/example/controller/CarrinhoController.java - Item Controller · Handles behavior for a single cart row.
src/main/java/com/example/controller/CarrinhoItemController.java - Kitchen Controller · Drives order progress and delivery actions.
src/main/java/com/example/controller/CozinhaController.java - Order Card Ctrl · Binds order card UI to order state.
src/main/java/com/example/controller/PedidoCardController.java - Product Card Ctrl · Binds product card UI to product data.
src/main/java/com/example/controller/ProdutoCardController.java
Domain
In-memory restaurant workflow model
- Cardápio · Menu aggregate that stores available products.
src/main/java/com/example/model/Cardapio.java - Carrinho · Quantity-aware in-memory cart for the current customer selection.
src/main/java/com/example/model/Carrinho.java - Pedido · Finalized order snapshot with items, total, id, and status lifecycle.
src/main/java/com/example/model/Pedido.java - Cozinha · Tracks active and delivered orders for kitchen workflow and history.
src/main/java/com/example/model/Cozinha.java - Produto · Shared abstraction for sellable items.
src/main/java/com/example/model/Produto.java - Comida · Food-specific product specialization.
src/main/java/com/example/model/Comida.java - Bebida · Drink-specific product specialization.
src/main/java/com/example/model/Bebida.java
Connections 26
- App → Menu View: launches · Bootstraps the initial menu screen.
- Module → App: exports · Defines the Java module boundary for the application.
- Menu View → Menu Controller: uses · Menu view is controlled by the menu controller.
- Cart View → Cart Controller: uses · Cart view is controlled by the cart controller.
- Kitchen View → Kitchen Controller: uses · Kitchen view is controlled by the kitchen controller.
- Cart Item → Item Controller: uses · Cart row view is controlled by the row controller.
- Order Card → Order Card Ctrl: uses · Order card view is controlled by the order card controller.
- Product Card → Product Card Ctrl: uses · Product card view is controlled by the product card controller.
- Kitchen View → Kitchen CSS: styles · Kitchen screen uses a dedicated stylesheet.
- Menu Controller → Cardápio: reads · Menu controller queries the product catalog.
- Menu Controller → Carrinho: adds to · Adds selected products into the cart.
- Menu Controller → Product Card Ctrl: renders · Uses product card instances to present items.
- Cart Controller → Carrinho: updates · Manages quantities and checkout actions.
- Cart Controller → Pedido: creates · Converts the cart snapshot into a finalized order.
- Cart Controller → Menu View: returns to · Resets flow back to menu after a new order.
- Item Controller → Carrinho: mutates · Updates per-item quantity and removal state.
- Kitchen Controller → Cozinha: manages · Coordinates active and delivered order lists.
- Kitchen Controller → Pedido: advances · Moves orders through preparation, ready, and delivered states.
- Order Card Ctrl → Pedido: displays · Binds an order card to one order instance.
- Product Card Ctrl → Produto: displays · Binds a product card to product data.
- Cardápio → Produto: contains · Catalog is a collection of products.
- Produto → Comida: specializes · Food is a product specialization.
- Produto → Bebida: specializes · Drink is a product specialization.
- Carrinho → Produto: counts · Stores product quantities in the current cart.
- Pedido → Produto: snapshots · Order captures the chosen products at checkout.
- Cozinha → Pedido: tracks · Kitchen holds active and delivered orders.