Page MenuHomePhabricator

Add an Efl.Ui.Sorted_Model
Open, HighPublic


We need a way to sort a composited model. This require the ability to insert object anywhere we want into the children list.

cedric created this task.Oct 11 2019, 9:36 AM
cedric triaged this task as High priority.

This is also related to improvement from T8348 as it will impact the API to insert children.

cedric removed cedric as the assignee of this task.Jan 24 2020, 4:17 PM

I think that this model can have two strategy for the sorting. On the first notification of a child being added or if the count > 0 when the compositing is done, the model batch fetch all the child of the composited model and sort them using a merge sort. The idea would be to keep just an index mapping of which child of the sorted model map to which child in the composited model.

The sorting function should either provide a list of property that needs to be ready for it to give a result and always provide a result when they are ready, or the sorting function should be asynchronous. I tend to think that the later case will be safer to write even if it means inserting things in a non batch way to start. Later we could have a job that group all the insertion ready for a frame and do only one call for that.

As there is no event on an model that is not loaded, it will be impossible to sort a Model after it has been sorted and it isn't watched anymore. This is a known limitation of the MVVM infrastructure we have built. If someone needs to sort a Model again, it should remove it and add it again. This is what happens in Efl.Io when a file is renamed anyway. So I do think this is acceptable.