Helper addon to use the MVP pattern on Vaadin flow

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<TestModel, TestView> {

    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<TestModel> {
    public String[] getDescriptions() {
        return new String[]{"Button1", "Button2", "Button3", "Button4"};
    }
}

Install

Link to this version
StableReleased 21 October 2019Apache License 2.0
Framework Support
Vaadin platform 10+
Browser Independent
Install with
Release notes - Version 1.0.0