User Tools

Site Tools


devel:design:observer

Observers of the model structure

Workcraft uses the Observer pattern both mathematical and visual models create a number of observers listening to the changes in hierarchy such as adding and removing nodes in some container.

  • DefaultHangingConnectionRemover removes connections that cannot exist without the nodes being removed.
  • NodeContextTracker for each node provides the model with the information about the current pre-set and post-set. It can also quickly return all related connections to a given node.
  • DefaultMathNodeRemover counts references from the visual node to the math node. When all related visual nodes are deleted, the corresponding math node is deleted as well.
  • RemovedNodeDeselector listens to the node removal events and removes these nodes from the visual model selection as well.
  • FlatReferenceManager and HierarchyReferenceManagermake sure that all nodes are named. These names are necessary during the serialization and deserialization procedures. The former is used for visual models and the later for the mathematical ones.