use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class AddProjectPopUpPresenterTest method createProjectCallbackAfterProjectIndexedEventTest.
@Test
public void createProjectCallbackAfterProjectIndexedEventTest() {
final WorkspaceProject project = mock(WorkspaceProject.class);
final Path projectRootPath = mock(Path.class);
doReturn(projectRootPath).when(project).getRootPath();
doReturn(project).when(projectService).resolveProject(any(Path.class));
doReturn(project).when(libraryService).createProject(any(), any(), any(), Mockito.<String>any());
doReturn("test").when(view).getName();
doReturn("description").when(view).getDescription();
presenter.onProjectIndexingFinishedEvent(new IndexingFinishedEvent("kClusterId", projectRootPath));
presenter.add();
verify(view).setAddButtonEnabled(false);
verify(view).showBusyIndicator(Mockito.<String>any());
verify(view).setAddButtonEnabled(true);
verify(view).hide();
verify(notificationEvent).fire(any(NotificationEvent.class));
verify(libraryPlaces).goToProject(project);
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class BPMNProjectBaseSessionDiagramHandlerTest method verifySaveOrUpdateWithErrors.
protected void verifySaveOrUpdateWithErrors() {
verify(selectionControl).clearSelection();
when(translationService.getValue(EditorGenerateSvgFileError)).thenReturn(EditorGenerateSvgFileError);
verify(diagramService).saveOrUpdateSvg(eq(path), eq(SVG), serviceCallbackCaptor.capture());
serviceCallbackCaptor.getValue().onError(new ClientRuntimeError("some error"));
verify(notificationEvent).fire(new NotificationEvent(EditorGenerateSvgFileError, NotificationEvent.NotificationType.ERROR));
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class VariableListItemWidgetViewImpl method init.
@PostConstruct
public void init() {
name.setRegExp(StringUtils.ALPHA_NUM_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name());
name.addChangeHandler(event -> {
String value = name.getText();
if (isDuplicateName(value)) {
notification.fire(new NotificationEvent(StunnerFormsClientFieldsConstants.CONSTANTS.DuplicatedVariableNameError(value), NotificationEvent.NotificationType.ERROR));
name.setValue(currentName);
ValueChangeEvent.fire(name, currentName);
} else if (isBoundToNodes(currentName)) {
errorPopupPresenter.showMessage(StunnerFormsClientFieldsConstants.CONSTANTS.RenameDiagramVariableError());
name.setValue(currentName);
ValueChangeEvent.fire(name, currentName);
}
notifyModelChanged();
});
dataTypeComboBox.init(this, true, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT);
customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name());
customDataType.addKeyDownHandler(this::preventSpaces);
PopOver.jQuery(variableTagsSettings).popovers();
setTagTittle("Tags: ");
variableTagsSettings.onclick = e -> {
e.preventDefault();
openOverlayActions();
return null;
};
customTagName.addFocusHandler(focusEvent -> setPreviousCustomValue(customTagName.getValue()));
customTagName.addKeyDownHandler(this::preventSpaces);
loadDefaultTagNames();
setTagsListItems();
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class ContributorsListItemPresenter method save.
public void save() {
final Contributor contributor = new Contributor(view.getName(), view.getRole());
contributorsListService.getContributors(currentContributors -> {
isValid(contributor, currentContributors).then(isValid -> {
if (isValid) {
final List<Contributor> updatedContributors = new ArrayList<>();
if (persistedContributor == null) {
updatedContributors.addAll(currentContributors);
} else {
updatedContributors.addAll(currentContributors.stream().filter(c -> !c.equals(persistedContributor)).collect(Collectors.toList()));
}
updatedContributors.add(contributor);
view.showBusyIndicator(view.getSavingMessage());
contributorsListService.saveContributors(updatedContributors, () -> {
persistedContributor = contributor;
view.setupViewMode(contributor);
parentPresenter.itemIsNotBeingEdited();
view.hideBusyIndicator();
notificationEvent.fire(new NotificationEvent(view.getSaveSuccessMessage(), NotificationEvent.NotificationType.SUCCESS));
parentPresenter.refresh();
}, new HasBusyIndicatorDefaultErrorCallback(view));
}
return promises.resolve();
});
});
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class ContributorsListItemPresenter method remove.
public void remove() {
canRemoveContributor().then(canRemoveContributor -> {
if (canRemoveContributor) {
contributorsListService.getContributors(contributors -> {
if (isLastOwner(persistedContributor, contributors)) {
notificationEvent.fire(new NotificationEvent(view.getSingleOwnerIsMandatoryMessage(), NotificationEvent.NotificationType.ERROR));
} else {
contributors.remove(persistedContributor);
view.showBusyIndicator(view.getSavingMessage());
contributorsListService.saveContributors(contributors, () -> {
view.hideBusyIndicator();
notificationEvent.fire(new NotificationEvent(view.getRemoveSuccessMessage(), NotificationEvent.NotificationType.SUCCESS));
view.removeContributor();
parentPresenter.refresh();
}, new HasBusyIndicatorDefaultErrorCallback(view));
}
});
}
return promises.resolve();
});
}
Aggregations