Okruženje

Pregled

Gaphor je izgrađen za jednostavan, uslužno orijentirani način. Aplikacija je podijeljena na niz usluga, kao što su upravljači datoteka, događaja i poništavanja. Te se usluge učitavaju na temelju ulaznih točaka definiranih u datoteci pyproject.toml. Za više informacija o arhitekturi, pogledaj opis za Service Oriented Architecture.

Event driven

Parts of Gaphor communicate with each other through events. Whenever something important happens, for example, an attribute of a model element changes, an event is sent. When other parts of the application are interested in a change, they register an event handler for that event type. Events are emitted though a central broker so you do not have to register on every individual element that can send an event they are interested in. For example, a diagram item could register an event rule and then check if the element that sent the event is actually the event the item is representing. For more information see the full description of the event system.

Transakcijski

Gaphor is transactional, which means it keeps track of the functions it performs as a series of transactions. The transactions work by sending an event when a transaction starts and sending another when a transaction ends. This allows, for example, the undo manager to keep a running log of the previous transactions so that a transaction can be reversed if the undo button is pressed.

Glavne komponente

Glavni dio Gaphora koji se najprije izvršava zove se Application. Gaphor može imati više otvorenih modela u bilo kojem trenutku. Svaki model se čuva u Sesiji. Aktivna je samo jedna instanca aplikacije. Svaka će sesija učitati vlastite usluge definirane kao gaphor.services.

Najistaknutije usluge su:

event_manager

Ovo je središnja komponenta koja se koristi za slanje događaja. Svaka usluga koja radi nešto s događajima (slanje i primanje) ovisi o ovoj komponenti.

file_manager

Učitavanje i spremanje modela vrši se putem ove usluge.

element_factory

The data model itself is maintained in the element factory (gaphor.core.modeling.elementfactory). This service is used to create model elements, as well as to lookup elements or query for a set of elements.

undo_manager

Jedna od najcjenjenijih usluga. Omogućuje korisnicima da tu i tamo pogriješe!

Upravljač poništavanja je transakcijski. Korisničke radnje se spremaju samo ako je transakcija aktivna. Ako je transakcija dovršena (poslana), sprema se nova radnja poništavanja. Transakcije se također mogu vratiti. U tom slučaju se sve promjene reproduciraju izravno. Za više informacija pogledaj opis undo manager.