Počni raditi s Gaphorom

Gaphor is more than a diagram editor: it’s a modeling environment. Where simple diagram editors such as Microsoft Visio and draw.io allow you to create pictures, Gaphor actually keeps track of the elements you add to the model. In Gaphor you can create diagrams to track and visualize different aspects of the system you’re developing.

Enough talk, let’s get started.

You can find installers for Gaphor on the Gaphor Website. Gaphor can be installed on Linux (Flatpak), Windows, and macOS.

Nakon pokretanja Gaphora, prikazuje se uvodni ekran. Prikazuje prethodno otvorene modele i predloške modela.

uvodni ekran

Počni izborom predloška.

  • Generički: prazni model

  • UML: Predložak za Unified Modeling Language za modeliranje softverskog sustava

  • SysML: Predložak za Systems Modeling Language za modeliranje raznih sustavskih modela i sustava-od-sustava

  • RAAML: Predložak za Risk Analysis and Assessment Modeling language za sigurnost i analizu pouzdanosti

  • C4 Model: A template for Context, Containers, Components, and Code which is for lean modeling of software architecture

Nakon što se sučelje modela učita, vidjet ćeš sučelje za modeliranje.

novi model

Raspored sučelja Gaphora je podijeljen u četiri odjeljka, naime:

  1. Preglednik modela

  2. Kutija alata za elemente dijagrama

  3. Dijagrami

  4. Uređivač svojstava

Svaki odjeljak ima vlastitu specifičnu funkciju.

Preglednik modela

The Model Browser section of the interface displays a hierarchical view of your model. Every model element you create will be inserted into the Model Browser. This view acts as a tree where you can expand and collapse different elements of your model. This provides an easy way to view the elements of your model from an elided perspective. That is, you can collapse those model elements that are irrelevant to the task at hand.

In the figure above, you will see that there are two elements in the Model Browser. The root element, New Model is a package. Notice the small arrow beside New Model that is pointing downward. This indicates that the element is expanded. You will also notice the two sub-elements are slightly indented in relation to New Model. The main element is a diagram.

In the Model Browser view, you can also right-click the model elements to get a context menu. This context menu allows you to find out in which diagram model elements are shown, add new diagrams and packages, and delete an element.

Double-clicking on a diagram element will show it in the Diagram section. Elements such as classes and packages can be dragged from the tree view on the diagrams.

Kutija alata

The toolbox is used to add new items to a diagram. Select the element you want to add by clicking on it. When you click on the diagram, the selected element is created. The arrow is selected again, so the element can be manipulated.

Tools can be selected by simply left-clicking on them. By default, the pointer tool is selected after every item placement. This can be changed by disabling the „Reset tool” option in the Preferences window. Tools can also be selected by keyboard shortcuts. The keyboard shortcut can be displayed as a tooltip by hovering over the tool button in the toolbox. Finally, it is also possible to drag elements on the Diagram from the toolbox.

Dijagrami

The diagram section contains diagrams of the model and takes up the most space in the UI because it is where most of the modeling is done. Diagrams consist of items placed on the diagram. There are two main types of items:

  1. Elementi

  2. Odnosi

Moguće je otvoriti više dijagrama odjednom: oni se prikazuju u karticama. Kartice se mogu zatvoriti pritiskom Ctrl+w ili pritiskom lijevog gumba miša na oznaku „x” u kartici dijagrama.

Elementi

Elements are the shapes that you add to a diagram, and together with Relations, allow you to build up a model.

To resize an element on the diagram, left-click on the element to select it and then drag the resize handles that appear at each corner.

To move an element on the diagram, drag the element where you want to place it by pressing and holding the left mouse button, and moving the mouse before releasing the button.

Veze

Relations are line-like items that form relationships between elements in the diagram. Each end of a relation is in one of two states:

  1. Spajanje s elementom – crvena ručka

  2. Odspajanje od elementa – zelena ručka

Ako su oba kraja veze nepovezana, veza se može pomaknuti pritiskom lijeve tipke miša i povlačenjem.

A new segment in a relation can be added by left-clicking on the relation to select it and then by hovering your mouse over it. A green handle will appear in the middle of the line segments that exist. Drag the handle to add another segment. For example, when you first create a new relation, it will have only one segment. If you drag the segment handle, then it will now have two segments with the knee of the two segments where the handle was.

Copy and Paste

As stated before, Gaphor is a modeling environment. This means that every item in a diagram is backed by a model element found in the model browser. This means that you can show the same model element in different diagrams.

  • Ctrl+v is used to paste only the presentation element.

  • Ctrl+Shift+v is used to paste a new presentation with a new model element.

Važno

Ctrl+v does a „shallow” paste. Ctrl+Shift+v does a „deep” paste.

Poništi i ponovi

Undo a change press Ctrl+z or left-click on the back arrow at the top of the Property Editor. To re-do a change, hit Ctrl+Shift+z or press the forward arrow at the top of the Property Editor.

Uređivač svojstava

The Property Editor is present on the right side of the diagrams. When no item is selected in the diagram, it shows you some tips and tricks. When an item is selected on the diagram, it contains the item details like name, attributes and stereotypes. It can be opened with F9 and the sidebar-show-right-symbolic icon in the header bar.

The properties that are shown depend on the item that is selected.

Postavke modela

The Property Editor also contains model preferences: Click the document-properties-symbolic button.

Reset Tool Automatically

By default, the pointer tool is selected after an element is placed from the toolbox. If this option is turned off, the same type of element will be placed by clicking in the diagram until another element is selected in the toolbox.

Remove Unused Elements

By default, elements that are not part of any diagram in the model will be removed. If this option is turned off, elements remain in the model and may be found in the model browser.

Diagram Language

The diagram language modifier is only applicable to the loaded model and how it is shown in the diagram. The diagram language setting is saved as part of the model and defaults to English.

The UI language of Gaphor is controlled by the operating system.

Napomena

Gaphor considers the LANG environment variable on Linux, Windows and macOS.

On Windows and macOS it can be set independently of the operating system’s language settings to a different language.

Style Sheet

The style sheet allows to change the visual appearance of diagrams and model elements.