Search in sources :

Example 1 with SubsetChooser

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

the class UISubsetChooserIntegrationTest method testValue.

@Test
public void testValue() {
    SubsetChooser subsetChooser = getDynamicComponent();
    getDefaultModelObject().setValue(new LinkedHashSet<>(Arrays.asList(TestEnum.ONE, TestEnum.THREE)));
    updateUi();
    assertThat((Collection<?>) subsetChooser.getValue(), contains(TestEnum.ONE, TestEnum.THREE));
    subsetChooser.setValue(new LinkedHashSet<>(Arrays.asList(TestEnum.TWO)));
    assertThat(getDefaultModelObject().getValue(), contains(TestEnum.TWO));
}
Also used : SubsetChooser(org.linkki.core.ui.components.SubsetChooser) Test(org.junit.Test)

Example 2 with SubsetChooser

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

the class UISubsetChooserTest method testAddObjectToRightLineAndRemoveItAgain.

@Test
public void testAddObjectToRightLineAndRemoveItAgain() {
    SubsetChooser subsetChooser = createSubsetChooser(new TestPmo());
    Map<String, Object> variables = new HashMap<>();
    variables.put("selected", new String[] { "1" });
    subsetChooser.changeVariables(null, variables);
    @SuppressWarnings("unchecked") Set<TestEnum> selectedValuesResult = (Set<TestEnum>) subsetChooser.getValue();
    assertThat(selectedValuesResult, containsInAnyOrder(TestEnum.ONE));
    variables.put("selected", new String[] {});
    subsetChooser.changeVariables(null, variables);
    @SuppressWarnings("unchecked") Set<TestEnum> selectedValuesResultEmpty = (Set<TestEnum>) subsetChooser.getValue();
    assertThat(selectedValuesResultEmpty, empty());
}
Also used : Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) HashMap(java.util.HashMap) TestEnum(org.linkki.core.binding.TestEnum) SubsetChooser(org.linkki.core.ui.components.SubsetChooser) Test(org.junit.Test)

Example 3 with SubsetChooser

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

the class UISubsetChooserTest method testCustomWidth.

@Test
public void testCustomWidth() {
    SubsetChooser subsetChooser = createSubsetChooser(new TestPmoWithCustomWidth());
    assertThat(subsetChooser.getWidth(), is(50.0F));
}
Also used : SubsetChooser(org.linkki.core.ui.components.SubsetChooser) Test(org.junit.Test)

Example 4 with SubsetChooser

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

the class UISubsetChooserTest method testLeftCaptionAnnotation.

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

Example 5 with SubsetChooser

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

the class UISubsetChooserTest method testDefaultWidthOneHundredPercent.

@Test
public void testDefaultWidthOneHundredPercent() {
    SubsetChooser subsetChooser = createSubsetChooser(new TestPmo());
    assertThat(subsetChooser.getWidth(), is(100.0F));
}
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