use of org.linkki.core.binding.dispatcher.ReflectionPropertyDispatcher in project linkki by linkki-framework.
the class ButtonPmoBindingTest method testUpdateFromPmo_PmoSublass.
@Test
public void testUpdateFromPmo_PmoSublass() {
TestButtonPmo pmo = new TestButtonPmo();
PropertyDispatcher propertyDispatcher = new org.linkki.core.binding.dispatcher.ButtonPmoDispatcher(new ReflectionPropertyDispatcher(() -> pmo, StringUtils.EMPTY, wrappedDispatcher));
ButtonPmoBinding binding = new ButtonPmoBinding(button, propertyDispatcher, bindingContext::updateUI);
bindingContext.add(binding);
pmo.enabled = true;
pmo.visible = true;
binding.updateFromPmo();
assertThat(button.isVisible(), is(true));
assertThat(button.isEnabled(), is(true));
pmo.enabled = false;
pmo.visible = false;
binding.updateFromPmo();
assertThat(button.isVisible(), is(false));
assertThat(button.isEnabled(), is(false));
}
Aggregations