Announcements for changes in a Lepiter knowledgebase

This page describes the announcements used within Lepiter to signal various changes in a knowledgebase and keep the model of the database in sync with the UI.

Announcements for content changes

These are announcements for when the structure or content of a page changes.

There are two types of such announcements:

- announcements for executed commands: are announced when a command is executed

- announcements for direct page changes: are announced by domain objects like pages and snippets when a change happens at that level

Announcements for executed commands

Changes to the content of a page are done in Lepiter using commands. An instance of LeContentCommandExecutedAnnouncement Announcement subclass: #LeContentCommandExecutedAnnouncement instanceVariableNames: 'result command' classVariableNames: '' package: 'Lepiter-History-Announcements' is announced after a command is executed.

To get more details about what changed one needs to look at the command from within the announcement. Some commands can perform multiple changes to snippets (like merging or splitting snippets), while other command can just rearange the structure of snippets (like indenting a snippet). In all cases, regadless of how many changes the command does only an

Announcements for direct page changes

These can either be for changes in the content of a snipper, or changes in the structure of a page.

Announcements for snippet changes

The main announcement for signalling a change within an individual snippet is LeSnippetContentChanged LeSnippetAnnouncement subclass: #LeSnippetContentChanged instanceVariableNames: '' classVariableNames: '' package: 'Lepiter-Core-Announcements' . Snippets can use subclasses to model different types of changes.

Depending on the snippet, a single change done within the UI by the user can result in multiple change announcements. To get an idea of what announcement a snippet uses you can check the methods overriding LeSingleSnippetUpdateExamples>>#assertModificationAnnouncements: assertModificationAnnouncements: announcements "This assertion should be overriden by subclasses to check that a modification to the snippet resulted in the right announcements" in classes testing a specific type of snippet.

Announcements for page structure changes

Subclasses of LeContentTreeChanged LeAnnouncement subclass: #LeContentTreeChanged instanceVariableNames: 'content' classVariableNames: '' package: 'Lepiter-Core-Announcements' indicate a change in the strucutre of a page.

LeContentTreeAdded LeContentTreeChanged subclass: #LeContentTreeAdded instanceVariableNames: 'parent index' classVariableNames: '' package: 'Lepiter-Core-Announcements' is announcer when a new snippet was added. In case the snippet has children, the announcement is only announced once for the main snippet added to the page.

LeContentTreeRemoved LeContentTreeChanged subclass: #LeContentTreeRemoved instanceVariableNames: 'page database' classVariableNames: '' package: 'Lepiter-Core-Announcements' is announcer when a snippet was removed from a page. In case the snippet has children, the announcement is only announced once for the main snippet removed from the page.

Subclasses of LeContentTreeMoved LeContentTreeChanged subclass: #LeContentTreeMoved instanceVariableNames: 'destinationParent destinationIndex' classVariableNames: '' package: 'Lepiter-Core-Announcements' are announced for changes that move existing snippets within a page, like moving snippets up and down, or indenting/dedenting snippets.

Announcement for page changes at the page level

These are announcements raised at the level of the page.

LePageTitleChanged LePageAnnouncement subclass: #LePageTitleChanged instanceVariableNames: 'oldTitle newTitle oldType newType oldDatabaseKey newDatabaseKey' classVariableNames: '' package: 'Lepiter-Core-Announcements' is announcer when the title of named page is changed.

LePageRemovedFromDatabase LePageAnnouncement subclass: #LePageRemovedFromDatabase instanceVariableNames: 'database' classVariableNames: '' package: 'Lepiter-Core-Announcements' is announced when a page is completely removed (as opposed to being moved to another database).

LePageDatabaseChanged LePageAnnouncement subclass: #LePageDatabaseChanged instanceVariableNames: 'previousDatabase currentDatabase' classVariableNames: '' package: 'Lepiter-Core-Announcements' is announcer when a page was moved between two databases.

Announcement for page changes at the knowledgebase level

These are announcements at the level of an entire page.

LeDatabasePageAdded LeDatabaseAnnouncement subclass: #LeDatabasePageAdded instanceVariableNames: 'page' classVariableNames: '' package: 'Lepiter-Core-Announcements' indicates that a new page was added to a knowledgebase. When an entire knowledgebase is added to a logical knowledgebase, no events for individual pages are raised.

LeDatabasePageRemoved LeDatabaseAnnouncement subclass: #LeDatabasePageRemoved instanceVariableNames: 'page' classVariableNames: '' package: 'Lepiter-Core-Announcements' indicates that a page was explicitly removed from a knowledgebase.

This event is not raised when an entire database is removed, only when users remove individual pages. When an entire database is removed unloading announcements are used.

This event, in combination with a LeDatabasePageAdded LeDatabaseAnnouncement subclass: #LeDatabasePageAdded instanceVariableNames: 'page' classVariableNames: '' package: 'Lepiter-Core-Announcements' is announced when a page is moved between two databases.

Announcements for unloading databases

LeDatabaseUnloadAnnouncement LeUnloadAnnouncement subclass: #LeDatabaseUnloadAnnouncement instanceVariableNames: '' classVariableNames: '' package: 'Lepiter-Core-Announcements' indicate that an entire database was unloaded from the system. This means that the database is still on disk, but no longer loaded in GT. When a database is unloaded LePageUnloadAnnouncement LeUnloadAnnouncement subclass: #LePageUnloadAnnouncement instanceVariableNames: '' classVariableNames: '' package: 'Lepiter-Core-Announcements' announcements are announcer for every page, and LeSnippetUnloadAnnouncement LeUnloadAnnouncement subclass: #LeSnippetUnloadAnnouncement instanceVariableNames: '' classVariableNames: '' package: 'Lepiter-Core-Announcements' for every snippet.