/2020fa-420-CovidSurvivors

This is a repository for our version of a UML (Unified Modeling Language) Editor.

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

UMLEditor

UMLEditor is an editor program for a Unified Modeling Language.

Currently, there are two editors for editing models. One is a web-based GUI editor and the other is a CLI editor. Both allow you to achieve the same tasks.

The program currently supports creating and deleting classes, fields, methods (with parameters), and relationships. You can also undo and redo commands.

The GUI application supports the same operations plus the ability to move class cards around and have the position saved.

Installing

Download the repository from our GitHub Page

Dependencies

For using this program, you must have:

Python3 or higher On Linux, you can install it using:

$ sudo apt-get install python3

Flask - The server-framework for running the GUI

$ pip install Flask

Running The GUI Program

In a terminal, navigate to the UMLEditor code folder. Type the below command to start the GUI Editor.

$ python3 UMLEditor.py 

This will open a tab in your default browser that allows you to edit UML models. Whatever model is currently loaded on the server will be displayed on the GUI editor.

Note: this is a locally hosted server. Any models will be stored on your own computer. Currently the GUI editor only allows for one model to be loaded into it at a time so make sure you save/download any models before uploading one.

Running The CLI Program

In a terminal, navigate to the UMLEditor code folder. Type the below command to start up the Command-Line based version of the UMLEditor.

$ python3 UMLEditor.py -cli

From there you should have entered the UMLEditor and you should see a prompt like below:

UMLEditor> 

A Simple Example of the CLI Editor

You can type 'help' to see a list of possible commands.

Here is a simple example:

UMLEditor> create_class myClass1
UMLEditor> create_class myClass2
UMLEditor> create_field myClass1 private int myField1
UMLEditor> create_field myClass1 public string myField2
UMLEditor> create_field myClass2 private string myField3
UMLEditor> create_method myClass2 public string myMethod1
UMLEditor> create_parameter myClass2 myMethod1 int a
UMLEditor> create_parameter myClass2 myMethod1 int b
UMLEditor> create_relationship inheritance myClass1 myClass2

You can list the names of all of the classes with list_classes

UMLEditor> list_classes
myClass1
myClass2

You can list all of the components of a class with list_class <classname>

UMLEditor> list_class myClass1
SUCCESS: Class: myClass1
=== Fields ======================
private myField1: int
public myField2: string
=== Methods =====================
=== Relationships ===============
myClass1 ---------> myClass2
=================================
UMLEditor> list_class myClass2
SUCCESS: Class: myClass2
=== Fields ======================
private myField3: string
=== Methods =====================
public myMethod1(int a, int b): string
=== Relationships ===============
myClass2 <--------- myClass1
=================================

Saving and Loading Models in the CLI Editor

In the UMLEditor, a model can be saved to a specified JSON file

UMLEditor> save_model MyModel.json

This will save all the data for the model to the specified JSON file and store it in the data directory.

A model can later be loaded back into the program and edited. But you must remember to save it to apply the changes.

UMLEditor> load_model MyModel.json

Any model generated by the CLI will work with the GUI editor. Simply upload the json file to the GUI page using the upload button. You can also press 'save project' to download the server model and that can be used in the CLI interface by placing it into the data directory of the repository.

Links