Search in sources :

Example 1 with ListenerModel

use of org.kie.workbench.common.services.shared.kmodule.ListenerModel in project kie-wb-common by kiegroup.

the class ListenerConverter method marshal.

@Override
public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {
    ListenerModel listener = (ListenerModel) value;
    writer.addAttribute("type", listener.getType());
}
Also used : ListenerModel(org.kie.workbench.common.services.shared.kmodule.ListenerModel)

Example 2 with ListenerModel

use of org.kie.workbench.common.services.shared.kmodule.ListenerModel in project kie-wb-common by kiegroup.

the class KnowledgeSessionListItemPresenter method addListener.

public void addListener() {
    listenersListPresenter.add(new ListenerModel());
    signalListenerAddedOrRemoved();
}
Also used : ListenerModel(org.kie.workbench.common.services.shared.kmodule.ListenerModel)

Example 3 with ListenerModel

use of org.kie.workbench.common.services.shared.kmodule.ListenerModel in project kie-wb-common by kiegroup.

the class ListenerListItemPresenterTest method testSetup.

@Test
public void testSetup() {
    final ListenerModel listenerModel = new ListenerModel();
    listenerModel.setType("Type");
    listenerModel.setKind(ListenerModel.Kind.RULE_RUNTIME_EVENT_LISTENER);
    final HTMLElement selectContainer = mock(HTMLElement.class);
    doReturn(selectContainer).when(view).getKindSelectContainer();
    final ListenerListItemPresenter result = listenerListItemPresenter.setup(listenerModel, mock(KnowledgeSessionListItemPresenter.class));
    Assert.assertEquals(result, listenerListItemPresenter);
    verify(view).init(eq(listenerListItemPresenter));
    verify(view).setType(eq("Type"));
    verify(kindSelect).setup(eq(selectContainer), eq(ListenerModel.Kind.values()), eq(ListenerModel.Kind.RULE_RUNTIME_EVENT_LISTENER), any());
}
Also used : ListenerModel(org.kie.workbench.common.services.shared.kmodule.ListenerModel) HTMLElement(elemental2.dom.HTMLElement) KnowledgeSessionListItemPresenter(org.kie.workbench.common.screens.library.client.settings.knowledgebases.item.knowledgesessions.KnowledgeSessionListItemPresenter) Test(org.junit.Test)

Example 4 with ListenerModel

use of org.kie.workbench.common.services.shared.kmodule.ListenerModel in project kie-wb-common by kiegroup.

the class ListenerListItemPresenterTest method testSetType.

@Test
public void testSetType() {
    listenerListItemPresenter.model = new ListenerModel();
    listenerListItemPresenter.parentPresenter = mock(KnowledgeSessionListItemPresenter.class);
    listenerListItemPresenter.setType("Type");
    Assert.assertEquals("Type", listenerListItemPresenter.model.getType());
    verify(listenerListItemPresenter.parentPresenter).fireChangeEvent();
}
Also used : ListenerModel(org.kie.workbench.common.services.shared.kmodule.ListenerModel) KnowledgeSessionListItemPresenter(org.kie.workbench.common.screens.library.client.settings.knowledgebases.item.knowledgesessions.KnowledgeSessionListItemPresenter) Test(org.junit.Test)

Example 5 with ListenerModel

use of org.kie.workbench.common.services.shared.kmodule.ListenerModel in project kie-wb-common by kiegroup.

the class KSessionConverter method marshal.

public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {
    KSessionModel kSession = (KSessionModel) value;
    writer.addAttribute("name", kSession.getName());
    writer.addAttribute("type", kSession.getType());
    writer.addAttribute("default", Boolean.toString(kSession.isDefault()));
    if (kSession.getClockType() != null) {
        writer.addAttribute("clockType", kSession.getClockType().getClockTypeAsString());
    }
    if (kSession.getScope() != null) {
        writer.addAttribute("scope", kSession.getScope().toString());
    }
    writeObjectList(writer, context, "workItemHandlers", "workItemHandler", kSession.getWorkItemHandelerModels());
    if (!kSession.getListeners().isEmpty()) {
        writer.startNode("listeners");
        for (ListenerModel listener : kSession.getListeners()) {
            writeObject(writer, context, listener.getKind().toString(), listener);
        }
        writer.endNode();
    }
}
Also used : ListenerModel(org.kie.workbench.common.services.shared.kmodule.ListenerModel) KSessionModel(org.kie.workbench.common.services.shared.kmodule.KSessionModel)

Aggregations

ListenerModel (org.kie.workbench.common.services.shared.kmodule.ListenerModel)6 Test (org.junit.Test)2 KnowledgeSessionListItemPresenter (org.kie.workbench.common.screens.library.client.settings.knowledgebases.item.knowledgesessions.KnowledgeSessionListItemPresenter)2 HTMLElement (elemental2.dom.HTMLElement)1 KSessionModel (org.kie.workbench.common.services.shared.kmodule.KSessionModel)1