Search in sources :

Example 66 with NotificationEvent

use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.

the class IntegrationHandlerImpl method migrateFinished.

private void migrateFinished(MigrateResult result, PlaceRequest place) {
    if (result.hasError()) {
        errorPopup.showMessage(getErrorMessage(result));
    } else {
        notification.fire(new NotificationEvent(translationService.getValue(IntegrationClientConstants.MigrateDiagramSuccessfullyMigratedMessage), NotificationEvent.NotificationType.SUCCESS));
        placeManager.forceClosePlace(place);
        placeManager.goTo(createTargetPlace(result.getPath()));
    }
}
Also used : NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Example 67 with NotificationEvent

use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.

the class AbstractProjectDiagramEditor method initializeStunnerEditor.

void initializeStunnerEditor() {
    stunnerEditor.setOnResetContentHashProcessor(h -> this.originalHash = h);
    stunnerEditor.setParsingExceptionProcessor(e -> {
        ProjectMetadata pm = (ProjectMetadata) e.getMetadata();
        updateTitle(pm.getTitle());
        resetEditorPagesOnLoadError(pm.getOverview());
        menuSessionItems.setEnabled(false);
        notification.fire(new NotificationEvent(translationService.getValue(StunnerWidgetsConstants.DiagramParsingError, Objects.toString(e.getMessage(), "")), NotificationEvent.NotificationType.ERROR));
    });
    stunnerEditor.setExceptionProcessor(e -> {
        // close editor in case of error when opening the editor
        placeManager.forceClosePlace(new PathPlaceRequest(versionRecordManager.getCurrentPath(), getEditorIdentifier()));
    });
}
Also used : ProjectMetadata(org.kie.workbench.common.stunner.project.diagram.ProjectMetadata) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Example 68 with NotificationEvent

use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.

the class AssignmentListItemWidgetViewImpl method init.

@PostConstruct
public void init() {
    name.setRegExp(ALLOWED_CHARS, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name());
    name.addChangeHandler(event -> {
        String value = name.getText();
        String notifyMessage = null;
        if (isMultipleInstanceVariable(value)) {
            notifyMessage = StunnerFormsClientFieldsConstants.CONSTANTS.AssignmentNameAlreadyInUseAsMultipleInstanceInputOutputVariable(value);
        } else if (!allowDuplicateNames && isDuplicateName(value)) {
            notifyMessage = duplicateNameErrorMessage;
        }
        if (notifyMessage != null) {
            notification.fire(new NotificationEvent(notifyMessage, NotificationEvent.NotificationType.ERROR));
            name.setValue(EMPTY_VALUE);
            ValueChangeEvent.fire(name, EMPTY_VALUE);
        }
    });
    customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name());
    customDataType.addKeyDownHandler(event -> {
        int iChar = event.getNativeKeyCode();
        if (iChar == ' ') {
            event.preventDefault();
        }
    });
    dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT);
    processVarComboBox.init(this, false, processVar, expression, true, true, EXPRESSION_PROMPT, ENTER_EXPRESSION_PROMPT);
}
Also used : NotificationEvent(org.uberfire.workbench.events.NotificationEvent) PostConstruct(javax.annotation.PostConstruct)

Example 69 with NotificationEvent

use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.

the class RolesListItemWidgetViewImpl method handleValueChanged.

private void handleValueChanged() {
    final String currentRole = row.getModel().getKey();
    final String currentCardinality = row.getModel().getValue();
    if (StringUtils.isEmpty(currentRole)) {
        notification.fire(new NotificationEvent(EMPTY_ERROR_MESSAGE, NotificationEvent.NotificationType.ERROR));
        row.getModel().setKey(previousRole);
        return;
    }
    if (!allowDuplicateNames && isDuplicateName(currentRole)) {
        notification.fire(new NotificationEvent(DUPLICATE_NAME_ERROR_MESSAGE, NotificationEvent.NotificationType.ERROR));
        row.getModel().setKey(previousRole);
        return;
    }
    // skip in case not modified values
    if ((Objects.equals(previousRole, currentRole) && Objects.equals(previousCardinality, currentCardinality))) {
        return;
    }
    previousRole = currentRole;
    previousCardinality = currentCardinality;
    notifyModelChanged();
}
Also used : NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Example 70 with NotificationEvent

use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.

the class DefaultImportsEditorWidget method loadServerDataTypes.

protected void loadServerDataTypes() {
    final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram();
    final Path path = diagram.getMetadata().getPath();
    dataTypeNamesService.call(path).then(serverDataTypes -> {
        addDataTypes(serverDataTypes, true);
        return null;
    }).catch_(exception -> {
        notification.fire(new NotificationEvent(StunnerFormsClientFieldsConstants.CONSTANTS.Error_retrieving_datatypes(), NotificationEvent.NotificationType.ERROR));
        return null;
    });
}
Also used : Path(org.uberfire.backend.vfs.Path) Event(javax.enterprise.event.Event) Arrays(java.util.Arrays) StringUtils.createDataTypeDisplayName(org.kie.workbench.common.stunner.bpmn.client.forms.util.StringUtils.createDataTypeDisplayName) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) StunnerFormsClientFieldsConstants(org.kie.workbench.common.stunner.bpmn.client.forms.fields.i18n.StunnerFormsClientFieldsConstants) RefreshFormPropertiesEvent(org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent) List(java.util.List) DefaultImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport) TreeMap(java.util.TreeMap) Dependent(javax.enterprise.context.Dependent) Map(java.util.Map) ImportsValue(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue) SessionManager(org.kie.workbench.common.stunner.core.client.api.SessionManager) ImportsEditorWidget(org.kie.workbench.common.stunner.bpmn.client.forms.fields.importsEditor.popup.editor.ImportsEditorWidget) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Path(org.uberfire.backend.vfs.Path) DataTypeNamesService(org.kie.workbench.common.stunner.bpmn.client.forms.DataTypeNamesService) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram)

Aggregations

NotificationEvent (org.uberfire.workbench.events.NotificationEvent)151 Test (org.junit.Test)65 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)34 ServerTemplate (org.kie.server.controller.api.model.spec.ServerTemplate)28 ContainerSpec (org.kie.server.controller.api.model.spec.ContainerSpec)22 ServerTemplateList (org.kie.server.controller.api.model.spec.ServerTemplateList)21 List (java.util.List)17 Path (org.uberfire.backend.vfs.Path)17 ErrorCallback (org.jboss.errai.common.client.api.ErrorCallback)16 ArrayList (java.util.ArrayList)14 Event (javax.enterprise.event.Event)14 Inject (javax.inject.Inject)12 ObservablePath (org.uberfire.backend.vfs.ObservablePath)12 PostConstruct (javax.annotation.PostConstruct)9 Observes (javax.enterprise.event.Observes)9 Caller (org.jboss.errai.common.client.api.Caller)9 Map (java.util.Map)8 Promise (elemental2.promise.Promise)7 Arrays (java.util.Arrays)7 Dependent (javax.enterprise.context.Dependent)7