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 ContainerProcessConfigPresenterTest method testSave.
@Test
public void testSave() {
final String templateKey = "templateKey";
final String containerKey = "containerKey";
when(serverTemplateKey.getId()).thenReturn(templateKey);
when(containerSpecKey.getId()).thenReturn(containerKey);
when(view.getSaveSuccessMessage()).thenReturn("SUCCESS");
presenter.save();
verify(notification).fire(new NotificationEvent("SUCCESS", NotificationEvent.NotificationType.SUCCESS));
verify(view).disableActions();
verify(processConfigPresenter).buildProcessConfig();
final ArgumentCaptor<ProcessConfig> processConfigCaptor = ArgumentCaptor.forClass(ProcessConfig.class);
verify(specManagementService).updateContainerConfig(eq(templateKey), eq(containerKey), eq(Capability.PROCESS), processConfigCaptor.capture());
verify(view).enableActions();
verify(processConfigPresenter).setProcessConfig(processConfigCaptor.getValue());
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class ContainerProcessConfigPresenterTest method testSaveError.
@Test
public void testSaveError() {
final String templateKey = "templateKey";
final String containerKey = "containerKey";
when(serverTemplateKey.getId()).thenReturn(templateKey);
when(containerSpecKey.getId()).thenReturn(containerKey);
when(view.getSaveErrorMessage()).thenReturn("ERROR");
doThrow(new RuntimeException()).when(specManagementService).updateContainerConfig(Mockito.<String>any(), Mockito.<String>any(), Mockito.<Capability>any(), Mockito.<ContainerConfig>any());
presenter.save();
verify(notification).fire(new NotificationEvent("ERROR", NotificationEvent.NotificationType.ERROR));
verify(view).disableActions();
verify(view).enableActions();
verify(processConfigPresenter).setProcessConfig(processConfig);
}
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 KieMultipleDocumentEditorRestoreTest method testOnRestore.
@Test
public void testOnRestore() {
final TestDocument document = createTestDocument();
final ObservablePath currentPath = document.getCurrentPath();
final ObservablePath latestPath = mock(ObservablePath.class);
registerDocument(document);
activateDocument(document);
when(versionRecordManager.getCurrentPath()).thenReturn(currentPath);
when(versionRecordManager.getPathToLatest()).thenReturn(latestPath);
editor.onRestore(new RestoreEvent(currentPath));
verify(document, times(1)).setVersion(eq(null));
verify(document, times(1)).setLatestPath(latestPath);
verify(document, times(1)).setCurrentPath(latestPath);
verify(editor, times(2)).initialiseVersionManager(eq(document));
verify(editor, times(1)).refreshDocument(eq(document));
verify(notificationEvent, times(1)).fire(any(NotificationEvent.class));
}
Aggregations