Search in sources :

Example 1 with Binder

use of org.linkki.core.binding.Binder in project linkki by linkki-framework.

the class ManuelBindIntegrationTest method testComboValueAndStaticAvailableValues.

@Test
public void testComboValueAndStaticAvailableValues() {
    section.createContent();
    new Binder(section, pmo).setupBindings(bindingContext);
    assertThat(section.comboBox.getValue(), is(TestEnum.THREE));
    assertThat(section.comboBox.getItemIds(), contains(TestEnum.ONE, TestEnum.TWO, TestEnum.THREE));
    pmo.combo = TestEnum.TWO;
    bindingContext.updateUI();
    assertThat(section.comboBox.getValue(), is(TestEnum.TWO));
}
Also used : Binder(org.linkki.core.binding.Binder) Test(org.junit.Test)

Example 2 with Binder

use of org.linkki.core.binding.Binder in project linkki by linkki-framework.

the class ManuelBindIntegrationTest method testReadOnly.

@Test
public void testReadOnly() {
    section.createContent();
    new Binder(section, pmo).setupBindings(bindingContext);
    assertThat(section.textField.isReadOnly(), is(false));
    assertThat(section.comboBox.isReadOnly(), is(true));
}
Also used : Binder(org.linkki.core.binding.Binder) Test(org.junit.Test)

Example 3 with Binder

use of org.linkki.core.binding.Binder in project linkki by linkki-framework.

the class ContactComponent method createContent.

private void createContent() {
    AbstractSection contactSection = sectionFactory.createSection(contactPmo, bindingContext);
    AddressFields addressFields = new AddressFields();
    AddressComponent addressComponent = new AddressComponent(addressFields);
    // tag::manual-binding[]
    new Binder(addressFields, addressPmo).setupBindings(bindingContext);
    // end::manual-binding[]
    AbstractSection childrenSection = sectionFactory.createSection(childrenSectionPmo, bindingContext);
    AbstractSection buttonsSection = sectionFactory.createSection(buttonsSectionPmo, bindingContext);
    setContent(new VerticalLayout(contactSection, addressComponent, childrenSection, buttonsSection));
}
Also used : Binder(org.linkki.core.binding.Binder) AbstractSection(org.linkki.core.ui.section.AbstractSection) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 4 with Binder

use of org.linkki.core.binding.Binder in project linkki by linkki-framework.

the class ManuelBindIntegrationTest method testGetDynamicToolTipFromManualyBindComponent.

@Test
public void testGetDynamicToolTipFromManualyBindComponent() {
    section.createContent();
    new Binder(section, pmo).setupBindings(bindingContext);
    assertThat(section.label.getDescription(), is(StringUtils.EMPTY));
    pmo.setText(ManuallyBoundSection.TOOL_TIP);
    bindingContext.updateUI();
    assertThat(section.label.getDescription(), is(ManuallyBoundSection.TOOL_TIP));
}
Also used : Binder(org.linkki.core.binding.Binder) Test(org.junit.Test)

Example 5 with Binder

use of org.linkki.core.binding.Binder in project linkki by linkki-framework.

the class ManuelBindIntegrationTest method testSetLabelFromManualBindComponen.

@Test
public void testSetLabelFromManualBindComponen() {
    section.createContent();
    new Binder(section, pmo).setupBindings(bindingContext);
    pmo.setText("12345");
    bindingContext.updateUI();
    assertThat(section.label.getValue(), is("12345"));
}
Also used : Binder(org.linkki.core.binding.Binder) Test(org.junit.Test)

Aggregations

Binder (org.linkki.core.binding.Binder)6 Test (org.junit.Test)5 VerticalLayout (com.vaadin.ui.VerticalLayout)1 AbstractSection (org.linkki.core.ui.section.AbstractSection)1