I have this situation:
An object that it's observable and another object that it is observer.
the observer has a method update(Observable obs,Object obj)
that receive through notifyObservers
the object changed.when observer receives the notify, update method prints the object changed. I want print out the result in a gui that implements MVC pattern.I'm following this guide MVC pattern.
My idea is to make the Controller
the observer. something like that:
public class Controller extends AbstractController implements Observer
{
public static final String TOTAL_HIT_COUNT_PROPERTY = "Total Hit";
public void changeTotalHitCount(long new_total_hit_count)
{
setModelProperty(TOTAL_HIT_COUNT_PROPERTY, new_total_hit_count);
}
@Override
public void update(Observable o, Object arg)
{
}
}
but I don't know if it's a correct implementation!