@startuml hide circle allowmixing skinparam classAttributeIconSize 0 skinparam classBackgroundColor #ffffb9 skinparam classBorderColor #800000 skinparam classArrowColor #800000 skinparam classFontColor black skinparam classFontName Tahoma class Main { +start(Stage primaryStage): void +main(String args): void } Application <|-- Main class DiagramController { +canvas: Pane +entities: List +relationships: List +entityBlocks: List +relationshipBlocks: List +selectedEntity: Entity +addEntity(String name, double x, double y): void +addRelationship(Entity source, Entity target, String name): void +updateRelationships(): void +generateSQL(): void +getSQLType(String type): String +saveToJson(File file): void +loadFromJson(File file): void } DiagramController --> Entity class DiagramData { +entities: List +relationships: List +getEntities(): List +setEntities(List entities): void +getRelationships(): List +setRelationships(List relationships): void } class Attribute { +name: String +type: String +isPrimaryKey: boolean +isForeignKey: boolean +isNullable: boolean +getName(): String +setName(String name): void +getType(): String +setType(String type): void +isPrimaryKey(): boolean +setPrimaryKey(boolean primaryKey): void +isForeignKey(): boolean +setForeignKey(boolean foreignKey): void +isNullable(): boolean +setNullable(boolean nullable): void } class Entity { +name: String +attributes: List +x: double +y: double +autoGenerateId: boolean +getName(): String +setName(String name): void +getAttributes(): List +addAttribute(Attribute attribute): void +getX(): double +setX(double x): void +getY(): double +setY(double y): void +isAutoGenerateId(): boolean +setAutoGenerateId(boolean autoGenerateId): void } class Relationship { +name: String +sourceEntity: Entity +targetEntity: Entity +sourceCardinality: String +targetCardinality: String +x: double +y: double +getName(): String +setName(String name): void +getSourceEntity(): Entity +setSourceEntity(Entity sourceEntity): void +getTargetEntity(): Entity +setTargetEntity(Entity targetEntity): void +getSourceCardinality(): String +setSourceCardinality(String sourceCardinality): void +getTargetCardinality(): String +setTargetCardinality(String targetCardinality): void +getX(): double +setX(double x): void +getY(): double +setY(double y): void } Relationship --> Entity Relationship --> Entity class SQLGenerationServiceImpl { +generateCreateTableStatements(List entities): String +generateForeignKeyStatements(List relationships): String +generateCompleteScript(List entities, List relationships): String +importFromSQL(String sqlScript): void } SQLGenerationService <|.. SQLGenerationServiceImpl class DiagramServiceImpl { +entities: List +relationships: List +fileStorageService: FileStorageService +invalidationListeners: List +changeListeners: List +notifyListeners(): void +addEntity(Entity entity): void +removeEntity(Entity entity): void +addRelationship(Relationship relationship): void +removeRelationship(Relationship relationship): void +getEntities(): List +getRelationships(): List +saveToFile(File file): void +loadFromFile(File file): void +addListener(InvalidationListener listener): void +removeListener(InvalidationListener listener): void +addChangeListener(Runnable listener): void +removeChangeListener(Runnable listener): void } DiagramService <|.. DiagramServiceImpl class JsonFileStorageService { +objectMapper: ObjectMapper +save(File file, List entities, List relationships): void +load(File file): DiagramData } FileStorageService <|.. JsonFileStorageService class SQLGenerationServiceImpl { +diagramService: DiagramService +generateCompleteScript(List entities, List relationships): String +importFromSQL(String sqlScript): void +generateCreateTableStatements(List entities): String +generateForeignKeyStatements(List relationships): String } SQLGenerationService <|.. SQLGenerationServiceImpl class SQLGenerator { +generateCreateTables(List entities, List relationships): String +generateTableSQL(Entity entity, boolean includeForeignKeys): String +generateForeignKeySQL(Relationship rel): String +getSQLType(String type): String } class DiagramView { +diagramService: DiagramService +entityBlocks: Map +relationshipBlocks: Map +addEntity(Entity entity): void +addEntity(Entity entity, double x, double y): void +addRelationship(Relationship relationship): void +removeEntity(Entity entity): void +removeRelationship(Relationship relationship): void +updateRelationships(): void +clear(): void +getEntityAt(double x, double y): Entity } Pane <|-- DiagramView class DialogManager { +showAttributeDialog(): Optional +showCardinalityDialog(String currentValue): Optional } class EntityBlock { +entity: Entity +nameLabel: Label +attributesBox: VBox +connectedRelationships: List +refreshAttributes(): void +showAddAttributeDialog(): void +setupDragging(): void +getEntity(): Entity +addRelationship(RelationshipBlock relationship): void +removeRelationship(RelationshipBlock relationship): void +updateConnectedRelationships(): void } VBox <|-- EntityBlock EntityBlock --> Entity class Delta { +x: double +y: double } class MainView { +root: BorderPane +diagramView: DiagramView +diagramService: DiagramService +sqlService: SQLGenerationService +sqlEditor: TextArea +currentMode: String +sourceEntity: Entity +initializeComponents(): void +setupSQLEditor(): VBox +showNewEntityDialog(double x, double y): void +showNewRelationshipDialog(Entity source, Entity target): void +refreshDiagramView(): void +updateSQLEditor(): void +getRoot(): BorderPane } MainView --> DiagramView MainView --> Entity class RelationshipBlock { +relationship: Relationship +line: Line +nameLabel: Label +sourceCardLabel: Label +targetCardLabel: Label +sourceBlock: EntityBlock +targetBlock: EntityBlock +updatePosition(): void +setupContextMenu(): void +showCardinalityDialog(): void +getRelationship(): Relationship } Group <|-- RelationshipBlock RelationshipBlock --> Relationship RelationshipBlock --> EntityBlock RelationshipBlock --> EntityBlock @enduml