Skip to content

πŸŒ” NCU CSIE SE6029 OOAD Final Project, Spring 2024, M.S./Ph.D.

License

Notifications You must be signed in to change notification settings

xxrjun/uml-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Javadoc GitHub release (latest by date)

Quality Gate Status Reliability Rating Lines of Code


Logo

UML Editor

NCU OOAD | Spring 2024 | Final Project
JavaDocs Β»
DEMO Β»

UML Editor

Software Requirements

Maven Dependencies

Features

GUI Layout and Buttons

  • Select
  • Association
  • Generalization
  • Composition
  • Class
  • Use Case

Functions

  • Create basic object: Class, UseCase
  • Select/Unselect/Move a single basic object: Class, UseCase
  • Create UMLConnectionLine: AssociationLine, CompositionLine, GeneralizationLine
  • Change Object Name
  • Select/Unselect/Move connection line
  • Select/Unselect a UMLGroup of objects
  • Group/UpGroup
  • Select and Move BaseUMLObject (include Group)

Extra Features

  • Delete UMLObject

Usage

You can just download πŸŒ” v1.0 and run the jar file.

Build

mvn clean package

Run

java -jar target/uml-editor-1.0-jar-with-dependencies.jar

Class Diagram with Dependency

Tip

Generated by UML class diagrams

Class Diagram with Dependency

Future Work

  • Improve code quality. More OO.
  • Documentations: Java API Docs, README.md

Project File Structure

.
|
+---assets
+---docs
+---src
|   +---main
|   |   +---java
|   |   |   \---com
|   |   |       \---xxrjun
|   |   |           |   UMLEditorApplication.java
|   |   |           |
|   |   |           +---components
|   |   |           |   |   Canvas.java
|   |   |           |   |   MenuBar.java
|   |   |           |   |   ToolPanel.java
|   |   |           |   |
|   |   |           |   \---uml
|   |   |           |       |   UMLGroup.java
|   |   |           |       |   UMLObject.java
|   |   |           |       |   UMLPort.java
|   |   |           |       |
|   |   |           |       +---basics
|   |   |           |       |       ClassBasicObject.java
|   |   |           |       |       UMLBasicObject.java
|   |   |           |       |       UseCaseBasicObject.java
|   |   |           |       |
|   |   |           |       \---connectionlines
|   |   |           |               AssociationLine.java
|   |   |           |               CompositionLine.java
|   |   |           |               GeneralizationLine.java
|   |   |           |               UMLConnectionLine.java
|   |   |           |
|   |   |           +---enums
|   |   |           |       EditFunctionTypes.java
|   |   |           |       ToolButtonConfig.java
|   |   |           |       UMLObjectTypes.java
|   |   |           |
|   |   |           +---factories
|   |   |           |       UMLObjectFactory.java
|   |   |           |
|   |   |           \---modes
|   |   |                   CreateBasicUMLObject.java
|   |   |                   CreateUMLConnectionLine.java
|   |   |                   Select.java
|   |   |                   UMLFactory.java
|   |   |                   UMLMode.java
|   |   |
|   |   \---resources
|   |       \---images
...

Program Flow Overview

  1. Click Tool Button
  2. Mode
    1. Create UMLObject
      1. Create UMLConnectionLine
      2. Create UMLBasicObject
    2. Select
      1. If selection is UMLObjects
        1. can Move (UMLConnectionLine movement are not supported yet.)
      2. If selection is UMLBasicObject
        1. can change it’s ObjectName
      3. If selection is an Area including several UMLObjects
        1. can Group
      4. If selection is an UMLGroup
        1. can UnGroup
  3. Canvas Repaint
graph TD
    A[Initialize UML Editor] --> B{Button Clicked}
    B -->|Select| C[Set Select Mode]
    B -->|Association| D[Set Association Mode]
    B -->|Generalization| E[Set Generalization Mode]
    B -->|Composition| F[Set Composition Mode]
    B -->|Class| G[Set Class Creation Mode]
    B -->|Use Case| H[Set Use Case Creation Mode]
    C --> I{Mouse Event on Canvas}
    D --> I
    E --> I
    F --> I
    G --> I
    H --> I
    I -->|Left Click on Object| J[Select/Unselect Object]
    I -->|Left Click on Canvas| K[Unselect All Objects]
    I -->|Left Press on Object| L[Start Line Creation]
    I -->|Mouse Drag| M[Update Line Endpoint]
    I -->|Left Release on Object| N[Create Connection Line]
    I -->|Left Press on Object| O[Start Object Movement]
    I -->|Mouse Drag| P[Move Object]
    I -->|Left Release| Q[Update Object Position]
    J --> R{Edit Menu}
    K --> R
    R -->|Group Selected| S[Merge Selected Objects]
    R -->|Ungroup Selected| T[Decompose Composite Object]
    R -->|Change Object Name| U[Open Name Change Window]
    U -->|OK with New Name| V[Update Object Name]
    U -->|Cancel| W[Close Window]
    V --> W
    W --> I
Loading

Use Case Sequence Diagram

A. Creating a UML Object

sequenceDiagram
    participant User
    participant Button
    participant Canvas
    User->>Button: Click button
    Button-->>User: Change button color to black
    User->>Canvas: Move cursor to (x,y) and press left mouse button 
    Canvas-->>Canvas: Draw a blank object at (x,y)
    User->>Canvas: Repeat creating same object
    alt User press another button
        User->>Button: Click another button  
        Button-->>User: Change to the mode of clicked button
    end
Loading

B. Creating a UML Connection Line

sequenceDiagram
    participant User 
    participant Object1
    participant Object2
    participant Canvas
    User->>Object1: Press left mouse button within boundary
    User->>Canvas: Drag mouse
    User->>Object2: Release mouse button within boundary
    Canvas-->>Canvas: Create connection line between Object1 and Object2
    Canvas-->>Canvas: Draw arrow at Object2 based on line type
    alt Press point not on object
        User->>Canvas: Press, drag and release not on any object
        Canvas-->>Canvas: Do nothing
    else Release point not on object
        User->>Canvas: Release mouse not on any object
        Canvas-->>Canvas: Do not create connection line  
    end
Loading

C. Select/Unselect a Single Object

sequenceDiagram
    participant User
    participant Object
    participant Canvas 
    User->>Object: Click on object
    Object-->>Canvas: Deselect any other selected objects 
    Object-->>Object: Display 4 connection ports
    alt Click on empty area
        User->>Canvas: Click on coordinates without object
        Canvas-->>Canvas: Deselect any selected objects
    end
Loading

D.1 Group Objects

sequenceDiagram
    participant User
    participant EditMenu
    participant SelectedObjects
    User->>EditMenu: Select "Group" option
    EditMenu->>SelectedObjects: Merge into one composite object
Loading

D.2 Ungroup Objects

sequenceDiagram
    participant User
    participant EditMenu
    participant CompositeObject
    User->>EditMenu: Select "Ungroup" option
    EditMenu->>CompositeObject: Decompose one layer
Loading

E. Move Objects

sequenceDiagram
    participant User
    participant Object
    participant Canvas
    User->>Object: Press left mouse button 
    User->>Canvas: Drag mouse to (x,y)
    User->>Canvas: Release mouse button
    Canvas->>Object: Move object to (x,y)
    Canvas-->>Canvas: Redraw connected lines
Loading

F. Change Object Name

sequenceDiagram
    participant User
    participant EditMenu
    participant Object
    participant NameWindow
    User->>Object: Select object
    User->>EditMenu: Select "Change Object Name"
    EditMenu-->>NameWindow: Open window with text area and OK/Cancel 
    User->>NameWindow: Enter new name, press OK
    NameWindow-->>Object: Change object name
    NameWindow-->>NameWindow: Close window
Loading

References

Documentations

Related Projects

Tip

Code similarity is checked by using MOSS. Result: http://moss.stanford.edu/results/1/9411843636512/