Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You're right, almost always the presenter is the only guy holding the model and managing its lifetime. <strong>Model</strong> from previous GWT versions has simply been a DTO, (and continues to be) a POJO which are created by the GWT deserializer when RPC methods return, or created by Presenters and filled with UI data by UIHandlers, and sent to the server.</p> <p>I have taken efforts, to keep the Models lifetime encapsulated within the Activities lifetime, and avoided storing state outside of activities. (I do however have a singleton Global State maintained for use from anywhere in the application.) This I think is what GWT MVP engineers assumed will happen - It makes sense when, say the user has navigated away from a <strong>Place</strong>, for the models associated with that place also to get disposed (&amp; collected). Create models, fill them up inside the activities, and make service calls to update the server before navigating away (or triggered by some control on the page), and let them go along with the activity - is what I have been doing till date.</p> <p>A bigger project I have been involved in faced quite a few browser memory footprint issues, and all of them were due to objects which are associated with another (not currently viewed) <strong>Place</strong> being in memory. It was hard to track and remove references to these objects, and since the user has navigated away from the screen - the "<em>why are my old screen objects still in memory?</em>" question cropped up frequently and subsequently got fixed. This is why, upfront, I chose to keep the Model's lifetime encapsulated within the Activities lifetime in my current pet project.</p> <p>If you have models that span across (that are filled/accessed by) several activities (as is the case if you have sidebars &amp; master/container widgets), some redesigning of models maybe in order, if you have examples I will try and help. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload