# dj-raven/swing-modal-dialog architecture

> Architecture diagram of the GitHub repository dj-raven/swing-modal-dialog, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dj-raven/swing-modal-dialog
- Repository: https://github.com/dj-raven/swing-modal-dialog

## Overview

##### Project type and purpose
- This is a Java Swing UI component library (“modal-dialog”) plus a demo application that exercises it.
- Purpose: provide modal dialogs, drawers, and toast notifications with animations and FlatLaf theming for desktop apps.

##### File structure
- Top-level:
- pom.xml (parent Maven aggregator)
- Two modules:
– modal-dialog (the library)
– demo (a standalone demo application)
- .github (CI/CD release workflow)
- modal-dialog/src/main/java/raven/modal/... → core library packages:
- modal (dialog classes)
- drawer (side-menu)
- toast (notification)
- component & layout sub-packages (renderers, controllers, transitions)
- extras & utils (helper widgets, animation utilities)
- demo/src/main/java/raven/modal/demo/... → example usage: forms, charts, themes, menus
- demo/src/test → unit/integration tests for demo components

##### README
- Confirms: Swing library with FlatLaf, MigLayout dependencies
- Features: modal dialog, drawer, toast
- Demo packaged as a JAR, showcased via screenshots

##### Main components and interactions
1. Parent Maven Project (aggregator)
2. Library Module (“modal-dialog”)
- Core API: ModalDialog, Drawer, Toast
- Component Layer: Abstract* containers & controllers
- Layout Layer: ModalLayout, DrawerMenuLayout, ToastLayout
- Extras: AvatarIcon, SlidePane, LightDarkButton
- Utils: CustomAnimation, EasingInterpolator, ModalUtils
3. Demo Application Module
- Demo UI: Demo.java, FormManager, sample forms, charts, themes
4. External Dependencies
- FlatLaf (look-and-feel library)
- MigLayout (layout manager)
- JFreeChart or other chart libs used in demo
5. Test Modules
- demo/src/test (functional tests for demo components)
- Demo App → depends on → Library Module
- Library Module → depends on → FlatLaf, MigLayout
- Parent POM → aggregates → Library, Demo, CI/CD release workflow
- Tests → depend on → Library Module & Demo resources
c. Architectural patterns / design principles:
- Layered UI architecture
– API Layer (public classes: ModalDialog, Drawer, Toast)
– Component Layer (controllers, renderers)
– Layout Layer (pluggable layout strategies)
– Util Layer (animations, theming helpers)
- Maven multi-module structure for clear separation
- Use of dependency injection via builder patterns (DrawerBuilder, ModalBuilder)
d. Key technologies / frameworks
- Java Swing
- FlatLaf (UI theming)
- MigLayout (layout management)
- Maven for build and dependency management
- GitHub Actions for CI/CD (release.yml)

## Diagram (Mermaid)

```mermaid
graph TB
    Parent["Parent Maven Project (Aggregator)"]:::aggregator
    subgraph "modal-dialog (Library Module)"
        MD["ModalDialog"]:::api
        DR["Drawer"]:::api
        TS["Toast"]:::api
        compLayer["Component Layer"]:::component
        layoutLayer["Layout Layer"]:::infrastructure
        extras["Extras"]:::infrastructure
        utils["Utility Layer"]:::infrastructure
    end
    subgraph "Demo Application Module"
        demoApp["Demo Application\n(Demo.java)"]:::demo
        demoForms["Demo Forms"]:::demo
        demoCharts["Demo Charts"]:::demo
        demoResources["Demo Themes & Resources"]:::demo
    end
    subgraph "CI/CD"
        ciCd["Release Workflow"]:::infrastructure
    end
    external1["FlatLaf"]:::external
    external2["MigLayout"]:::external
    external3["Chart Libraries"]:::external
    tests["Demo Unit & Integration Tests"]:::test

    Parent -->|"aggregates"| ciCd
    Parent -->|"aggregates"| MD
    Parent -->|"aggregates"| demoApp

    demoApp -->|"uses API"| MD
    demoApp -->|"uses API"| DR
    demoApp -->|"uses API"| TS
    demoApp -->|"uses resources"| demoResources
    demoForms -->|"uses API"| MD
    demoCharts -->|"uses chart libs"| external3

    tests -->|"tests"| demoApp
    tests -->|"tests"| MD

    MD -->|"builds on"| compLayer
    compLayer -->|"depends on"| layoutLayer
    layoutLayer -->|"utilizes"| utils

    MD -->|"depends on"| external1
    MD -->|"depends on"| external2

    classDef aggregator fill:#f9f,stroke:#333,stroke-width:1px;
    classDef api fill:#bbf,stroke:#333,stroke-width:1px;
    classDef component fill:#fac,stroke:#333,stroke-width:1px;
    classDef infrastructure fill:#cfc,stroke:#333,stroke-width:1px;
    classDef demo fill:#cff,stroke:#333,stroke-width:1px;
    classDef external fill:#fcf,stroke:#333,stroke-dasharray:5 5;
    classDef test fill:#fbb,stroke:#333,stroke-dasharray:2 2;

    click Parent "https://github.com/dj-raven/swing-modal-dialog/blob/main/pom.xml"
    click ciCd "https://github.com/dj-raven/swing-modal-dialog/blob/main/.github/workflows/release.yml"
    click MD "https://github.com/dj-raven/swing-modal-dialog/blob/main/modal-dialog/src/main/java/raven/modal/ModalDialog.java"
    click DR "https://github.com/dj-raven/swing-modal-dialog/blob/main/modal-dialog/src/main/java/raven/modal/Drawer.java"
    click TS "https://github.com/dj-raven/swing-modal-dialog/blob/main/modal-dialog/src/main/java/raven/modal/Toast.java"
    click compLayer "https://github.com/dj-raven/swing-modal-dialog/tree/main/modal-dialog/src/main/java/raven/modal/component/"
    click layoutLayer "https://github.com/dj-raven/swing-modal-dialog/tree/main/modal-dialog/src/main/java/raven/modal/layout/"
    click extras "https://github.com/dj-raven/swing-modal-dialog/tree/main/modal-dialog/src/main/java/raven/extras/"
    click utils "https://github.com/dj-raven/swing-modal-dialog/tree/main/modal-dialog/src/main/java/raven/modal/utils/"
    click demoApp "https://github.com/dj-raven/swing-modal-dialog/blob/main/demo/src/main/java/raven/modal/demo/Demo.java"
    click demoForms "https://github.com/dj-raven/swing-modal-dialog/tree/main/demo/src/main/java/raven/modal/demo/forms/"
    click demoCharts "https://github.com/dj-raven/swing-modal-dialog/tree/main/demo/src/main/java/raven/modal/demo/component/chart/"
    click demoResources "https://github.com/dj-raven/swing-modal-dialog/tree/main/demo/src/main/resources/raven/modal/demo/themes/"
    click tests "https://github.com/dj-raven/swing-modal-dialog/tree/main/demo/src/test/java/test/"
```
