Search in sources :

Example 1 with BaseSection

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

Aggregations

GridLayout (com.vaadin.ui.GridLayout)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Before (org.junit.Before)1 BindingContext (org.linkki.core.binding.BindingContext)1 TestBindingContext (org.linkki.core.binding.TestBindingContext)1 SamplePmo (org.linkki.core.nls.pmo.sample.SamplePmo)1 BaseSection (org.linkki.core.ui.section.BaseSection)1 DefaultPmoBasedSectionFactory (org.linkki.core.ui.section.DefaultPmoBasedSectionFactory)1