java - Model View Controller: Where to conditionally fetch new data into model? -


I have an Eclipse RCP application that has a view-patch that adheres to the Model-View-Controller (MVC) design is. The model is a catch-up of current data. Newsstand is a scene that listens for changes on the model and reloads the UI if necessary.

In my application logic, I want to get new data in a model, when a user selects entry from the list. Since the data is brought to a server, I am doing this to avoid using the Eclipse job framework in another thread to block the UI.

Now, I'm struggling to find the best place to build and start. Background jobs Do you have any recommendations on this? I look at two possible ways:

  • For this, in the Administrator , the controller will also need to hear changes in the model. When the new data is received, the administrator should inform and update the controller model; Or should I pass the reference of the model which automatically updates the model?
  • In the model . I have seen references that say that the data should be part of the fetching model. In this way I can directly control the model, which triggers conditions to load new data. This can be considered as a "business logic" but then I have the dependency on the eclipse interior within the model and hence it is no longer a standalone unit (hard test).
  • Edit: I know that MVC is rather loosely defined if I use the example for model-view-presenter design, then what answer is different Or would anyone be clear? There are slightly better defined responsibilities in the IMHO presenter in MVP.

I would say ...

selects the user list entry Is - & gt; Controller handles events - & gt; The controller starts a job, passing the model - & gt; Job update model - & gt; UI update based on change in model (if necessary)

My argument ...

Controller's role is to handle UI events - List entry selections from there , You are receiving data from the server and it is injected into the model. In my opinion, it should be kept different (i.e. external) from the model - for example, you can change the networking library without affecting the data model.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -