Thunderbird/NextGeneration/Collections

From MozillaWiki
< Thunderbird‎ | NextGeneration
Revision as of 22:46, 14 August 2017 by BenB (talk | contribs) (Author)
Jump to navigation Jump to search

Author: Ben Bucksch (Please check with the author before modifying)

A recurring pattern across the model of many components is to have a list of objects.

For example, a message folder has a list of messages and a list of other sub-folders.
An address book is basically just a list of address book cards.

For most of these lists, it is important to be notified of changes, i.e. that they are observable. Most of these lists also need add and remove functions.

Instead of re-creating these common functions, we will use a collection library that creates a standard API and implementation, which allows addition/removal, observing, and higher-level functions like merging lists.

The UI list widgets can then directly subscribe to these observers, and automatically update. The concrete application UI only needs to define how to render a single item, which list to render.

This will dramatically simplify the API and implementation of the entire application.

For example, the address book API needs to have only 2 properties: The name of the AB and the list of cards. The list is the generic collection API and allows addition and removal of cards.
Likewise, the account manager only needs a property with the list of accounts, which is a standard collection.

For the API, see: