Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #5141
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.java.gui |
| Subject | Re: Coalescing Updates in MVC? |
| Date | 2012-05-24 08:47 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <jplaj8$n79$1@dont-email.me> (permalink) |
| References | <MVC-updates-20120524124948@ram.dialup.fu-berlin.de> |
On 05/24/2012 07:02 AM, Stefan Ram wrote: > When a controller request many little changes of the model, > it might make sense to update the screen not after every little > update but only after the last update of the containing operation. > > However, the model or view do not know after a little model > update whether there are more updates to come, so they > cannot decide whether to update now or later. Also the model > does not know whether an observer is a View or some other > entity that possibly might need to be notified of each > little update. > > How is this usually handled? > > I see one possibility to write the controller code as, e.g., > > model.startCompoundChange(); > while( final Example example : container )model.add( example ); > model.endCompoundChange(); > > Where »startCompoundChange« and »endCompoundChange« will then > be broadcast to all observers of the model and the observers > now are free to only refresh the display after an »endCompoundChange«. > > Another solution would be to send lightweight update > notifications to the View which then will start a timer to > update after, say, 0.1 s, ignoring all additional update > notifications for the same model that arive during that > time. But this might feel more sluggish to the end user, > because the visual feedback is delayed. > See Cocoa's NSNotificationQueue. Some discussion is here: <http://www.mikeash.com/pyblog/friday-qa-2010-01-08-nsnotificationqueue.html>
Back to comp.lang.java.gui | Previous | Next | Find similar
Re: Coalescing Updates in MVC? Jeff Higgins <jeff@invalid.invalid> - 2012-05-24 08:47 -0400
csiph-web