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());
}
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();
}
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());
}
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();
}
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();
}
}
Aggregations