java - Observer/observable objects with MVC pattern -


I have this situation:

This is an object that is the object and other object that is called supervisor .

The supervisor has a method update (Observable Observe Object Object) , which is achieved by changing the object through NotifyObservers . When the supervisor is notified, update the method, the object has changed, I have to print the result in a GI that implements the MVC pattern. I am following this guide. I think that the controller is to create supervisor something like this:

  public class controller Expands AbstractController Supervisor {public static final string TOTAL_HIT_COUNT_PROPERTY = "total hits"; Public Zero Transit ChangeLook (long new_tata_height_gate) {setModelProperty (TOTAL_HIT_COUNT_PROPERTY, new_total_hit_count); } @ Override Public Zero Update (Observation, Object Arg) {}}   

But I do not know this is the correct implementation!

and 2 different design patterns - just to make sure that we are on the same page.

In MVC (minimal definition) pattern, the view is assumed to be updated automatically when the model changes, so I guess you are trying to do this. In that case, this means that your audience should be visible, not the controller, and your model will be your observable object.

As follows:

  Overview changes - & gt; Update the Observer   

You are trying to get into the pure MVC pattern:

  Modal changes -> See the update   

I'm not saying that this should be the way to do the job, but I think if you try to apply Java Observer / Observevar to the MVC pattern , Then it may happen to go along with it.

Comments