Search in sources :

Example 1 with DefaultPmoBasedSectionFactory

use of org.linkki.core.ui.section.DefaultPmoBasedSectionFactory 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 DefaultPmoBasedSectionFactory

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

the class PmoNlsServiceSectionTest method setUp.

@Before
public void setUp() {
    BindingContext context = TestBindingContext.create();
    BaseSection section = new DefaultPmoBasedSectionFactory().createBaseSection(new SamplePmo(), context);
    HorizontalLayout header = (HorizontalLayout) section.getComponent(0);
    sectionHeader = (Label) header.getComponent(0);
    GridLayout sectionContent = (GridLayout) ((Panel) section.getComponent(1)).getContent();
    textfieldLabelWithTranslation = (Label) sectionContent.getComponent(0, 0);
    textfieldLabelWithoutTranslation = (Label) sectionContent.getComponent(0, 1);
    buttonLabelWithTranslation = (Label) sectionContent.getComponent(0, 2);
    buttonWithTranslatedCaption = (Button) sectionContent.getComponent(1, 2);
    invisibleButtonLabelWithTranslation = (Label) sectionContent.getComponent(0, 3);
    buttonWithoutTranslatedCaption = (Button) sectionContent.getComponent(1, 3);
    // test setup
    PmoNlsService.get();
    textfieldLabelTranslation = getLabelTranslation(SamplePmo.PROPERTY_TEXTFIELD);
    assertThat(textfieldLabelTranslation, is(not(SamplePmo.PMO_LABEL)));
    buttonLabelTranslation = getLabelTranslation(SamplePmo.PROPERTY_MYBUTTON);
    assertThat(buttonLabelTranslation, is(not(SamplePmo.PMO_LABEL)));
    buttonCaptionTranslation = getCaptionTranslation(SamplePmo.PROPERTY_MYBUTTON);
    assertThat(buttonCaptionTranslation, is(not(SamplePmo.PMO_CAPTION)));
    assertThat(getLabelTranslation(SamplePmo.PROPERTY_CBFIELD), is(SamplePmo.PMO_LABEL));
    assertThat(getLabelTranslation(SamplePmo.PROPERTY_MYBUTTON2), is(buttonLabelTranslation));
    assertThat(getCaptionTranslation(SamplePmo.PROPERTY_MYBUTTON2), is(SamplePmo.PMO_CAPTION));
}
Also used : SamplePmo(org.linkki.core.nls.pmo.sample.SamplePmo) BaseSection(org.linkki.core.ui.section.BaseSection) GridLayout(com.vaadin.ui.GridLayout) DefaultPmoBasedSectionFactory(org.linkki.core.ui.section.DefaultPmoBasedSectionFactory) BindingContext(org.linkki.core.binding.BindingContext) TestBindingContext(org.linkki.core.binding.TestBindingContext) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Before(org.junit.Before)

Example 3 with DefaultPmoBasedSectionFactory

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

the class ContactsTableComponent method createContent.

private void createContent(Consumer<Contact> editAction) {
    DefaultPmoBasedSectionFactory sectionFactory = new DefaultPmoBasedSectionFactory();
    tableSection = sectionFactory.createTableSection(new ContactTablePmo(contactStorage, editAction, contactStorage::remove), context);
    noContentLabel = new Label("No contacts available");
}
Also used : DefaultPmoBasedSectionFactory(org.linkki.core.ui.section.DefaultPmoBasedSectionFactory) Label(com.vaadin.ui.Label) ContactTablePmo(org.linkki.samples.binding.pmo.ContactTablePmo)

Example 4 with DefaultPmoBasedSectionFactory

use of org.linkki.core.ui.section.DefaultPmoBasedSectionFactory 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 5 with DefaultPmoBasedSectionFactory

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

the class DynamicFieldUI method init.

@Override
protected void init(VaadinRequest request) {
    Page.getCurrent().setTitle("Linkki :: Dynamic Fields Sample");
    List<Car> carStorage = getCarStorage();
    BindingContext bindingContext = new BindingContext();
    TableSection<CarRowPmo> table = new DefaultPmoBasedSectionFactory().createTableSection(new CarTablePmo(carStorage, () -> new NewCarDialog(carStorage, bindingContext::updateUI)), bindingContext);
    setContent(table);
}
Also used : NewCarDialog(org.linkki.samples.dynamicfield.components.NewCarDialog) DefaultPmoBasedSectionFactory(org.linkki.core.ui.section.DefaultPmoBasedSectionFactory) Car(org.linkki.samples.dynamicfield.model.Car) CarTablePmo(org.linkki.samples.dynamicfield.pmo.CarTablePmo) BindingContext(org.linkki.core.binding.BindingContext) CarRowPmo(org.linkki.samples.dynamicfield.pmo.CarRowPmo)

Aggregations

DefaultPmoBasedSectionFactory (org.linkki.core.ui.section.DefaultPmoBasedSectionFactory)7 BindingContext (org.linkki.core.binding.BindingContext)4 AbstractSection (org.linkki.core.ui.section.AbstractSection)4 GridLayout (com.vaadin.ui.GridLayout)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 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Label (com.vaadin.ui.Label)1 Notification (com.vaadin.ui.Notification)1 Panel (com.vaadin.ui.Panel)1 UI (com.vaadin.ui.UI)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 ValoTheme (com.vaadin.ui.themes.ValoTheme)1 Before (org.junit.Before)1 BindingManager (org.linkki.core.binding.BindingManager)1 TestBindingContext (org.linkki.core.binding.TestBindingContext)1 SamplePmo (org.linkki.core.nls.pmo.sample.SamplePmo)1 LinkkiConverterFactory (org.linkki.core.ui.converters.LinkkiConverterFactory)1