• Post Reply Bookmark Topic Watch Topic
  • New Topic

Observer Pattern problem

 
Tim Nachreiner
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem begins when the controller calls createAndShowPerson.
The controller listens to the model. When the model creates a new Person, I want the controller to be notified. However, in the model.createPerson method, the notifyModelListener method is out of range. I can't figure out how to get around this problem.



 
Tim Nachreiner
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved it with this:

 
Dave Tolls
Ranch Hand
Posts: 2281
24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens in createAndShowPerson now?
You were using the returned Person to set the Controller's Person attribute.
 
Tim Nachreiner
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now my controller doesn't expect to get anything back from the model.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!