MVP-Lite
MVP-Lite is a simple lightweight event-based model-view-presenter framework
MVP-Lite is a simple lightweight event-based model-view-presenter framework, which provides the following features:
- Simple model-view-presenter api
- Arbitrary many subviews
- Navigateable views with browsers history support
- Autogenerated Breadcrumb GUI component
- An EventBus to develop event-driven applications (with @EventHandler Annotation)
- Real time communication with an GlobalEventBus.
One does not need to use all enumerated features but can choose those who are needed
Unfortunately bookmarkable views (URL) are not supported yet, but they will be supported with the next major stable release (developing in progress). Even Google App Engine is not supported yet.
Check the demo code on github: https://github.com/sockeqwe/Vaadin-MVP-Lite-MailExample
Sample code
public class MainPresenter extends Presenter<MainView> implements Serializable{ private static final long serialVersionUID = -9824276818586872L; private final User user; private final MailService mailService; public MainPresenter(MainView view, EventBus eventBus, User user, MailService mailService) { super(view, eventBus); this.user = user; this.mailService = mailService; bind(); // Set the initial unreadcount getView().setInboxUnreadCount(mailService.getUnreadInboxCountOf(user)); } private void bind(){ getEventBus().addHandler(this); } @EventHandler public void onUnreadCountChanged(UnreadCountChangedEvent e) { getView().setInboxUnreadCount(e.getUnreadCount()); } }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
- EventBus.removeHandler(): Bugfix, so that a handler is really unregistered from the EventBus (thank you alin-dev and manuprathab)
- GlobalEventBus: You can now use null as parameter, if you don't want to register a Client to any group / channel.
- Released
- 2013-04-14
- Maturity
- STABLE
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 6.0+
- Browser
- Browser Independent