Page MenuHomePhabricator

Add a create event on Efl.Ui.Factory
Open, HighPublic

Description

It would be easier for multiple reason and purpose to actually have the ability to be notified when an new item is created. This would happen synchronously once the future with the item is resolved. The event is on the factory, but contain the item that was just created.

cedric created this task.Fri, Nov 16, 11:41 AM
cedric triaged this task as High priority.

so what kind of event information need to be given in this event you think?
I think below three is required..

view object
created item object
child index view model object

The child index should be actually a property on the model which should have been set already on the item object. So if you do have the item object, you also do have the model and you do have the index. Now, do we want for convenience purpose all this still exposed in the event ? I am ok with all of that in the object personally, and see no reason why not to put it, but maybe someone see restriction.

Btw I am not sure yet, who should actually take responsibility on emitting this event. I might add an helper to do the emit , but should it be the view that emit it or the factory ?

I... also not sure cause create() is asyncronous and this event should be emitted when create() is ready but it looks quite weird that factory event including some model-based information. if it's view side, it make sense that item holding an model information so may be it need to be emitted by view.

So let's go with the view emitting it and an helper for it.

cedric added a comment.Fri, Dec 7, 4:12 PM

So I created an helper that you have to call to trigger the event. It isn't the best as that means binding don't have it. But I don't really see how to do the chain properly otherwise. I could have two function, one that you should not inherit from and does setup the event generation and the create function, who would be internal, but the only one that needs to be implemented. Still that sounds quite confusing. Do you guys have any idea ?