Search in sources :

Example 1 with AbstractSection

use of org.linkki.core.ui.section.AbstractSection in project linkki by linkki-framework.

the class TestUiUtil method createSectionWith.

public static GridLayout createSectionWith(Object pmo, BindingContext bindingContext) {
    PmoBasedSectionFactory sectionFactory = new DefaultPmoBasedSectionFactory();
    AbstractSection section = sectionFactory.createSection(pmo, bindingContext);
    bindingContext.updateUI();
    Panel panel = (Panel) section.getComponent(1);
    return (GridLayout) panel.getContent();
}
Also used : Panel(com.vaadin.ui.Panel) GridLayout(com.vaadin.ui.GridLayout) DefaultPmoBasedSectionFactory(org.linkki.core.ui.section.DefaultPmoBasedSectionFactory) AbstractSection(org.linkki.core.ui.section.AbstractSection) DefaultPmoBasedSectionFactory(org.linkki.core.ui.section.DefaultPmoBasedSectionFactory) PmoBasedSectionFactory(org.linkki.core.ui.section.PmoBasedSectionFactory)

Example 2 with AbstractSection

use of org.linkki.core.ui.section.AbstractSection in project linkki by linkki-framework.

the class ContactComponent method createContent.

private void createContent() {
    AbstractSection contactSection = sectionFactory.createSection(contactPmo, bindingContext);
    AddressFields addressFields = new AddressFields();
    AddressComponent addressComponent = new AddressComponent(addressFields);
    // tag::manual-binding[]
    new Binder(addressFields, addressPmo).setupBindings(bindingContext);
    // end::manual-binding[]
    AbstractSection childrenSection = sectionFactory.createSection(childrenSectionPmo, bindingContext);
    AbstractSection buttonsSection = sectionFactory.createSection(buttonsSectionPmo, bindingContext);
    setContent(new VerticalLayout(contactSection, addressComponent, childrenSection, buttonsSection));
}
Also used : Binder(org.linkki.core.binding.Binder) AbstractSection(org.linkki.core.ui.section.AbstractSection) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 3 with AbstractSection

use of org.linkki.core.ui.section.AbstractSection in project linkki by linkki-framework.

the class CustomLayoutUI method init.

@Override
protected void init(VaadinRequest request) {
    Page.getCurrent().setTitle("Linkki :: Custom Layout Sample");
    BindingContext bindingContext = new BindingContext();
    AbstractSection section = new DefaultPmoBasedSectionFactory().createSection(new AddressSectionPmo(), bindingContext);
    setContent(section);
}
Also used : AddressSectionPmo(org.linkki.samples.customlayout.pmo.AddressSectionPmo) DefaultPmoBasedSectionFactory(org.linkki.core.ui.section.DefaultPmoBasedSectionFactory) AbstractSection(org.linkki.core.ui.section.AbstractSection) BindingContext(org.linkki.core.binding.BindingContext)

Example 4 with AbstractSection

use of org.linkki.core.ui.section.AbstractSection in project linkki by linkki-framework.

the class PmoBasedDialogFactory method newOkCancelDialog.

/**
 * Creates a new {@link OkCancelDialog}.
 *
 * @param title The dialog title.
 * @param okHandler The called when OK is clicked.
 * @param pmos The presentation model objects providing the data and the layout information.
 * @return A dialog with the content defined by the given PMO.
 */
public OkCancelDialog newOkCancelDialog(String title, Handler okHandler, Object... pmos) {
    OkCancelDialog dialog = new OkCancelDialog(title, okHandler, ButtonOption.OK_CANCEL);
    DialogBindingManager bindingManager = new DialogBindingManager(dialog, validationService, propertyBehaviorProvider);
    BindingContext bindingContext = bindingManager.startNewContext(dialog.getClass());
    for (Object pmo : pmos) {
        AbstractSection content;
        if (pmo instanceof ContainerPmo) {
            content = pmoBasedSectionFactory.createTableSection((ContainerPmo<?>) pmo, bindingContext);
        } else {
            content = pmoBasedSectionFactory.createSection(pmo, bindingContext);
        }
        float expRatio = 0f;
        if (pmo == pmos[pmos.length - 1]) {
            expRatio = 1f;
        }
        dialog.addContent(content, expRatio);
    }
    bindingContext.updateUI();
    return dialog;
}
Also used : ContainerPmo(org.linkki.core.ui.table.ContainerPmo) AbstractSection(org.linkki.core.ui.section.AbstractSection) PresentationModelObject(org.linkki.core.PresentationModelObject) BindingContext(org.linkki.core.binding.BindingContext)

Example 5 with AbstractSection

use of org.linkki.core.ui.section.AbstractSection in project linkki by linkki-framework.

the class AbstractPage method addSection.

/**
 * Creates a section based on the given PMO and adds it to the page taking 100% of the page
 * width. If the PMO is a {@link ContainerPmo} a table section is created.
 *
 * @return The new section created based on the given PMO.
 */
protected AbstractSection addSection(Object pmo) {
    AbstractSection section = sectionFactory.createSection(pmo, getBindingContext());
    add(section);
    return section;
}
Also used : AbstractSection(org.linkki.core.ui.section.AbstractSection)

Aggregations

AbstractSection (org.linkki.core.ui.section.AbstractSection)7 DefaultPmoBasedSectionFactory (org.linkki.core.ui.section.DefaultPmoBasedSectionFactory)4 BindingContext (org.linkki.core.binding.BindingContext)3 VerticalLayout (com.vaadin.ui.VerticalLayout)2 Theme (com.vaadin.annotations.Theme)1 Page (com.vaadin.server.Page)1 VaadinRequest (com.vaadin.server.VaadinRequest)1 VaadinSession (com.vaadin.server.VaadinSession)1 GridLayout (com.vaadin.ui.GridLayout)1 Notification (com.vaadin.ui.Notification)1 Panel (com.vaadin.ui.Panel)1 UI (com.vaadin.ui.UI)1 ValoTheme (com.vaadin.ui.themes.ValoTheme)1 PresentationModelObject (org.linkki.core.PresentationModelObject)1 Binder (org.linkki.core.binding.Binder)1 BindingManager (org.linkki.core.binding.BindingManager)1 LinkkiConverterFactory (org.linkki.core.ui.converters.LinkkiConverterFactory)1 PmoBasedSectionFactory (org.linkki.core.ui.section.PmoBasedSectionFactory)1 ContainerPmo (org.linkki.core.ui.table.ContainerPmo)1 AddressSectionPmo (org.linkki.samples.customlayout.pmo.AddressSectionPmo)1