Search in sources :

Example 6 with ReflectionPropertyDispatcher

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));
}
Also used : ReflectionPropertyDispatcher(org.linkki.core.binding.dispatcher.ReflectionPropertyDispatcher) ReflectionPropertyDispatcher(org.linkki.core.binding.dispatcher.ReflectionPropertyDispatcher) PropertyDispatcher(org.linkki.core.binding.dispatcher.PropertyDispatcher) Test(org.junit.Test)

Aggregations

ReflectionPropertyDispatcher (org.linkki.core.binding.dispatcher.ReflectionPropertyDispatcher)6 PropertyDispatcher (org.linkki.core.binding.dispatcher.PropertyDispatcher)4 Test (org.junit.Test)3 ButtonPmo (org.linkki.core.ButtonPmo)2 BehaviorDependentDispatcher (org.linkki.core.binding.dispatcher.BehaviorDependentDispatcher)2 ExceptionPropertyDispatcher (org.linkki.core.binding.dispatcher.ExceptionPropertyDispatcher)2 StaticValueDispatcher (org.linkki.core.binding.dispatcher.StaticValueDispatcher)1