Search in sources :

Example 6 with LinkkiComboBox

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

the class UIYesNoComboBoxIntegrationTest method testCaptionProvider.

@Test
public void testCaptionProvider() {
    LinkkiComboBox comboBox = getDynamicComponent();
    assertThat((ToStringCaptionProvider) comboBox.getItemCaptionProvider(), isA(ToStringCaptionProvider.class));
}
Also used : LinkkiComboBox(org.linkki.core.ui.components.LinkkiComboBox) ToStringCaptionProvider(org.linkki.core.ui.components.ItemCaptionProvider.ToStringCaptionProvider) Test(org.junit.Test)

Example 7 with LinkkiComboBox

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

the class UIComboBoxIntegrationTest method testNullInputIfRequired.

@Test
@Override
public void testNullInputIfRequired() {
    LinkkiComboBox comboBox = getDynamicComponent();
    getDefaultPmo().setRequired(true);
    updateUi();
    assertThat(comboBox.isRequired(), is(true));
    comboBox.setValue(TestEnum.ONE);
    assertThat(getDefaultModelObject().getValue(), is(TestEnum.ONE));
    comboBox.setValue(null);
    assertThat(getDefaultModelObject().getValue(), is(nullValue()));
}
Also used : LinkkiComboBox(org.linkki.core.ui.components.LinkkiComboBox) Test(org.junit.Test)

Example 8 with LinkkiComboBox

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

the class UIComboBoxIntegrationTest method testValue.

@Test
public void testValue() {
    LinkkiComboBox comboBox = getDynamicComponent();
    assertThat(comboBox.getValue(), is(TestEnum.THREE));
    getDefaultModelObject().setValue(TestEnum.TWO);
    updateUi();
    assertThat(comboBox.getValue(), is(TestEnum.TWO));
    comboBox.setValue(TestEnum.ONE);
    assertThat(getDefaultModelObject().getValue(), is(TestEnum.ONE));
}
Also used : LinkkiComboBox(org.linkki.core.ui.components.LinkkiComboBox) Test(org.junit.Test)

Example 9 with LinkkiComboBox

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

the class UICustomFieldIntegrationTest method testNullInputIfRequired.

@Test
@Override
public void testNullInputIfRequired() {
    LinkkiComboBox component = getDynamicComponent();
    getDefaultPmo().setRequired(true);
    updateUi();
    assertThat(component.isRequired(), is(true));
    component.setValue(TestEnum.ONE);
    assertThat(getDefaultModelObject().getValue(), is(TestEnum.ONE));
    component.setValue(null);
    assertThat(getDefaultModelObject().getValue(), is(nullValue()));
}
Also used : LinkkiComboBox(org.linkki.core.ui.components.LinkkiComboBox) Test(org.junit.Test)

Example 10 with LinkkiComboBox

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

the class YesNoComboBoxBindingDefinition method newComponent.

@Override
public Component newComponent() {
    LinkkiComboBox comboBox = ComponentFactory.newComboBox();
    comboBox.setItemCaptionProvider(getItemCaptionProvider());
    comboBox.setNullSelectionAllowed(false);
    comboBox.setWidth(uiYesNoComboBox.width());
    return comboBox;
}
Also used : LinkkiComboBox(org.linkki.core.ui.components.LinkkiComboBox)

Aggregations

LinkkiComboBox (org.linkki.core.ui.components.LinkkiComboBox)10 Test (org.junit.Test)7 ToStringCaptionProvider (org.linkki.core.ui.components.ItemCaptionProvider.ToStringCaptionProvider)2