Changes between Version 10 and Version 11 of mvc
- Timestamp:
- 06/13/22 11:48:10 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
mvc
v10 v11 61 61 The MapModel contains a Map, or dictionary, of values. Both key and value are a Model so this is a compound model. That key and value are a Model implies that both key and value can be manipulated directly, without calling the MapModel directly. All implementations of MapModel will listen to such changes and notify the change anyway. 62 62 MapModel provides a getValue(key) and a put(key,value) function. 63 MapModels have a getKeys function that returns a ListModel of the keys in the map. Any changes to this listmodel must be reflected immediately into the map. Removing keys generally is easy, but when a key is added the MapModel must also insert the proper value. This may be easy or complex, up to the point where a popup may be needed to ask more information from the user. 63 64 64 65 DefaultMapModel is the basic implementation of MapModel. It is implemented using a LinkedHashMap, which helps keeping a fixed order in the elements. This fixed order is important to ensure the display of the elements in the GUI remains fixed. It also allows setting a minimum number of elements in the map … … 66 67 MapFromKeys is a special implementation of MapModel that generates a Map from a ListModel. The ListModel contains the Keys of the Map. Note that ListModel can change at any moment, and MapFromKeys will always adapt immediately to meet the change. MapFromKeys ensures that all keys always have a value. If needed, the create() function is called to automatically generate a new value for a key. When a key is removed and then later re-added, MapFromKeys may remember the old value, if isRetainValues is set. 67 68 69 === SelectionModel 70 A SelectionModel adds selection to a Model, by adding setSelection(), getSelection() and getListModel(). 71 The primary implementation is the DefaultSelectionModel. DefaultSelectionModel takes a ListModel and just stores the selection separately. When a selected list item is removed, the selection is cleared. 72 68 73 === TypedModel and RealType 69 74 The RealType refers to the actual object contained in the model. This is especially relevant for Compound Models, such as the Person model described above. The getCurrentValue function now returns a Person.