use of org.kie.workbench.common.stunner.bpmn.definition.property.notification.NotificationTypeListValue in project kie-wb-common by kiegroup.
the class NotificationWidget method ok.
@Override
public void ok() {
if (callback != null) {
List<NotificationValue> notifications = getValue().stream().map(NotificationRow::toNotificationValue).collect(Collectors.toList());
callback.getData(new NotificationTypeListValue(notifications));
}
view.hide();
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.notification.NotificationTypeListValue in project kie-wb-common by kiegroup.
the class NotificationWidgetViewImplTest method testOnAddNewValueAndSave.
@Test
public void testOnAddNewValueAndSave() {
dataProvider.setList(new ArrayList<>());
final NotificationTypeListValue[] value = new NotificationTypeListValue[1];
NotificationsEditorWidget.GetNotificationsCallback callback = v -> value[0] = v;
setFieldValue(presenter, "view", view);
notificationWidgetViewImpl.init(presenter, generateRows());
presenter.setCallback(callback);
setFieldValue(notificationWidgetViewImpl, "editor", notificationEditorWidget);
setFieldValue(notificationEditorWidget, "view", notificationEditorWidgetImpl);
NotificationRow newRow = new NotificationRow();
newRow.setId(111);
notificationWidgetViewImpl.addOrEdit(newRow);
notificationWidgetViewImpl.onSubscription(new NotificationEvent(newRow));
notificationWidgetViewImpl.ok();
notificationWidgetViewImpl.hide();
Assert.assertEquals(0, presenter.getValue().size());
Assert.assertEquals(5, value[0].getValues().size());
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.notification.NotificationTypeListValue in project kie-wb-common by kiegroup.
the class NotificationWidgetViewImplTest method testOnAddNewValueAndClose.
@Test
public void testOnAddNewValueAndClose() {
dataProvider.setList(new ArrayList<>());
final NotificationTypeListValue[] value = new NotificationTypeListValue[1];
NotificationsEditorWidget.GetNotificationsCallback callback = v -> value[0] = v;
setFieldValue(presenter, "view", view);
notificationWidgetViewImpl.init(presenter, generateRows());
presenter.setCallback(callback);
setFieldValue(notificationWidgetViewImpl, "editor", notificationEditorWidget);
setFieldValue(notificationEditorWidget, "view", notificationEditorWidgetImpl);
NotificationRow newRow = new NotificationRow();
newRow.setId(111);
notificationWidgetViewImpl.addOrEdit(newRow);
notificationWidgetViewImpl.onSubscription(new NotificationEvent(null));
notificationWidgetViewImpl.ok();
notificationWidgetViewImpl.hide();
Assert.assertEquals(0, presenter.getValue().size());
Assert.assertEquals(4, value[0].getValues().size());
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.notification.NotificationTypeListValue in project kie-wb-common by kiegroup.
the class NotificationWidgetViewImplTest method testOnEditValueAndSave.
@Test
public void testOnEditValueAndSave() {
dataProvider.setList(new ArrayList<>());
final NotificationTypeListValue[] value = new NotificationTypeListValue[1];
NotificationsEditorWidget.GetNotificationsCallback callback = v -> value[0] = v;
setFieldValue(presenter, "view", view);
notificationWidgetViewImpl.init(presenter, generateRows());
presenter.setCallback(callback);
setFieldValue(notificationWidgetViewImpl, "editor", notificationEditorWidget);
setFieldValue(notificationEditorWidget, "view", notificationEditorWidgetImpl);
NotificationRow newRow = new NotificationRow();
newRow.setId(1);
notificationWidgetViewImpl.addOrEdit(newRow);
notificationWidgetViewImpl.onSubscription(new NotificationEvent(newRow));
notificationWidgetViewImpl.ok();
notificationWidgetViewImpl.hide();
Assert.assertEquals(0, presenter.getValue().size());
Assert.assertEquals(4, value[0].getValues().size());
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.notification.NotificationTypeListValue in project kie-wb-common by kiegroup.
the class NotificationsEditorWidget method setValue.
@Override
public void setValue(NotificationTypeListValue value, boolean fireEvents) {
if (value != null) {
NotificationTypeListValue oldValue = notificationTypeListValue;
notificationTypeListValue = value;
initTextBox();
if (fireEvents) {
ValueChangeEvent.fireIfNotEqual(this, oldValue, notificationTypeListValue);
}
}
}
Aggregations