Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] Proposal to replace the 'visible' flag


David, I've been toying with the idea of switching over to a dirty/refresh cycle for the synchronization of the presentation and the model. If there were a method in the renderer ('synchUI') then we could switch away from the current pattern (where discreet listeners manage changes to their own particular attributes) and adopt a much simpler approach. The general plan would be something like this:

- a global listener detects that some UI-related attribute has changed and adds the element to the 'dirty' list. (if it's not already there)
- if the change is containment related (ADD/REMOVE) then the parent is added to the list
- at some point (in SWT likely using asycnExec) we traverse the dirty list calling 'sychUI' on the elements renderer and then clear it

This has a few advantages over the more fine-grained approach we are currently using:

- Handles multiple attribute changes to the same element (i.e. label, tooltip and icon) to be handled in a single sych, right now we set each separately causing 3 updates in the UI).
- Allows at least the potential to optimize sets of changes by examining the complete list of pending changes

The big advantage though is that it makes the rendering simpler by removing the necessity for each discreet renderer to create its own set of discreet listeners, all they would have to do is to write the 'synchUI' merhod. Of course care should be taken in 'synchUI' to minimize the impact on the rendered widget (i.e. Only call 'setText' on the widget if it's different from what's already there...).

From your experience do you have any hints as to whether this is better/worse than the current state ?

Eric



From: David Orme <djo@xxxxxxxxxxxxxxxxxxxxxxxxx>
To: E4 Project developer mailing list <e4-dev@xxxxxxxxxxx>
Date: 10/21/2010 12:41 PM
Subject: Re: [e4-dev] Proposal to replace the 'visible' flag
Sent by: e4-dev-bounces@xxxxxxxxxxx





FWIW:

On Thu, Oct 21, 2010 at 10:17 AM, Tom Schindl <tom.schindl@xxxxxxxxxxxxxxx> wrote:
visibility = NONE      (no widget)
visibility = TO_RENDER (widget created but not shown)
visibility = VISIBLE   (widget made visible)


I've found this be a common idiom in UI controls.

Similarly, updating/refreshing/redrawing a UI control often follows a similar pattern:

* Mark the widget as dirty or otherwise trigger a refresh
* Recalculate where everything has to go now
* Actually move stuff around/repaint

HTH.  :)


Regards,

Dave Orme
_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev



Back to the top