Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@jordanmontt
Copy link
Contributor

It is a collection that store hooks that will be executed when closing the window of the presenter. As it is aimed to have a plugin architecture in Cormas, this hooks will serve for users can add custom actions when the simulation window is closed (for example to clean a simulation data when the window is closed).

For now, this is used for adding the rules support

@olekscode
Copy link
Member

I can see that you added an instance variable but no accessors. How can those hooks be defined?

@jordanmontt
Copy link
Contributor Author

People can specialize the hooks through the plugins architecture. Currently, one can define its own presenters for the cormas ui by creating an extension method of CMSimulationPresenter that returns a notebook page. For example look at this method. It defined an action to be executed when the window is closed.

CMSimulationPresenter >> settingsNorms

	<fancyNotebookPageOrder: 30>

	| rulesApplier |
	rulesApplier := CMRulesApplier new
		rules: modelClass new modelRules;
		yourself.

	whenWindowsIsClosedHooks add: [ rulesApplier unapplyRules ].

	^ SpNotebookPage
		  title: 'Model Norms'
		  icon: (self iconNamed: #history)
		  provider: [ CMNormsPresenter on: rulesApplier ]

@olekscode olekscode merged commit c862981 into cormas:dev Dec 11, 2025
6 checks passed
@jordanmontt jordanmontt deleted the rules branch December 11, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants