use of org.linkki.core.binding.BindingManager 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));
}
use of org.linkki.core.binding.BindingManager in project linkki by linkki-framework.
the class BindingSampleUI method init.
@Override
protected void init(VaadinRequest request) {
Page.getCurrent().setTitle("linkki Sample :: Bindings");
List<Contact> personStorage = new ArrayList<>();
BindingManager bindingManager = new DefaultBindingManager(ValidationService.NOP_VALIDATION_SERVICE);
BindingContext context = bindingManager.startNewContext("binding-sample");
ContactComponent contactComponent = new ContactComponent(p -> save(p, personStorage), context);
ContactsTableComponent contactsTable = new ContactsTableComponent(personStorage, contactComponent::editContact, context);
bindingManager.addUiUpdateObserver(contactsTable);
HorizontalSplitPanel panel = new HorizontalSplitPanel(contactComponent, contactsTable);
panel.setLocked(true);
setContent(panel);
}
Aggregations