Search in sources :

Example 1 with RegistrationValidationService

use of org.linkki.samples.messages.pmo.RegistrationValidationService in project linkki by linkki-framework.

the class MessageUI method init.

@Override
protected void init(VaadinRequest request) {
    Page.getCurrent().setTitle("linkki Samples :: Validation Messages");
    VaadinSession.getCurrent().setConverterFactory(new LinkkiConverterFactory());
    MessagesPanel messagesPanel = new MessagesPanel();
    messagesPanel.setVisible(false);
    User user = new User();
    RegistrationSectionPmo registrationPmo = new RegistrationSectionPmo(user, u -> handleRegistration(messagesPanel, u));
    // tag::validation-service[]
    validationService = new RegistrationValidationService(registrationPmo);
    bindingManager = new RegistrationBindingManager(validationService, ml -> messagesPanel.updateMessages(ml));
    // end::validation-service[]
    DefaultPmoBasedSectionFactory sectionFactory = new DefaultPmoBasedSectionFactory();
    AbstractSection section = sectionFactory.createSection(registrationPmo, bindingManager.getExistingContextOrStartNewOne(getClass()));
    setContent(new VerticalLayout(messagesPanel, section));
}
Also used : MessagesPanel(org.linkki.samples.messages.components.MessagesPanel) ValoTheme(com.vaadin.ui.themes.ValoTheme) RegistrationSectionPmo(org.linkki.samples.messages.pmo.RegistrationSectionPmo) AbstractSection(org.linkki.core.ui.section.AbstractSection) ValidationMode(org.linkki.samples.messages.pmo.RegistrationValidationService.ValidationMode) VerticalLayout(com.vaadin.ui.VerticalLayout) DefaultPmoBasedSectionFactory(org.linkki.core.ui.section.DefaultPmoBasedSectionFactory) UI(com.vaadin.ui.UI) VaadinRequest(com.vaadin.server.VaadinRequest) BindingManager(org.linkki.core.binding.BindingManager) Theme(com.vaadin.annotations.Theme) MessagesPanel(org.linkki.samples.messages.components.MessagesPanel) User(org.linkki.samples.messages.model.User) VaadinSession(com.vaadin.server.VaadinSession) Notification(com.vaadin.ui.Notification) LinkkiConverterFactory(org.linkki.core.ui.converters.LinkkiConverterFactory) Page(com.vaadin.server.Page) RegistrationValidationService(org.linkki.samples.messages.pmo.RegistrationValidationService) RegistrationBindingManager(org.linkki.samples.messages.binding.RegistrationBindingManager) User(org.linkki.samples.messages.model.User) DefaultPmoBasedSectionFactory(org.linkki.core.ui.section.DefaultPmoBasedSectionFactory) RegistrationSectionPmo(org.linkki.samples.messages.pmo.RegistrationSectionPmo) LinkkiConverterFactory(org.linkki.core.ui.converters.LinkkiConverterFactory) AbstractSection(org.linkki.core.ui.section.AbstractSection) VerticalLayout(com.vaadin.ui.VerticalLayout) RegistrationBindingManager(org.linkki.samples.messages.binding.RegistrationBindingManager) RegistrationValidationService(org.linkki.samples.messages.pmo.RegistrationValidationService)

Aggregations

Theme (com.vaadin.annotations.Theme)1 Page (com.vaadin.server.Page)1 VaadinRequest (com.vaadin.server.VaadinRequest)1 VaadinSession (com.vaadin.server.VaadinSession)1 Notification (com.vaadin.ui.Notification)1 UI (com.vaadin.ui.UI)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 ValoTheme (com.vaadin.ui.themes.ValoTheme)1 BindingManager (org.linkki.core.binding.BindingManager)1 LinkkiConverterFactory (org.linkki.core.ui.converters.LinkkiConverterFactory)1 AbstractSection (org.linkki.core.ui.section.AbstractSection)1 DefaultPmoBasedSectionFactory (org.linkki.core.ui.section.DefaultPmoBasedSectionFactory)1 RegistrationBindingManager (org.linkki.samples.messages.binding.RegistrationBindingManager)1 MessagesPanel (org.linkki.samples.messages.components.MessagesPanel)1 User (org.linkki.samples.messages.model.User)1 RegistrationSectionPmo (org.linkki.samples.messages.pmo.RegistrationSectionPmo)1 RegistrationValidationService (org.linkki.samples.messages.pmo.RegistrationValidationService)1 ValidationMode (org.linkki.samples.messages.pmo.RegistrationValidationService.ValidationMode)1