use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class SettingsScreenPresenter method setupUsingCurrentSection.
public Promise<Void> setupUsingCurrentSection() {
this.view.init(this);
showBusyIndicator(ts.getTranslation(LibraryConstants.Loading));
view.enableActions(canUpdate());
return setupSections(new SpaceScreenModel()).then(o -> {
hideBusyIndicator();
if (sectionManager.manages(sectionManager.getCurrentSection())) {
return sectionManager.goToCurrentSection();
} else {
return sectionManager.goToFirstAvailable();
}
}).catch_(o -> promises.catchOrExecute(o, e -> {
hideBusyIndicator();
return promises.reject(e);
}, i -> {
notificationEvent.fire(new NotificationEvent(ts.getTranslation(LibraryConstants.SettingsLoadError), ERROR));
hideBusyIndicator();
return promises.resolve();
}));
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class LibraryScreen method setDescriptionChanged.
private void setDescriptionChanged(OrganizationalUnit organizationalUnit) {
view.setDescription(organizationalUnit.getDescription());
notificationEvent.fire(new NotificationEvent(translationService.format(LibraryConstants.SpaceDescriptionChanged, organizationalUnit.getName()), NotificationEvent.NotificationType.SUCCESS));
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenter method onContainerUpdate.
public void onContainerUpdate(@Observes final ContainerUpdateEvent containerUpdateEvent) {
if (containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0) {
final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert(containerUpdateEvent.getContainerRuntimeOperation());
final String message;
final NotificationEvent.NotificationType notificationType;
switch(containerUpdateEvent.getContainerRuntimeState()) {
case OFFLINE:
message = view.getErrorMessage(containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size());
notificationType = NotificationEvent.NotificationType.ERROR;
break;
case PARTIAL_ONLINE:
message = view.getWarnMessage(containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size());
notificationType = NotificationEvent.NotificationType.WARNING;
break;
case ONLINE:
message = view.getSuccessMessage(containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size());
notificationType = NotificationEvent.NotificationType.SUCCESS;
break;
default:
message = null;
notificationType = null;
break;
}
if (message != null) {
notification.fire(new NotificationEvent(message, notificationType));
}
} else {
logger.warn("Illegal event argument.");
}
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class ContainerPresenter method toggleActivationContainer.
public void toggleActivationContainer() {
if (containerSpec.getStatus().equals(KieContainerStatus.DEACTIVATED)) {
specManagementService.call(new RemoteCallback<Void>() {
@Override
public void callback(final Void response) {
refresh();
}
}, new ErrorCallback<Object>() {
@Override
public boolean error(final Object o, final Throwable throwable) {
notification.fire(new NotificationEvent(view.getStartContainerErrorMessage(), NotificationEvent.NotificationType.ERROR));
refresh();
return false;
}
}).activateContainer(containerSpec);
} else if (containerSpec.getStatus().equals(KieContainerStatus.STARTED)) {
specManagementService.call(new RemoteCallback<Void>() {
@Override
public void callback(final Void response) {
refresh();
}
}, new ErrorCallback<Object>() {
@Override
public boolean error(final Object o, final Throwable throwable) {
notification.fire(new NotificationEvent(view.getStartContainerErrorMessage(), NotificationEvent.NotificationType.ERROR));
refresh();
return false;
}
}).deactivateContainer(containerSpec);
}
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class ContainerPresenter method startContainer.
public void startContainer() {
specManagementService.call(new RemoteCallback<Void>() {
@Override
public void callback(final Void response) {
refresh();
}
}, new ErrorCallback<Object>() {
@Override
public boolean error(final Object o, final Throwable throwable) {
notification.fire(new NotificationEvent(view.getStartContainerErrorMessage(), NotificationEvent.NotificationType.ERROR));
refresh();
return false;
}
}).startContainer(containerSpec);
}
Aggregations