1

I see that presenter can initialize/define the view as

@VaadinPresenter(viewName = "string name of the view")
public class MyPresenter extends Presenter<MyView> {
    ...
}

and access the view with getView().

I could not find any examples for defining the model similar way. Maybe I am wrong, but Presenter should be the glue between the Model and View. So, I was thinking that Presenter would have the similar pattern for the Model.

I appreciate if you can share any examples and ideas.

turgos
  • 1,464
  • 1
  • 17
  • 28

1 Answers1

0

First of all I want to say that MVP is a very complex topic.

Petter, an Vaadin architect, has written an interesting article in the official Vaadin Blog: https://vaadin.com/blog/-/blogs/is-mvp-a-best-practice-

MVP is a vague pattern that can be interpreted and used in many different ways. [...]

The model maintains the state of the application. It could be the contents of a form, the rows in a table, the current selection, or a combination of all of them. UI components can access the model and subscribe to changes (either directly or via their presenters). Whenever the model is changed, the subscribers are notified and can update themselves accordingly.

The model can be implemented in different ways. It can extend java.util.Observable, use Java Bean PropertyChangeEvents, expose Vaadin Containers, Items and Properties directly or implement its own mechanism.

Maybe you should take a look at the official Vaadin Book where an example of the model is explained: https://vaadin.com/book/-/page/advanced.architecture.html

I hope that helps!

Regards

shinchillahh
  • 515
  • 1
  • 4
  • 22