Search code examples
txtuml

step by step solution needed for the txtUML diagram


I am a novice to txtUML. I tried to follow the tutorial and youtube link on txtUML to run the below code, but didn't understand how they add txtUML diagram from nowhere? Please Help me to understand the code and any step by step procedure to run this code will be helpful.enter image description here


Solution

  • The diagram generation feature of txtUML was built to be able to create fully user customizable diagrams. Hence the development team introduced a diagram description language. With this language the user can give constraints to the elements on the diagram.

    To be able to create a diagram you'll need to have model of cousre. The diagram description is a Java class, the constraints can be defined through java annotations. An empty description of Class Diagram looks like the following:

    class MicrowaveClasses extends ClassDiagram {
        class MicrowaveLayout extends Layout {}
    }
    

    In case of Class Diagrams the description class have to extend hu.elte.txtuml.api.layout.ClassDiagram

    The Layout inner class has to be annotated with the constraints. For example @TopMost(MicrowaveOven.class) will place the MicrowaveOven ModelClass to the top of the class diagram. Further reading

    After you're done with the diagram description you can choose diagram generation option from the menu: txtUML->Generate diagrams from txtUML. On the wizard page you should browse the project where your model is to be found, the java package which represents your model (the package where the model-info.xtxtuml file is to found), and at least one diagram description (in this case MicrowaveClasses).

    A Papyrus model will be created with as many diagrams as you selected on the wizard page. To each diagram description there will be a Papyrus diagram generated. The process is clearly to be seen in the Youtube video that you mentioned.