THIS PROJECT IS DISCONTINUED!!!!
I've decided to discontinue CDI Utils as such. The custom CDI scope part is nowadays provided by Vaadin under a complementary license so there's no longer need for a third party implementation. The remaining utilities are separated as their own projects, namely: CDI Properties (https://github.com/tomivirkki/cdi-properties.git) and CDI MVP (https://github.com/tomivirkki/cdi-mvp.git)
CDI Utils is an add-on for Vaadin framework aiming at simplifying application development with Vaadin and CDI. Here are the utilities it provides:
-
@UIScoped Custom CDI scope designed especially for vaadin applications. @UIScoped beans are bound to a context defined by Vaadin UIs.
-
Lightweight MVP framework
-
Extend View interface for your view
-
Create view instance that extends AbstractView and implements your View extension
-
Extend AbstractPresenter and annotate it with @ViewInterface(YourViewInterface.class) That's it.
- The correct view instance is then automatically injected to your presenter (Your view control logic can then reside in the presenter)
- The view should use CDI's built-in event bus to fire events that are observed by the presenter. The add-on provides a utility for this: fireViewEvent(ParameterDTO). The ParameterDTO can be used to transfer any data to the presenter (CDI Event observers only accept one parameter)
- Call yourViewImplementationInstance.openView() each time the view is accessed (this will eventually invoke yourPresenterInstance.viewOpened())
-
-
Producers for declaratively defined Vaadin components (@Preconfigured -annotation). Inject preconfigured Vaadin Components to your views. For example:
@Preconfigured(captionKey="btnUpdate", styleName=Button.STYLE_LINK, enabled=false)
private Button button;