# wumpz/jhotdraw architecture

> Architecture diagram of the GitHub repository wumpz/jhotdraw, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wumpz/jhotdraw
- Repository: https://github.com/wumpz/jhotdraw

## Overview

##### Project type and purpose
- This is a multi‐module Java library (JHotDraw) providing a programmable 2D drawing framework and sample applications.
- It is not a web or full-stack application but an open-source Swing-based drawing SDK with a plugin-style architecture, organized into smaller Maven submodules.

##### File structure
- Top-level modules (pom.xml aggregating):
- jhotdraw-api – public interfaces, contracts for applications, views, menus, actions.
- jhotdraw-core – the drawing model (Figures, Drawings, Editors, Tools, Events) and controller logic.
- jhotdraw-app – concrete application implementations (SDI/MDI, platform adapters, application-level actions).
- jhotdraw-actions – generic actions (cut/copy/paste, window arrangement, view toggles).
- jhotdraw-io – persistence layer (InputFormat/OutputFormat implementations for XML, serialization, images).
- jhotdraw-datatransfer – clipboard/transferable abstractions for cut/copy/paste.
- jhotdraw-utils – reusable utilities (geometry, beans binding, formatting, undo/redo manager).
- jhotdraw-xml – low-level XML DOM factories and CSS parser for style management.
- jhotdraw-samples* – example applications consuming and illustrating the framework.

##### Extract insights from the README
- Version 10.0-SNAPSHOT refactors include separating IO into its own module, moving attribute management into a dedicated class, introducing JDK 17 and Maven builds, and establishing clear submodule boundaries.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Module Nodes
    POM["pom.xml (Aggregator POM)"]:::pom
    API["jhotdraw-api\n(Public Interfaces)"]:::core
    CORE["jhotdraw-core\n(Model & Controller)"]:::core
    GUI["jhotdraw-gui\n(Swing Components)"]:::core
    APP["jhotdraw-app\n(Application Layer)"]:::core

    ACTIONS["jhotdraw-actions\n(Action Library)"]:::support
    IO["jhotdraw-io\n(Persistence / IO)"]:::support
    DT["jhotdraw-datatransfer\n(Data Transfer)"]:::support
    UTIL["jhotdraw-utils\n(Utility Services)"]:::support
    XML["jhotdraw-xml\n(XML & CSS Engine)"]:::support

    SMINI["jhotdraw-samples-mini\n(Sample Client Mini)"]:::client
    SMISC["jhotdraw-samples-misc\n(Sample Client Misc)"]:::client

    %% Dependencies on API
    CORE -->|"compile-time"| API
    GUI -->|"compile-time"| API
    APP -->|"compile-time"| API
    ACTIONS -->|"compile-time"| API
    IO -->|"compile-time"| API
    DT -->|"compile-time"| API
    UTIL -->|"compile-time"| API
    SMINI -->|"compile-time"| API
    SMISC -->|"compile-time"| API

    %% Dependencies on Core
    GUI -->|"compile-time"| CORE
    APP -->|"compile-time"| CORE
    ACTIONS -->|"compile-time"| CORE
    IO -->|"compile-time"| CORE
    DT -->|"compile-time"| CORE
    SMINI -->|"compile-time"| CORE
    SMISC -->|"compile-time"| CORE

    %% Support Module Relations
    IO -->|"compile-time"| XML
    UTIL -->|"helper"| CORE
    UTIL -->|"helper"| GUI
    UTIL -->|"helper"| APP
    UTIL -->|"helper"| IO
    UTIL -->|"helper"| DT

    %% Runtime / Event Flows
    GUI -->|"runtime/event"| ACTIONS
    GUI -->|"runtime/event"| DT
    ACTIONS -->|"runtime/event"| DT

    %% Composition
    APP -->|"composition"| GUI
    APP -->|"composition"| CORE

    %% Sample Clients Usage
    SMINI -->|"client"| GUI
    SMINI -->|"client"| IO
    SMISC -->|"client"| GUI
    SMISC -->|"client"| IO

    %% Aggregator POM
    POM --> API
    POM --> CORE
    POM --> GUI
    POM --> APP
    POM --> ACTIONS
    POM --> IO
    POM --> DT
    POM --> UTIL
    POM --> XML
    POM --> SMINI
    POM --> SMISC

    %% Click Events
    click POM "https://github.com/wumpz/jhotdraw/blob/develop/pom.xml"
    click API "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-api/"
    click CORE "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-core/"
    click GUI "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-gui/"
    click APP "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-app/"
    click ACTIONS "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-actions/"
    click IO "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-io/"
    click DT "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-datatransfer/"
    click UTIL "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-utils/"
    click XML "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-xml/"
    click SMINI "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-samples/jhotdraw-samples-mini/"
    click SMISC "https://github.com/wumpz/jhotdraw/tree/develop/jhotdraw-samples/jhotdraw-samples-misc/"

    %% Styles
    classDef core fill:#CEEBF2,stroke:#036,stroke-width:1px;
    classDef support fill:#E2F0CB,stroke:#093,stroke-width:1px;
    classDef client fill:#FFE0B2,stroke:#E65100,stroke-width:1px;
    classDef pom fill:#F0F0F0,stroke:#999,stroke-width:1px;
```
