Navigate in abstract Presenter-Class

Hello together,

I have a problem regarding the navigation in my app (Vaadin + Spring).

I wanted to reduce some code with an abstract Presenter and View class, which show a Grid and some buttons for editing, deleting and to add new items to the Grid.

How can I navigate in the abstract Presenter to the correct edit view for the item? How can he know the right naming of this view? Is even possible to create the global presenter which this kind of functionality?

My View looks like this:

public abstract class AbstractView<T extends AbstractEntity> implements Serializable, View, HasLogger { ... @PostConstruct private void initLogic() { getUpdate().addClickListener(event -> getPresenter().updateClicked()); getDelete().addClickListener(event -> getPresenter().deleteClicked()); getAdd().addClickListener(event -> getPresenter().addNewClicked()); } } In my presenter if have the functions updateClicked, deleteClicked, etc. and he knows the NavigationManager, but again, how does he knows the correct Editing-View-Class?

Thank you in advance,
Yacin

Just create an abstract method that returns the correct view class and implement it in your proper Presenter implementations?

-Olli

Oh thanks. So simple. Works with an abstract method.