This is the term project of the course Object-Oriented Analysis and Design (2021, National Central University).
-
Nothing changed, but more OO.
-
In canvas_behavior, each one of the behaviors (such as AddUMLCompositionLine, AddUMLClass) should have its own class. But I use factory pattern there, just for practicing some design patterns. DON'T DO THAT IN PRODUCTION. For good example, checkout uccuz's UML-Editor.
This is a simple UML editor with:
-
Objects
- Class
- Use Case
-
Relation Lines
- Association Line
- Composition Line
- Generalization Line
-
Behavior
- Create a new object
- Rename an object
- Drag an object
- Connect between objects
- Replace the connections between objects
- Group objects
- UnGroup objects
For detailed spec, see this file.
- setCurrentMode(Mode): 設定當前模式
- setColor(Color): 設定按鈕顏色
- applyBehavior(): 向當前模式調用滑鼠事件觸發相對應的行為
- addComponent(JComponent): 將物件加入Canvas
- removeComponent(JComponent): 將物件從Canvas中移除
- setSourcePort(UMLObject): 把起點物件的reference還有Port資訊在Connection Line裡面設定好
- setDestinationPort(UMLObject): 把終點物件的reference還有Port資訊在Connection Line裡面設定好
- getUMLObjectInside(Position or Rectangle): 取得範圍內的UML Objects
- clearSelection(): 清除Canvas上當前的selection
- addSelection(UMLObject): 將UML Object加入Canvas上當前的Seleciton
- getSelection(): 取得Canvas上當前的selection
- setPortVisible(bool): 設定UML Object的Port是否可見
- setStartPosition(Position): Select Box的起始位置
- setEndPosition(Position): Select Box的終點位置
- drawSelectBox(Rectangle): 畫出選取範圍的框框
- showMenuItems(): 顯示Menu底下的選項
- addChild(UMLObject): 將UML Object加入Group Object
- getChildren(): 取得Group Object中的children
- moveTo(Position): 將UML Object移動到當前位置
- repaint(): 重畫Canvas
- setName(name): 設定UML Object的名字