Search in sources :

Example 1 with Contact

use of org.linkki.samples.binding.model.Contact in project linkki by linkki-framework.

the class ContactComponent method save.

private void save() {
    Address address = addressPmo.getAddress();
    Contact contact = contactPmo.getContact();
    contact.setAddress(address);
    persistAction.accept(contact);
    reset();
}
Also used : Address(org.linkki.samples.binding.model.Address) Contact(org.linkki.samples.binding.model.Contact)

Example 2 with Contact

use of org.linkki.samples.binding.model.Contact 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);
}
Also used : DefaultBindingManager(org.linkki.core.binding.DefaultBindingManager) BindingManager(org.linkki.core.binding.BindingManager) ContactsTableComponent(org.linkki.samples.binding.components.ContactsTableComponent) HorizontalSplitPanel(com.vaadin.ui.HorizontalSplitPanel) ArrayList(java.util.ArrayList) ContactComponent(org.linkki.samples.binding.components.ContactComponent) BindingContext(org.linkki.core.binding.BindingContext) DefaultBindingManager(org.linkki.core.binding.DefaultBindingManager) Contact(org.linkki.samples.binding.model.Contact)

Aggregations

Contact (org.linkki.samples.binding.model.Contact)2 HorizontalSplitPanel (com.vaadin.ui.HorizontalSplitPanel)1 ArrayList (java.util.ArrayList)1 BindingContext (org.linkki.core.binding.BindingContext)1 BindingManager (org.linkki.core.binding.BindingManager)1 DefaultBindingManager (org.linkki.core.binding.DefaultBindingManager)1 ContactComponent (org.linkki.samples.binding.components.ContactComponent)1 ContactsTableComponent (org.linkki.samples.binding.components.ContactsTableComponent)1 Address (org.linkki.samples.binding.model.Address)1