Search in sources :

Example 1 with ElementBinding

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

the class BindAnnotationDescriptorTest method testCreateBinding_CreatesFieldBindingForField.

@Test
public void testCreateBinding_CreatesFieldBindingForField() {
    BindAnnotationDescriptor descriptor = new BindAnnotationDescriptor(mock(Bind.class), new ArrayList<>());
    PropertyDispatcher dispatcher = mock(PropertyDispatcher.class);
    ElementBinding binding = descriptor.createBinding(dispatcher, Handler.NOP_HANDLER, new LabelComponentWrapper(new TextField()));
    assertThat(binding, is(instanceOf(ComponentBinding.class)));
}
Also used : Bind(org.linkki.core.binding.annotations.Bind) BindAnnotationDescriptor(org.linkki.core.ui.section.descriptor.BindAnnotationDescriptor) TextField(com.vaadin.ui.TextField) PropertyDispatcher(org.linkki.core.binding.dispatcher.PropertyDispatcher) ElementBinding(org.linkki.core.binding.ElementBinding) LabelComponentWrapper(org.linkki.core.ui.components.LabelComponentWrapper) Test(org.junit.Test)

Example 2 with ElementBinding

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

the class BindAnnotationDescriptorTest method testCreateBinding_CreatesLabelBindingForLabel.

@Test
public void testCreateBinding_CreatesLabelBindingForLabel() {
    BindAnnotationDescriptor descriptor = new BindAnnotationDescriptor(mock(Bind.class), new ArrayList<>());
    PropertyDispatcher dispatcher = mock(PropertyDispatcher.class);
    ElementBinding binding = descriptor.createBinding(dispatcher, Handler.NOP_HANDLER, new LabelComponentWrapper(new Label()));
    assertThat(binding, is(instanceOf(ElementBinding.class)));
}
Also used : Bind(org.linkki.core.binding.annotations.Bind) BindAnnotationDescriptor(org.linkki.core.ui.section.descriptor.BindAnnotationDescriptor) Label(com.vaadin.ui.Label) PropertyDispatcher(org.linkki.core.binding.dispatcher.PropertyDispatcher) ElementBinding(org.linkki.core.binding.ElementBinding) LabelComponentWrapper(org.linkki.core.ui.components.LabelComponentWrapper) Test(org.junit.Test)

Example 3 with ElementBinding

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

the class BindAnnotationDescriptorTest method testCreateBinding_CreatesButtonBindingForButton.

@Test
public void testCreateBinding_CreatesButtonBindingForButton() {
    BindAnnotationDescriptor descriptor = new BindAnnotationDescriptor(mock(Bind.class), new ArrayList<>());
    PropertyDispatcher dispatcher = mock(PropertyDispatcher.class);
    ElementBinding binding = descriptor.createBinding(dispatcher, Handler.NOP_HANDLER, new LabelComponentWrapper(new Button()));
    assertThat(binding, is(instanceOf(ElementBinding.class)));
}
Also used : Bind(org.linkki.core.binding.annotations.Bind) Button(com.vaadin.ui.Button) BindAnnotationDescriptor(org.linkki.core.ui.section.descriptor.BindAnnotationDescriptor) PropertyDispatcher(org.linkki.core.binding.dispatcher.PropertyDispatcher) ElementBinding(org.linkki.core.binding.ElementBinding) LabelComponentWrapper(org.linkki.core.ui.components.LabelComponentWrapper) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 ElementBinding (org.linkki.core.binding.ElementBinding)3 Bind (org.linkki.core.binding.annotations.Bind)3 PropertyDispatcher (org.linkki.core.binding.dispatcher.PropertyDispatcher)3 LabelComponentWrapper (org.linkki.core.ui.components.LabelComponentWrapper)3 BindAnnotationDescriptor (org.linkki.core.ui.section.descriptor.BindAnnotationDescriptor)3 Button (com.vaadin.ui.Button)1 Label (com.vaadin.ui.Label)1 TextField (com.vaadin.ui.TextField)1