Search in sources :

Example 11 with SubsetChooser

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

the class UISubsetChooserIntegrationTest method testNullInputIfRequired.

@Test
@Override
public void testNullInputIfRequired() {
    SubsetChooser subsetChooser = getDynamicComponent();
    getDefaultPmo().setRequired(true);
    updateUi();
    assertThat(subsetChooser.isRequired(), is(true));
    subsetChooser.setValue(new LinkedHashSet<>(Arrays.asList(TestEnum.ONE)));
    assertThat(getDefaultModelObject().getValue(), contains(TestEnum.ONE));
    subsetChooser.setValue(null);
    assertThat(getDefaultModelObject().getValue(), is(empty()));
}
Also used : SubsetChooser(org.linkki.core.ui.components.SubsetChooser) Test(org.junit.Test)

Example 12 with SubsetChooser

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

the class SubsetChooserBindingDefinition method newComponent.

@Override
public SubsetChooser newComponent() {
    SubsetChooser subsetChooser = ComponentFactory.newSubsetChooser();
    subsetChooser.setItemCaptionProvider(getItemCaptionProvider());
    subsetChooser.setNullSelectionAllowed(true);
    subsetChooser.setWidth(uiSubsetChooser.width());
    subsetChooser.setLeftColumnCaption(uiSubsetChooser.leftColumnCaption());
    subsetChooser.setRightColumnCaption(uiSubsetChooser.rightColumnCaption());
    return subsetChooser;
}
Also used : SubsetChooser(org.linkki.core.ui.components.SubsetChooser) UISubsetChooser(org.linkki.core.ui.section.annotations.UISubsetChooser)

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