Search in sources :

Example 6 with SubsetChooser

use of org.linkki.core.ui.components.SubsetChooser in project linkki by linkki-framework.

the class UISubsetChooserTest method testRightCaptionAnnotation.

@Test
public void testRightCaptionAnnotation() {
    SubsetChooser subsetChooser = createSubsetChooser(new TestPmo());
    assertThat(subsetChooser.getRightColumnCaption(), is("Right Column Caption"));
}
Also used : SubsetChooser(org.linkki.core.ui.components.SubsetChooser) Test(org.junit.Test)

Example 7 with SubsetChooser

use of org.linkki.core.ui.components.SubsetChooser in project linkki by linkki-framework.

the class UISubsetChooserTest method createSubsetChooser.

/**
 * Returns a {@code SubsetChooser} that is bound to a {@link AnnotationTestPmo} using the
 * IPM data binder. The {@code SubsetChooser} is part of a mostly mocked UI so that a
 * rudimentary Vaadin environment is in place.
 *
 * @return a {@code SubsetChooser} that is bound to a {@link AnnotationTestPmo}
 */
private SubsetChooser createSubsetChooser(Object pmo) {
    try {
        SubsetChooser subsetChooser = (SubsetChooser) TestUiUtil.createFirstComponentOf(pmo);
        // initializes the internal itemIdMapper which is needed to
        // fake selection from UI using AbstractSelect#changeVariables(...)
        subsetChooser.paintContent(mock(PaintTarget.class));
        return subsetChooser;
    } catch (PaintException e) {
        throw new RuntimeException(e);
    }
}
Also used : PaintTarget(com.vaadin.server.PaintTarget) SubsetChooser(org.linkki.core.ui.components.SubsetChooser) PaintException(com.vaadin.server.PaintException)

Example 8 with SubsetChooser

use of org.linkki.core.ui.components.SubsetChooser in project linkki by linkki-framework.

the class UISubsetChooserTest method testDefaultItemCaptionProvider.

@Test
public void testDefaultItemCaptionProvider() {
    SubsetChooser subsetChooser = createSubsetChooser(new TestPmo());
    assertThat(subsetChooser.getItemCaption(null), is(""));
    assertThat(subsetChooser.getItemCaption(TestEnum.ONE), is("ONE"));
}
Also used : SubsetChooser(org.linkki.core.ui.components.SubsetChooser) Test(org.junit.Test)

Example 9 with SubsetChooser

use of org.linkki.core.ui.components.SubsetChooser in project linkki by linkki-framework.

the class UISubsetChooserTest method testNullSelectionIsAllowed.

@Test
public void testNullSelectionIsAllowed() {
    SubsetChooser subsetChooser = createSubsetChooser(new TestPmo());
    assertThat(subsetChooser.isNullSelectionAllowed(), is(true));
}
Also used : SubsetChooser(org.linkki.core.ui.components.SubsetChooser) Test(org.junit.Test)

Example 10 with SubsetChooser

use of org.linkki.core.ui.components.SubsetChooser in project linkki by linkki-framework.

the class UISubsetChooserIntegrationTest method testLeftRightCaptions.

@Test
public void testLeftRightCaptions() {
    SubsetChooser subsetChooser = getDynamicComponent();
    assertThat(subsetChooser.getLeftColumnCaption(), is("leftC"));
    assertThat(subsetChooser.getRightColumnCaption(), is("rightC"));
}
Also used : SubsetChooser(org.linkki.core.ui.components.SubsetChooser) Test(org.junit.Test)

Aggregations

SubsetChooser (org.linkki.core.ui.components.SubsetChooser)12 Test (org.junit.Test)10 PaintException (com.vaadin.server.PaintException)1 PaintTarget (com.vaadin.server.PaintTarget)1 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 TestEnum (org.linkki.core.binding.TestEnum)1 UISubsetChooser (org.linkki.core.ui.section.annotations.UISubsetChooser)1