Skip to content

Demonstrating how to use CDI, Push, executor service, model view presenter and inversion of control patterns with Vaadin 8

Notifications You must be signed in to change notification settings

roastedcpu/cdi-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

cdi-demo

Demonstrating how to use CDI with Vaadin 8

There are number of CDI use cases demonstrated in this app, some of them are generic and not restricted to Vaadin usage

The views are implemented using MVP (Model View Presenter) pattern

Start the app using

wildfly:run

Then open it in the browser

http://localhost:8080/javaee-demo-1.0-SNAPSHOT/ui

Here is a brief summary what you can find here

  • LoggerProducer:

    • Producer pattern, see for injecting slf4j logger in classes
  • MyVaadinUI:

    • Usage of @CDIUI annotation
    • Injectable CDINavigator
    • Using CDI events to trigger navigation
    • Extending VaadinCDIServlet and setting SessionExpired error not to show and directly refresh the UI to login
    • Parse query parameters
    • Deploys to context "ui"
  • VersionLabel: Shared UIScoped component used by multiple views

  • UserListService:

    • ApplicationScoped user repository
  • UserProfileHolder:

    • VaadinSessionScoped user entity management
    • Login, logout and access level methods
  • AdminView

    • Access control with restricted access
    • Async update of the view content using ManagedExecutorService and CompletableFuture, showing spinner while loading
  • MainView

    • Using UIScoped (VersionLabel) and ViewScoped beans
    • Access control
    • Opening new browser tab with BrowserWindowOpener (demoing VaadinSessionScoped user enitity)
    • Demoing passing query and view parameters
    • Receive event posted from REST endpoint
  • LoginView

    • Simple login example
    • Using UIScoped (VersionLabel) bean
    • Listen the timestamp from Beacon
  • EventBus

    • Super simple singleton event bus to broadcast messages
    • See DemoEndpoint and MainView
  • DemoUtils

    • Proper way of session fixation protection used in login process
  • DemoEndpoint

  • Beacon

    • Utility that broadcasts timestamp

About

Demonstrating how to use CDI, Push, executor service, model view presenter and inversion of control patterns with Vaadin 8

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%