Directory

MVP for Flow - Vaadin Add-on Directory

Helper addon to use the MVP pattern on Vaadin flow MVP for Flow - Vaadin Add-on Directory
An addon that provides a predefined class structure to make the development of UIs using the Model-View-Presenter Pattern more comfortable under Vaadin flow. ### View ``` public class TestView extends VerticalLayout { private final Button button1; private final Button button2; private final Button button3; private final Button button4; public TestView() { button1 = new Button(); button2 = new Button(); button3 = new Button(); button4 = new Button(); add(button1, button2, button3, button4); } //... getters and setters } ``` ### Presenter ``` @Route("") public class TestPresenter extends Presenter { public TestPresenter() { String[] descriptions = getModel().getDescriptions(); getContent().getButton1().setText(descriptions[0]); getContent().getButton2().setText(descriptions[1]); getContent().getButton3().setText(descriptions[2]); getContent().getButton4().setText(descriptions[3]); } } ``` ### Model ``` public class TestModel implements Model { public String[] getDescriptions() { return new String[]{"Button1", "Button2", "Button3", "Button4"}; } } ```