use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class OrganizationalUnitPopUpPresenter method saveCreation.
void saveCreation(final String name, final String defaultGroupId, final String owner) {
final Command saveCommand = () -> {
final Collection<Repository> repositories = new ArrayList<>();
final List<String> contributors = contributorsManagementPresenter.getSelectedContributorsUserNames();
final RemoteCallback<OrganizationalUnit> successCallback = (OrganizationalUnit newOrganizationalUnit) -> {
afterCreateOrganizationalUnitEvent.fire(new AfterCreateOrganizationalUnitEvent(newOrganizationalUnit));
view.hideBusyIndicator();
notificationEvent.fire(new NotificationEvent(view.getSaveSuccessMessage(), NotificationEvent.NotificationType.SUCCESS));
view.hide();
};
final HasBusyIndicatorDefaultErrorCallback errorCallback = new HasBusyIndicatorDefaultErrorCallback(view);
organizationalUnitService.call(successCallback, errorCallback).createOrganizationalUnit(name, owner, defaultGroupId, repositories, contributors);
};
validateDuplicatedOrganizationalUnit(name, saveCommand);
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class AssignmentListItemWidgetViewImplTest method testNameBlurHandler.
@Test
public void testNameBlurHandler() {
ActivityDataIOEditorWidget parent = mock(ActivityDataIOEditorWidget.class);
when(parent.isDuplicateName(anyString())).thenReturn(true);
doReturn("anyName").when(name).getText();
view.setAllowDuplicateNames(false, "ErrorMessage");
view.setParentWidget(parent);
view.init();
verify(name, times(1)).addBlurHandler(blurHandlerCaptor.capture());
BlurHandler handler = blurHandlerCaptor.getValue();
handler.onBlur(mock(BlurEvent.class));
verify(parent, times(1)).isDuplicateName("anyName");
verify(notification, times(1)).fire(new NotificationEvent("ErrorMessage", NotificationEvent.NotificationType.ERROR));
verify(name, times(1)).setValue("");
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class VariableListItemWidgetViewImplTest method testNameBlurHandler.
@Test
public void testNameBlurHandler() {
VariablesEditorWidgetView.Presenter parent = mock(VariablesEditorWidgetView.Presenter.class);
when(parent.isDuplicateName(anyString())).thenReturn(true);
doReturn("anyName").when(name).getText();
view.setParentWidget(parent);
view.init();
verify(name, times(1)).addBlurHandler(blurHandlerCaptor.capture());
BlurHandler handler = blurHandlerCaptor.getValue();
handler.onBlur(mock(BlurEvent.class));
verify(parent, times(1)).isDuplicateName("anyName");
verify(notification, times(1)).fire(new NotificationEvent(null, NotificationEvent.NotificationType.ERROR));
verify(name, times(1)).setValue("");
}
use of org.uberfire.workbench.events.NotificationEvent in project drools-wb by kiegroup.
the class DecisionTableXLSEditorViewImplTest method testSubmit.
@Test
public void testSubmit() throws Exception {
Path path = mock(Path.class);
view.setupUploadWidget(type);
view.submit(path);
verify(attachmentFileWidget).submit(eq(path), eq(SERVLET_URL), commandCaptor.capture(), any(Command.class));
commandCaptor.getValue().execute();
verify(notificationEvent).fire(any(NotificationEvent.class));
verify(presenter).onUploadSuccess();
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class EnableProviderTypeWizard method onEnableTypesError.
private boolean onEnableTypesError() {
notification.fire(new NotificationEvent(translationService.getTranslation(EnableProviderTypeWizard_ProviderTypeEnableErrorMessage), NotificationEvent.NotificationType.ERROR));
start();
return false;
}
Aggregations