use of org.linkki.core.ui.creation.section.PmoBasedSectionFactory in project linkki by linkki-framework.
the class SelectableTableSection method create.
public static Component create() {
List<TableModelObject> modelObjects = IntStream.range(1, 10).mapToObj(TableModelObject::new).collect(Collectors.toList());
PlaygroundSelectableTablePmo selectableTableSectionPmo = new PlaygroundSelectableTablePmo(() -> modelObjects, () -> modelObjects.add(new TableModelObject(modelObjects.size() + 1)), o -> modelObjects.remove(o));
GridSection gridSection = (GridSection) new PmoBasedSectionFactory().createSection(selectableTableSectionPmo, new BindingContext("selectableTable"));
SingleSelect<?, ?> singleSelect = gridSection.getGrid().asSingleSelect();
BindingContext comparisonBindingContext = new BindingContext("selectableTableComparison");
Component comparisonSection = VaadinUiCreator.createComponent(new SelectionComparisonSectionPmo(() -> (PlaygroundRowPmo) singleSelect.getValue(), () -> selectableTableSectionPmo.getSelection(), comparisonBindingContext::modelChanged), comparisonBindingContext);
Div div = new Div();
div.setWidthFull();
div.add(gridSection);
div.add(comparisonSection);
return div;
}
use of org.linkki.core.ui.creation.section.PmoBasedSectionFactory in project linkki by linkki-framework.
the class PmoNlsServiceTableSectionTest method createAndGetTableSectionCaption.
private String createAndGetTableSectionCaption(ContainerPmo<NlsTableRowPmo> containerPmo) {
PmoBasedSectionFactory factory = new PmoBasedSectionFactory();
LinkkiSection tableSection = factory.createSection(containerPmo, bindingContext);
return tableSection.getCaption();
}
use of org.linkki.core.ui.creation.section.PmoBasedSectionFactory in project linkki by linkki-framework.
the class TestUiUtil method createSectionWith.
public static Div createSectionWith(Object pmo, BindingContext bindingContext) {
PmoBasedSectionFactory sectionFactory = new PmoBasedSectionFactory();
LinkkiSection section = sectionFactory.createSection(pmo, bindingContext);
bindingContext.modelChanged();
return section.getContentWrapper();
}
use of org.linkki.core.ui.creation.section.PmoBasedSectionFactory in project linkki by linkki-framework.
the class TableSelectionAspectIntegrationTest method testTableSectionSelectable.
@Test
public void testTableSectionSelectable() {
GridSection table = (GridSection) new PmoBasedSectionFactory().createSection(new TestSelectableTablePmo(), new BindingContext());
table.getGrid().setPageSize(1);
assertThat("Table in table section is selectable", table.getGrid().getSelectionModel(), is(instanceOf(GridSingleSelectionModel.class)));
}
use of org.linkki.core.ui.creation.section.PmoBasedSectionFactory in project linkki by linkki-framework.
the class PmoNlsServiceSectionTest method setUp.
@BeforeEach
public void setUp() {
BindingContext context = new BindingContext();
LinkkiSection section = new PmoBasedSectionFactory().createSection(new SamplePmo(), context);
sectionCaption = section.getCaption();
Div sectionContent = section.getContentWrapper();
textfieldLabelWithTranslation = TestUiUtil.getLabelOfComponentAt(sectionContent, 0);
textfieldLabelWithoutTranslation = TestUiUtil.getLabelOfComponentAt(sectionContent, 1);
buttonWithTranslatedCaption = (Button) TestUiUtil.getComponentAtIndex(2, sectionContent);
buttonWithoutTranslatedCaption = (Button) TestUiUtil.getComponentAtIndex(3, sectionContent);
// 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(getCaptionTranslation(SamplePmo.PROPERTY_MYBUTTON2), is(SamplePmo.PMO_CAPTION));
}
Aggregations