Search in sources :

Example 6 with LabelComponentWrapper

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

the class ComponentBindingTest method testUpdateFromPmo_updateAspect.

@Test
public void testUpdateFromPmo_updateAspect() {
    Handler componentUpdater = mock(Handler.class);
    LinkkiAspectDefinition aspectDefinition = mock(LinkkiAspectDefinition.class);
    when(aspectDefinition.createUiUpdater(any(), any())).thenReturn(componentUpdater);
    ComponentBinding fieldBinding = new ComponentBinding(new LabelComponentWrapper(label, field), propertyDispatcherValue, Handler.NOP_HANDLER, Arrays.asList(aspectDefinition));
    fieldBinding.updateFromPmo();
    verify(componentUpdater).apply();
}
Also used : Handler(org.linkki.util.handler.Handler) LinkkiAspectDefinition(org.linkki.core.binding.aspect.definition.LinkkiAspectDefinition) LabelComponentWrapper(org.linkki.core.ui.components.LabelComponentWrapper) Test(org.junit.Test)

Example 7 with LabelComponentWrapper

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

the class ComponentBindingTest method setUp.

@Before
public void setUp() {
    propertyDispatcherValue = mock(PropertyDispatcher.class);
    when(propertyDispatcherValue.getProperty()).thenReturn("value");
    propertyDispatcherEnumValue = mock(PropertyDispatcher.class);
    when(propertyDispatcherEnumValue.getProperty()).thenReturn("enumValue");
    doReturn(TestEnum.class).when(propertyDispatcherEnumValue).getValueClass();
    messageList = new MessageList();
    when(propertyDispatcherValue.getMessages(any(MessageList.class))).thenReturn(messageList);
    when(propertyDispatcherEnumValue.getMessages(any(MessageList.class))).thenReturn(messageList);
    selectBinding = new ComponentBinding(new LabelComponentWrapper(label, selectField), propertyDispatcherEnumValue, Handler.NOP_HANDLER, new ArrayList<>());
}
Also used : ArrayList(java.util.ArrayList) PropertyDispatcher(org.linkki.core.binding.dispatcher.PropertyDispatcher) MessageList(org.linkki.core.message.MessageList) LabelComponentWrapper(org.linkki.core.ui.components.LabelComponentWrapper) Before(org.junit.Before)

Example 8 with LabelComponentWrapper

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

the class SectionCreationContext method createLabelAndComponent.

private ComponentWrapper createLabelAndComponent(BaseSection section, ElementDescriptor uiElement) {
    Component component = uiElement.newComponent();
    String labelText = uiElement.getLabelText();
    String pmoPropertyName = uiElement.getPmoPropertyName();
    Label label = new Label(labelText);
    section.add(pmoPropertyName, label, component);
    return new LabelComponentWrapper(label, component);
}
Also used : Label(com.vaadin.ui.Label) Component(com.vaadin.ui.Component) LabelComponentWrapper(org.linkki.core.ui.components.LabelComponentWrapper)

Aggregations

LabelComponentWrapper (org.linkki.core.ui.components.LabelComponentWrapper)8 Test (org.junit.Test)6 PropertyDispatcher (org.linkki.core.binding.dispatcher.PropertyDispatcher)5 Label (com.vaadin.ui.Label)3 ElementBinding (org.linkki.core.binding.ElementBinding)3 Bind (org.linkki.core.binding.annotations.Bind)3 BindAnnotationDescriptor (org.linkki.core.ui.section.descriptor.BindAnnotationDescriptor)3 Button (com.vaadin.ui.Button)2 TextField (com.vaadin.ui.TextField)2 ArrayList (java.util.ArrayList)2 MessageList (org.linkki.core.message.MessageList)2 Component (com.vaadin.ui.Component)1 Before (org.junit.Before)1 BindingContext (org.linkki.core.binding.BindingContext)1 ComponentBinding (org.linkki.core.binding.ComponentBinding)1 LinkkiAspectDefinition (org.linkki.core.binding.aspect.definition.LinkkiAspectDefinition)1 BindingDefinition (org.linkki.core.ui.section.annotations.BindingDefinition)1 UITextField (org.linkki.core.ui.section.annotations.UITextField)1 ElementDescriptor (org.linkki.core.ui.section.descriptor.ElementDescriptor)1 Handler (org.linkki.util.handler.Handler)1