Core Services¶
here you can find the API for services that are related to model creation and model manipulation.
Element Repository (/Factory)¶
- class gaphor.core.modeling.ElementFactory(event_manager: EventManager | None = None, element_dispatcher: ElementDispatcher | None = None)[fuente]¶
The
ElementFactoryis used as a central repository for a model.New model elements should be created by
create.Methods like
selectcan be used to find elements in the model.- select(expression: Callable[[Base], bool]) Iterator[Base][fuente]¶
- select(expression: type[T]) Iterator[T]
- select(expression: None) Iterator[Base]
Iterate elements that comply with expression.
Expressions can be:
None: return all elements.A type: return all elements of that type, or subtypes.
An expression.
- lselect(expression: Callable[[Base], bool] | type[T] | None = None) list[Base][fuente]¶
Like
select, but return a list, instead of an iterator.
- create(type: type[T]) T[fuente]¶
Create a new model element of type
type.This method will only create model elements, not
Presentationelements: those are created byDiagram.
Modeling Language¶
Information on how modeling languages are managed can be found Lenguajes de modelado.
Event Manager¶
The Sistema de eventos takes care of dispatches events throughout Gaphor.