Search in sources :

Example 16 with MessageList

use of org.linkki.core.message.MessageList in project linkki by linkki-framework.

the class ComponentBinding method displayMessages.

@Override
public MessageList displayMessages(@Nullable MessageList messages) {
    MessageList messagesForProperty = getRelevantMessages(messages != null ? messages : new MessageList());
    componentWrapper.setValidationMessages(messagesForProperty);
    return messagesForProperty;
}
Also used : MessageList(org.linkki.core.message.MessageList)

Example 17 with MessageList

use of org.linkki.core.message.MessageList in project linkki by linkki-framework.

the class ComponentBinding method getRelevantMessages.

private MessageList getRelevantMessages(MessageList messages) {
    MessageList messagesForProperty = propertyDispatcher.getMessages(messages);
    addFatalError(messages, messagesForProperty);
    return messagesForProperty;
}
Also used : MessageList(org.linkki.core.message.MessageList)

Example 18 with MessageList

use of org.linkki.core.message.MessageList in project linkki by linkki-framework.

the class BindingManagerTest method testRegisterUiUpdateObserver.

@Test
public void testRegisterUiUpdateObserver() {
    TestBindingManager bindingManager = new TestBindingManager(() -> new MessageList());
    UiUpdateObserver observer = mock(UiUpdateObserver.class);
    bindingManager.afterUpdateUi();
    verify(observer, never()).uiUpdated();
    bindingManager.addUiUpdateObserver(observer);
    bindingManager.afterUpdateUi();
    verify(observer).uiUpdated();
}
Also used : MessageList(org.linkki.core.message.MessageList) Test(org.junit.Test)

Example 19 with MessageList

use of org.linkki.core.message.MessageList in project linkki by linkki-framework.

the class BindingManagerTest method testRemoveUiUpdateObserver.

@Test
public void testRemoveUiUpdateObserver() {
    TestBindingManager bindingManager = new TestBindingManager(() -> new MessageList());
    UiUpdateObserver observer = mock(UiUpdateObserver.class);
    bindingManager.addUiUpdateObserver(observer);
    bindingManager.removeUiUpdateObserver(observer);
    bindingManager.afterUpdateUi();
    verify(observer, never()).uiUpdated();
}
Also used : MessageList(org.linkki.core.message.MessageList) Test(org.junit.Test)

Example 20 with MessageList

use of org.linkki.core.message.MessageList in project linkki by linkki-framework.

the class DefaultBindingManagerTest method testStartNewContext_BindingContextUsesManagersPropertyBehaviorProvider.

@Test
public void testStartNewContext_BindingContextUsesManagersPropertyBehaviorProvider() {
    DefaultBindingManager defaultBindingManager = new DefaultBindingManager(() -> new MessageList(), behaviorProvider);
    BindingContext bindingContext = defaultBindingManager.startNewContext("foo");
    assertThat(bindingContext.getBehaviorProvider(), is(behaviorProvider));
}
Also used : MessageList(org.linkki.core.message.MessageList) Test(org.junit.Test)

Aggregations

MessageList (org.linkki.core.message.MessageList)23 Test (org.junit.Test)16 Message (org.linkki.core.message.Message)6 MessageMatchers.emptyMessageList (org.linkki.core.matcher.MessageMatchers.emptyMessageList)4 ValidationService (org.linkki.core.binding.validation.ValidationService)3 ArrayList (java.util.ArrayList)2 PropertyDispatcher (org.linkki.core.binding.dispatcher.PropertyDispatcher)2 LabelComponentWrapper (org.linkki.core.ui.components.LabelComponentWrapper)2 ValidationMarker (org.linkki.util.validation.ValidationMarker)2 Button (com.vaadin.ui.Button)1 Label (com.vaadin.ui.Label)1 Before (org.junit.Before)1 BindingContext (org.linkki.core.binding.BindingContext)1 ComponentBinding (org.linkki.core.binding.ComponentBinding)1 ModelObject (org.linkki.core.ui.section.annotations.ModelObject)1