Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dimanyfantakis committed Oct 15, 2023
1 parent 6bc516b commit 0fb3dde
Show file tree
Hide file tree
Showing 49 changed files with 543 additions and 497 deletions.
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The purpose of this project is to develop an independent software tool that prod

1. Run
```bash
mvn compile
./mvnw compile
```
to build the project.

Expand All @@ -77,7 +77,7 @@ to build the project.

1. Run
```bash
mvn package
./mvnw package
```
to create the jar **ObjectOrientedArchitectureDiagrammer-0.0.1-SNAPSHOT-jar-with-dependencies.jar**

Expand All @@ -93,7 +93,7 @@ Check the [User Documentation][userDocumentation-url] regarding more about the u

To run the tests simply run
```bash
mvn test
./mvnw test
```

## Contributing / Reporting issues
Expand All @@ -102,22 +102,25 @@ To run the tests simply run

Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. Don't forget to give the project a star!
If you want to contribute to the development of our tool, please fork the repo and create a pull request.<br>
[!IMPORTANT]
Please adhere to the current code style.<br>
Don't forget to give the project a star! :star:

1. Fork the Project
2. Create your Feature Branch
1. Fork the Project.
2. Create your Feature Branch.
```bash
git checkout -b feature/NewFeature
```
3. Commit your Changes
3. Commit your Changes.
```bash
git commit -m 'Add some NewFeature'
```
4. Push to the Branch
4. Push to the Branch.
```bash
git push origin feature/NewFeature
```
5. Open a Pull Request
5. Open a Pull Request.

### Issues

Expand Down
55 changes: 32 additions & 23 deletions src/main/java/controller/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@
public interface Controller {

/**
* This method creates the tree of the project by calling the DiagramManager's createTree method
* @param sourcePackagePath the project's source package path
* @return the SourceProject created
* This method creates the tree of the project by calling the DiagramManager's createTree method.
*
* @param sourcePackagePath the project's source package path
* @return the SourceProject created
*/
SourceProject createTree(Path sourcePackagePath);

/**
* This method converts the created tree to a diagram, by creating the corresponding DiagramManager
* based on the type of the graph, i.e. package or class and then calling the createDiagram method
* of the DiagramManager
* @param chosenFileNames the names of the files selected by the designer to be included in the diagram
* of the DiagramManager.
*
* @param chosenFileNames the names of the files selected by the designer to be included in the diagram
*/
void convertTreeToDiagram(List<String> chosenFileNames);

/**
* This method arranges the diagram by calling the DiagramManager's arrangeDiagram method
* This method arranges the diagram by calling the DiagramManager's arrangeDiagram method.
*/
void arrangeDiagram();

Expand All @@ -36,49 +38,56 @@ public interface Controller {
SmartGraphPanel<String, String> applySpecificLayout(String choice);

/**
* This method exports the diagram to a GraphML file by calling the DiagramManager's exportDiagramToGraphML method
* @param graphMLSavePath the selected path by the designer where the diagram will be saved
* @return the created File in which the diagram was saved
* This method exports the diagram to a GraphML file by calling the DiagramManager's exportDiagramToGraphML method.
*
* @param graphMLSavePath the selected path by the designer where the diagram will be saved
* @return the created File in which the diagram was saved
*/
File exportDiagramToGraphML(Path graphMLSavePath);

/**
* This method saves the diagram to a text file by calling the DiagramManager's saveDiagram method
* @param graphSavePath the selected path by the designer where the diagram will be saved
* @return the created File in which the diagram was saved
* This method saves the diagram to a text file by calling the DiagramManager's saveDiagram method.
*
* @param graphSavePath the selected path by the designer where the diagram will be saved
* @return the created File in which the diagram was saved
*/
File saveDiagram(Path graphSavePath);

/**
* This method loads a diagram from a text file by calling the DiagramManager's loadDiagram method
* @param graphSavePath the file's path where the diagram is saved
* This method loads a diagram from a text file by calling the DiagramManager's loadDiagram method.
*
* @param graphSavePath the file's path where the diagram is saved
*/
void loadDiagram(Path graphSavePath);

/**
* This method creates the JavaFX graphView by calling the DiagramManager's visualizeJavaFXGraph method
* @return the created graphView
* This method creates the JavaFX graphView by calling the DiagramManager's visualizeJavaFXGraph method.
*
* @return the created graphView {@link SmartGraphPanel}
*/
SmartGraphPanel<String, String> visualizeJavaFXGraph();

/**
* This method creates the Loaded Diagram's JavaFX graphView by calling the DiagramManager's visualizeLoadedJavaFXGraph method
* This method creates the Loaded Diagram's JavaFX graphView by calling the DiagramManager's visualizeLoadedJavaFXGraph method.
*
* @return the created graphView
*/
SmartGraphPanel<String, String> visualizeLoadedJavaFXGraph();

/**
* This method exports the diagram as an image with the help of PlantUML by calling the DiagramManager's
* exportPlantUMLDiagram method
* @param graphSavePath the selected path by the designer where the diagram's image will be saved
* @return the created PlantUML diagram
* exportPlantUMLDiagram method.
*
* @param graphSavePath the selected path by the designer where the diagram's image will be saved
* @return the created PlantUML diagram
*/
File exportPlantUMLDiagram(Path graphSavePath);

/**
* This method saves the PlantUML code to a text file by calling the DiagramManager's exportPlantUMLText method
* @param textSavePath the selected path by the designer where the text file will be saved
* @return the created PlantUML text file
* This method saves the PlantUML code to a text file by calling the DiagramManager's exportPlantUMLText method.
*
* @param textSavePath the selected path by the designer where the text file will be saved
* @return the created PlantUML text file
*/
File exportPlantUMLText(Path textSavePath);

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/controller/ControllerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
public class ControllerFactory {

public static Controller createController(String controllerType, String diagramType) {
ControllerType controllerTypeEnum = ControllerType.get(controllerType);
if (controllerTypeEnum == ControllerType.UML) {
if (ControllerType.get(controllerType) == ControllerType.UML) {
return new DiagramController(diagramType);
}else {
throw new RuntimeException();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/controller/ControllerType.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ public enum ControllerType {
public static ControllerType get(String controllerType) {
return CONTROLLER_TYPE.get(controllerType.toLowerCase());
}

public String toString() {
return super.toString().toLowerCase();
}
}
48 changes: 28 additions & 20 deletions src/main/java/manager/DiagramManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,75 @@
public interface DiagramManager {

/**
* This method creates the tree of the project by parsing the project's source package that the designer has loaded
* @param sourcePackagePath the project's source package path
* @return the SourceProject created, representing the model of the tree
* This method creates the tree of the project by parsing the project's source package that the designer has loaded.
*
* @param sourcePackagePath the project's source package path
* @return the {@link SourceProject} created, representing the model of the tree
*/
SourceProject createSourceProject(Path sourcePackagePath);

/**
* This method converts the tree created by the Parser to a Diagram, based on the files(classes or packages) selected
* by the designer. The type of the Diagram depends on the type of files the designer has chosen and the Controller
* is responsible for creating the corresponding GraphDiagramManager that implements the createDiagram method
* is responsible for creating the corresponding GraphDiagramManager that implements the createDiagram method.
*
* @param chosenFilesNames the names of the files selected by the designer
* @param chosenFilesNames the names of the files selected by the designer
*/
void convertTreeToDiagram(List<String> chosenFilesNames);

/**
* This method arranges the createdDiagram's node geometry by creating a Jung Graph and then applying the SpringLayout
* algorithm, implemented by the Jung library
* algorithm, implemented by the Jung library.
*/
void arrangeDiagram();

/**
* This method exports the created diagram to a file, to the path selected by the designer, in GraphMLFormat, by
* converting the nodes and edges to GraphML syntax
* @param graphMLSavePath the selected path by the designer where the diagram will be saved
* @return the created File in which the diagram was saved
* converting the nodes and edges to GraphML syntax.
*
* @param graphMLSavePath the selected path by the designer where the diagram will be saved
* @return the created File in which the diagram was saved
*/
File exportDiagramToGraphML(Path graphMLSavePath);

/**
* This method saves the created JavaFX diagram to a text file, to the path selected by the designer, by implementing
* a Map that stores the diagrams' nodes as keys and a Map of their edges and the relationship type as their values
* a Map that stores the diagrams' nodes as keys and a Map of their edges and the relationship type as their values.
*
* @param graphSavePath the selected path by the designer where the diagram will be saved
* @return the created File in which the diagram was saved
* @return the created File in which the diagram was saved
*/
File saveDiagram(Path graphSavePath);

/**
* This method loads a JavaFX diagram from a file, selected by the designer, by creating an object of the class
* Diagram and populating the createdDiagram Collection with the contents of the file. The createdDiagram is a Map
* as described in the method above
* as described in the method above.
*
* @param graphSavePath the file's path where the diagram is saved
*/
void loadDiagram(Path graphSavePath);

/**This method creates the JavaFX graphView that will be rendered by view in the JavaFX Pane
* @return the created graphView
/**
* This method creates the JavaFX graphView that will be rendered by view in the JavaFX Pane.
*
* @return the created graphView {@link SmartGraphPanel}
*/
SmartGraphPanel<String, String> visualizeJavaFXGraph();

/**
* This method is responsible for exporting the diagram to a PlantUML image diagram
* @param plantUMLSavePath the selected path by the designer where the exported diagram will be saved
* @return the exported file
* This method is responsible for exporting the diagram to a PlantUML image diagram.
*
* @param plantUMLSavePath the selected path by the designer where the exported diagram will be saved
* @return the exported file
*/
File exportPlantUMLImage(Path plantUMLSavePath);

/**
* This method is responsible for exporting the diagram to a PlantUML text file
* @param textSavePath the selected path by the designer where the exported diagram will be saved
* @return the exported file
* This method is responsible for exporting the diagram to a PlantUML text file.
*
* @param textSavePath the selected path by the designer where the exported diagram will be saved
* @return the exported file
*/
File exportPlantUMLText(Path textSavePath);

Expand Down
12 changes: 4 additions & 8 deletions src/main/java/manager/DiagramManagerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
public class DiagramManagerFactory {

public static DiagramManager createDiagramManager(String diagramType) {
DiagramType diagramEnumType = DiagramType.get(diagramType);
if (diagramEnumType == DiagramType.CLASS) {
return new ClassDiagramManager();
}else if (diagramEnumType == DiagramType.PACKAGE) {
return new PackageDiagramManager();
}else {
throw new RuntimeException();
}
return switch (DiagramType.get(diagramType)) {
case CLASS -> new ClassDiagramManager();
case PACKAGE -> new PackageDiagramManager();
};
}

}
5 changes: 4 additions & 1 deletion src/main/java/manager/DiagramType.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public enum DiagramType {
}

public static DiagramType get(String diagramType) {
return DIAGRAM_TYPE.get(diagramType.toLowerCase());
return DIAGRAM_TYPE.get(diagramType.toLowerCase().trim());
}

public String toString() {
return super.toString().toLowerCase();
}
}
11 changes: 4 additions & 7 deletions src/main/java/model/diagram/ShadowCleaner.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
public class ShadowCleaner {

// TODO Replace with the new ArcType Map
private static final List<ArcType> strongerToWeakerArcTypes =
List.of(
ArcType.EXTENSION,
ArcType.IMPLEMENTATION,
ArcType.AGGREGATION,
ArcType.ASSOCIATION
);
private static final List<ArcType> strongerToWeakerArcTypes = List.of(ArcType.EXTENSION,
ArcType.IMPLEMENTATION,
ArcType.AGGREGATION,
ArcType.ASSOCIATION);

private final ClassDiagram classDiagram;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

public class ClassDiagramArrangementManager implements DiagramArrangementManagerInterface{

public static final LayoutAlgorithmType LAYOUT_ALGORITHM_TYPE = LayoutAlgorithmType.SUGIYAMA;
private final ClassDiagram classDiagram;
private final Graph<String, String> graph;
public static final LayoutAlgorithmType LAYOUT_ALGORITHM_TYPE = LayoutAlgorithmType.SUGIYAMA;
private final ClassDiagram classDiagram;
private final Graph<String, String> graph;

public ClassDiagramArrangementManager(ClassDiagram classDiagram) {
this.classDiagram = classDiagram;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ public interface DiagramArrangementManagerInterface {

/**
* This method is responsible for the arrangement of the graph by creating a graph of the Jung library
* and using the SpringLayout algorithm
* and using the SpringLayout algorithm.
*
* @return a Map with the nodes' id as key and geometry(x,y) as value
*/
Map<Integer, Pair<Double, Double>> arrangeGraphMLDiagram();

/**
* This method is responsible for the arrangement of the graph by creating a graph of the Jung library
* and using different layout algorithms
* and using different layout algorithms.
*
* @return a Map with the nodes' id as key and geometry(x,y) as value
* @return a {@link DiagramGeometry} object which represents the diagram's geometry
*/
DiagramGeometry arrangeDiagram();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ public interface LayoutAlgorithm {
int MIN_X_WINDOW_VALUE = 25;
int MIN_Y_WINDOW_VALUE = 25;

// TODO Update JavaDoc
/**
* This method is responsible for the arrangement of the graph by creating a graph of the Jung library
* and using this graph's coordinates in our front end
* and using this graph's coordinates in our front end.
*
* @return a Map with the nodes' names as key and geometry(x,y) as value
* @return a {@link DiagramGeometry} object which represents the diagram's geometry
*/
DiagramGeometry arrangeDiagram();

Expand Down
Loading

0 comments on commit 0fb3dde

Please sign in to comment.